I didn’t do it with the editor, but following this article.
Well the template editor is a debugging tool. It is designed to help with such problems, so give it a try.
After a few attempts I solved it, all I had to do was put the double quotes. For a stupid thing, I wasted a lot of time.
temperature: "{{ state_attr('climate.split_salone' , 'current_temperature') | float | round(0) + 1 }}"
Thanks anyway.
I’m trying this right now, but getting stuck. This is what I have:
service: climate.set_temperature
target:
entity_id: climate.trv_arbeitszimmer
data:
temperature: >-
{{ (state_attr('climate.trv_arbeitszimmer', 'temperature') | round(0)) - 1
}}
Saves without issues but doesn’t work. Triggering it manually doesn’t give an error popup or anything, but checking the execution trace, I see this error for the according step:
must contain at least one of temperature, target_temp_high, target_temp_low.
But temperature is right there in the yaml… I also tried changing data to data_template as seen in the other posts here but honestly I have no idea what that would mean or do.
Surely target_temperature is what you want?
You mean in the state_attr
expression or the yaml key?
I basically just followed the instructions from the post I quoted, i.e. create the action via GUI and then just change the numeric value, so the temprerature
key was already there. I interpreted the error message as telling me that the only valid keys there would be temperature
, target_temp_high
and target_temp_low
. I tried all three and the error stayed the same. Now I also tried target_temperature
but that results in exactly the same behavior.
As for the expression, I tested it in the template editor, and state_attr('climate.trv_arbeitszimmer', 'temperature')
gives me the current setting, so that seems to be correct at least.
Yes sorry it is temperature.
Well, that was a big facepalm when I solved it. In the GUI, I apparently didn’t click “select device” but “select entity”. In both cases you can select the TRV and everything looks like it should work, except that it doesn’t. Even setting a fixed temperature leads to the same failure, so this doesn’t have anything to do with templates or anything. So you want a device_id
as target, not an entity_id
.