The goal of my automation is to enhance the thermostat behavior.
I want to start it eary, depending of time and temperature.
I have several time and temperature points and if for a given time the temperature is below his point I want to start the heater
Basically, there is one trigger every 30 minutes from 5:00 until 8:00
Conditions for firing action only if for a given time the temperature is below the level.
The automation is triggered at the specified time(s) but the condition blocks execution of the action. Why? Because the condition compares sensor.time to a string contains hours, minutesand seconds. However sensor.time has a value containing only hours and minutes.
Either remove the seconds portion of the time in the condition (like in tom_I’s example) or, even better, remove the entire condition because it serves no useful purpose.
In your example, you used {{trigger.entity_id}} however a Time Trigger does not have an entity_id.
What it does have is trigger.now which is a datetime object. For example trigger.now.hour and trigger.now.minute return the hour and minute when the trigger occurred.
That should fire (it does for me) but note that sensor.time might not yet have updated when it fires so the sensor could still be 12:49 when it fires at 12:50:00. Better to use e.g. trigger.now like Taras said.
You have created an automation that triggers at 12:50:00 and then the condition checks if the automation triggered at 12:50. Why? In this particular case, I can’t think of a good reason to double-check the trigger time like that. What’s your reason?
the reason is:
Effectively there is fiew trigger time based from 5:00 to 8:00
The goal is to start the heater.
But, when one of time conditions is ok, I have to check what time is it to check the temperature value:
at 5:30 if the temperature is below 17,5 or
at 6h if the temperature is below 18 or
…
The original script is hre (not working):
# La temperature en chauffage monte d'environ 1,13 degré par heure si la cuisine ou le salon chauffe
alias: "cuisine thermostat amelioration"
trigger:
- platform: time
at: "07:30:00"
- platform: time
at: "07:00:00"
- platform: time
at: "06:30:00"
- platform: time
at: "06:00:00"
- platform: time
at: "05:30:00"
- platform: time
at: "05:00:00"
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.save_electricity
state: 'off'
- condition: state
entity_id: input_boolean.home_presence_state
state: 'on'
- condition: template
value_template: "{{ (is_state('sensor.time','07:30') and states('sensor.dining_room_temp')|float < 19.5) or
(is_state('sensor.time','07:00') and states('sensor.dining_room_temp')|float < 19) or
(is_state('sensor.time','06:30') and states('sensor.dining_room_temp')|float < 18.5) or
(is_state('sensor.time','06:00') and states('sensor.dining_room_temp')|float < 18) or
(is_state('sensor.time','05:30') and states('sensor.dining_room_temp')|float < 17.5) or
(is_state('sensor.time','05:00') and states('sensor.dining_room_temp')|float < 17) }} "
action:
- service: climate.set_hvac_mode
entity_id: climate.neviweb_climate_salle_a_manger
data:
hvac_mode: "heat"
- service: climate.set_temperature
entity_id: climate.neviweb_climate_salle_a_manger
data:
temperature: 20
- service: notify.email
data:
title: "Home assistant info"
message: "Demarrage anticipe du chauffage de la cuisine. Trigger: {{trigger.entity_id}}"
- delay: '00:30:00'
- service: climate.set_hvac_mode
entity_id: climate.neviweb_climate_salle_a_manger
data:
hvac_mode: "auto"
- service: notify.email
data:
title: "Home assistant info"
message: "Chauffage de la cuisine remi en mode auto"
It’s a curve with fiew points
If the temperature is below one point I start the hvac for 30 minutes and back in auto mode.
Many thanks for your help
Regards