I found this piece of code in the cookbook and I find it very useful but I need to change the value ‘on’ of the state variable with something like:
"every state different from ‘Off’ ",
since the variabile “state” could has different values.
Thanks
p.s: I know this is a switch but I am using the climate itself.
####################################################
# Air Conditionar Self Shutdown #
####################################################
- id: AC_Self_Shut
alias: AC Self Shutdown - Heat
trigger:
- platform: state
entity_id:
- switch.air_conditioner__heat_30
state: 'on'
for: '02:01:00'
action:
- service: switch.turn_off
data_template:
entity_id: " {{ trigger.entity_id }} "
- service: notify.homenicoassistant_bot
data_template:
message: >
"{{ trigger.to_state.attributes.friendly_name }} just changed from {{ trigger.to_state.state }}
to {{ trigger.from_state.state }} - AC Selfshutdown Automation - Heat 30 Mode OFF"