That’s too bad, thanks anyway! I wish the devs would enable setting a period for more/all conditions, not just a few of them. That would make this kind of thing SO much easier.
Basic template:
templates:
- binary_sensor:
- name: "THERMOSTAT1 synced"
state: {{ is_state_attr('climate.thermostat', 'temperature', states('input_number.thermostat_temperature_ui')|float(0)) }}
delay_on:
seconds: 10
This is a basic template for a sensor that is true
if the input_number-state & and the temperature-attribute of the thermostat are identical for a period of 10 seconds. This is a working solution to my initial problem.
Explanation:
is_state_attr([entity], [attribute], [other_value])
Returns true
if an attribute
of an entity
is equal to another value
.
states([entity])|float(0)
Returns the value of an entity
and coverts it into a number
.
My template:
- binary_sensor:
- name: "THERMOSTAT1 synced"
state: >
{{ is_state('switch.thermostat1_mainswitch_ui','on') and is_state('binary_sensor.window1_opening','off') and is_state('climate.thermostat1','heat') and is_state_attr('climate.thermostat1', 'temperature', states('input_number.thermostat1_temperature_ui')|float(0))
or is_state('switch.thermostat1_mainswitch_ui','on') and is_state('binary_sensor.window1_opening','on') and is_state('climate.thermostat1','heat') and is_state_attr('climate.thermostat1', 'temperature', 5)
or is_state('switch.thermostat1_mainswitch_ui','off') and is_state('climate.thermostat1','off') }}
In case anyone is interested, here is the full binary_sensor-template I use to check if my window-state & helper entities (to use for the UI) are in sync with my thermostat. As soon as anything becomes out of sync, it returns false
and this can be used to start an automation that syncs the state of the mentioned helper-entities to the thermostat and also terminate the script as soon as it is synced.
Even if this solution needs an entity, I think that is alright because it decreases the complexity of the automation/script by A LOT and increases flexibility and reliability.