From: Giorgio Ravera Date: Mon, 11 Feb 2019 14:24:43 +0000 (+0100) Subject: Added climate script X-Git-Url: http://git.giorgioravera.it/?a=commitdiff_plain;h=54926174e278e7414bd67ca0277e1b47bcb32220;p=homeassistant.git Added climate script --- diff --git a/automation/climate.yaml b/automation/climate.yaml index 0fc6a63f..289cd65d 100644 --- a/automation/climate.yaml +++ b/automation/climate.yaml @@ -1,9 +1,9 @@ ###################################################################### # Climate: Weekly Schedule -# - climate.set_temperature +# - script.climate_daily_schedule ###################################################################### -- alias: "Termosifoni: Schedule Settimanale" +- alias: "Termosifoni: Schedule Feriale" trigger: - platform: time at: '06:30:00' @@ -24,100 +24,50 @@ state: 'off' - condition: time - weekday: - - mon - - tue - - wed - - thu - - fri + weekday: [mon, tue, wed, thu, fri] action: - - service: climate.set_temperature + - service: script.climate_daily_schedule data_template: entity_id: climate.bagno_termostato_cucina - temperature: >- - {% if trigger.now.hour == 6 %} - 20 - {% elif trigger.now.hour == 7 %} - 18 - {% elif trigger.now.hour == 9 %} - 20 - {% elif trigger.now.hour == 18 %} - 20.5 - {% elif trigger.now.hour == 22 %} - 16 - {% else % } - 16 - {% endif %} + temp1: 20 + temp2: 18 + temp3: 20 + temp4: 20.5 + temp5: 16 - - service: climate.set_temperature + - service: script.climate_daily_schedule data_template: entity_id: climate.bagno_termostato_sala - temperature: >- - {% if trigger.now.hour == 6 %} - 18 - {% elif trigger.now.hour == 7 %} - 18 - {% elif trigger.now.hour == 9 %} - 19.5 - {% elif trigger.now.hour == 18 %} - 20 - {% elif trigger.now.hour == 22 %} - 16 - {% else % } - 16 - {% endif %} + temp1: 18 + temp2: 18 + temp3: 19.5 + temp4: 20 + temp5: 16 - - service: climate.set_temperature + - service: script.climate_daily_schedule data_template: entity_id: climate.bagno_termostato_bagno - temperature: >- - {% if trigger.now.hour == 6 %} - 19 - {% elif trigger.now.hour == 7 %} - 18 - {% elif trigger.now.hour == 9 %} - 19 - {% elif trigger.now.hour == 18 %} - 19.5 - {% elif trigger.now.hour == 22 %} - 16 - {% else % } - 16 - {% endif %} + temp1: 19 + temp2: 18 + temp3: 19 + temp4: 29.5 + temp5: 16 - - service: climate.set_temperature + - service: script.climate_daily_schedule data_template: entity_id: climate.bagno_termostato_studio - temperature: >- - {% if trigger.now.hour == 6 %} - 18 - {% elif trigger.now.hour == 7 %} - 18 - {% elif trigger.now.hour == 9 %} - 19.5 - {% elif trigger.now.hour == 18 %} - 20 - {% elif trigger.now.hour == 22 %} - 16 - {% else % } - 16 - {% endif %} + temp1: 18 + temp2: 18 + temp3: 19.5 + temp4: 20 + temp5: 16 - - service: climate.set_temperature + - service: script.climate_daily_schedule data_template: entity_id: climate.bagno_termostato_camera - temperature: >- - {% if trigger.now.hour == 6 %} - 19 - {% elif trigger.now.hour == 7 %} - 18 - {% elif trigger.now.hour == 9 %} - 19 - {% elif trigger.now.hour == 18 %} - 19.5 - {% elif trigger.now.hour == 22 %} - 16 - {% else % } - 16 - {% endif %} + temp1: 19 + temp2: 18 + temp3: 19 + temp4: 19.5 + temp5: 16 diff --git a/automation/day.yaml b/automation/day.yaml index d6b71ba6..f81829ea 100644 --- a/automation/day.yaml +++ b/automation/day.yaml @@ -16,12 +16,7 @@ state: 'off' - condition: time - weekday: - - mon - - tue - - wed - - thu - - fri + weekday: [mon, tue, wed, thu, fri] action: - service: cover.set_cover_position diff --git a/script/climate.yaml b/script/climate.yaml new file mode 100644 index 00000000..5ac83826 --- /dev/null +++ b/script/climate.yaml @@ -0,0 +1,38 @@ +###################################################################### +# Climate: Daily Schedule +# Inputs: +# - entity_id +# - temp1 +# - temp2 +# - temp3 +# - temp4 +# - temp5 +# +# Operations: +# - cover.{{modus}}_cover +###################################################################### + +climate_daily_schedule: + alias: "Termosifoni: Schedulazione giornaliera" + sequence: + - service: climate.set_temperature + data_template: + entity_id: {{ entity_id }} + temperature: >- + {% set current_date_string = now().strftime("%H%M") %} + {% set time1_string = ("0630") %} + {% set time2_string = ("0730") %} + {% set time3_string = ("0900") %} + {% set time4_string = ("1830") %} + {% set time5_string = ("2200") %} + {% if (current_date_string|int >= (time1_string)|int) and ((current_date_string|int < (time2_string)|int)) %} + {{ temp1 }} + {% eliif (current_date_string|int >= (time2_string)|int) and ((current_date_string|int < (time3_string)|int)) %} + {{ temp2 }} + {% elif (current_date_string|int >= (time3_string)|int) and ((current_date_string|int < (time4_string)|int)) %} + {{ temp3 }} + {% elif (current_date_string|int >= (time4_string)|int) and ((current_date_string|int < (time5_string)|int)) %} + {{ temp4 }} + {% else % } + {{ temp5 }} + {% endif %}