Created
February 18, 2024 04:16
-
-
Save Tugzrida/cfa66c2d3500e9cf827d2a3d4d981a9c to your computer and use it in GitHub Desktop.
Revisions
-
Tugzrida created this gist
Feb 18, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ template: - sensor: - name: "Current power tariff" unique_id: sensor.current_power_tariff state: > {% if now().weekday() not in (5, 6) and ( (now().month in (11, 12, 1, 2, 3) and 14 <= now().hour <= 19) or (now().month in (6, 7, 8) and 17 <= now().hour <= 20) )-%} Peak {%- elif 7 <= now().hour <= 21 -%} Shoulder {%- else -%} Off-peak {%- endif %} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ template: - sensor: - name: "Current power tariff" unique_id: sensor.current_power_tariff state: > {% if now().weekday() not in (5, 6) and ( (now().month in (9, 10, 11, 12, 1, 2, 3, 4, 5) and 14 <= now().hour <= 19) or (now().month in (6, 7, 8) and 17 <= now().hour <= 20) )-%} Peak {%- else -%} Off-peak {%- endif %}