I’m new to home assistant so I’m not sure if I misunderstand something…
I want to switch off my climate (heating boiler) when the back door opens, and store the state of the heating so that I can reset it when the door closes again.
I intend to store the state of the climate in a Input Text field.
In the developer tools I can do this fine, but when I put it in an automation on the Climate Device it doesn’t set the text field.
If I change the value to a fixed string such as ‘Hello’ or similar it works fine.
What am I doing wrong in the below automation YAML?
alias: Save Kitchen HVAC state on Open and Set off
description: ""
triggers:
- type: opened
device_id: exxx7
entity_id: 6xxx4
domain: binary_sensor
trigger: device
conditions: []
actions:
- action: text.set_value
data:
value: "{{ states.climate.kitchen.state }}"
target:
entity_id: input_text.kitchen_last_hvac_state
mode: single
Just to add I created a similar approach using if statements for each option (auto, heat, off) and then setting the text with literal strings. That didn’t work either. I created it using the visual editor so now I’m starting to think it might not be totally due to my inexperience!
You can use scenes to capture the state of any entity and restore it later. Use the scene.create service to capture the state. (I somehow can no longer find the scene.create service in the docs.)
As for why your code isn 't working:
should be
input_text.set_value
Confusing, but text is a different domain than input_text. I make this mistake too on occasion.
And a final tip: avoid device triggers whenever you can: