I’m hoping someone will be able to help me write an Automation for the following scenario;
My heating uses Zigbee temperature sensors to monitor temperatures of the rooms and turn on the boiler as and when required. All this is controlled via my Home Assistant and uses various automations to control it.
The problem I have is that occassionaly the sensors lock up at any given temperature, meaning that the boiler will now not turn off as the sensor does not read any temperature change. This then requires a manual intervention to knock the boiler off and or reset the sensor.
The Automation I’m looking for will recognise that the temperature sensor has not changed value for a given period of time. This will then trigger a notify action to tell me.
I’m not sure how to tell the ‘Trigger’ to be a no change in numerical state.
Petro wrote a great reply on state objects and their properties:
The template takes the time and date the sensor last changed, converts this to a timestamp, which is just the number of seconds since the last Unix epoch, ( 00:00:00 UTC on 1 January 1970 ). We add 30*60 seconds to it and check to see how that compares to the timestamp of the UTC time now. If the now timestamp is a bigger number of seconds, then your sensor has not changed for 30 minutes.
This s as a almost exactly what I am trying to do but I am struggling to get it to work.
The code I have so far is
alias: Hot Water Boost Failure (Duplicate)
description: ''
trigger:
- platform: state
entity_id: timer.hot_water_boost
to: active
condition:
- condition: template
value_template: >-
{{ as_timestamp( utcnow() ) | int > as_timestamp(
states.sensor.hot_water_temperature.last_changed ) | int +2*60 }}
action:
- service: notify.mobile_app_my_iphone
data:
message: Water Temperature failed
mode: single
I am trying to boost my hot water for about 30 minutes and have the automation check if the temperature of the hot water is increasing. If the temperature does not increase by a certain amount in 15 minutes for example, send me a notification or maybe do something else.
The platform: template looks like it can do what I am trying to accomplish but I’m struggling to implement it.