@nealedowling wrote:
Hello.
I am trying to set up an automation to control my pellet stove based on time of day and temperature.
However, I need to be able to change the “Time of day” in question.
Depending on what time I am working (getting up) I want the stove to turn on. So I am using an input_datetime that I can control from the frontend based on my needs.
I have added the following as an automation, but am having two difficulties:#TurnStoveOn under 21.5 Morning and evening - alias: Stove Auto On Timer and Temp trigger: - platform: numeric_state entity_id: sensor.ht_living_temp below: 22.5 condition: condition: and conditions: - condition: template value_template: "{{ as_timestamp(state('sensor.time')) > (state_attr('input_datetime.stove_morning_start', 'timestamp') | int | timestamp_custom('%H:%M', True)) }}" - condition: template value_template: "{{ as_timestamp(state('sensor.time')) < (state_attr('input_datetime.stove_morning_finish', 'timestamp') | int | timestamp_custom('%H:%M', True)) }}" action: - service: switch.turn_on entity_id: - switch.pellet_stove
- It seems to trigger regardless of the time set in input_datetime.stove_morning_finish or input_datetime.stove_morning_start
- I do not know how to get HASS.IO to show the values that it is using for the comparaison.
Is there something wrong with my code?
Does anyone have any suggestions as to how I can fix this?The values for input_datetime.stove_morning_start and input_datetime.stove_morning_finish, as well as the value returned by the state of sensor.time can be seen in the screenshots below. (Correction - I’m a new user and cannot post more than one image.)
The input_datetime.stove_morning_finish has a state of 13:02:00 (timestamp attribute is 46920 - no date data here)
The input_datetime.stove_morning_start has a state of 04:40:00 (timestamp attribute is 16800)The logic (as far as I can see) says: Once triggered (temp), if the state.time value is greater than 04:40 and is less than 13:02, turn the stove on. However, manually triggering at at 13:58, it is still turning the stove on!
Do I need to convert to timestamp of sensor.time (or (now) with null date, to perform numeric comparaisons? If so, how to do?
Any help would be greatly appreciated.
Posts: 6
Participants: 2