I’m trying to get the boiler relay to fire when the set point is higher than the current temp. I downloaded this from the HA website but it isnt working. Any ideas?
temperature_set_point isn’t a standard attribute for climate entities… the normal attribute is just temperature. Double check your entity in the States tool to make sure you’re using the correct attribute name. Also, you cannot use both a multi-line indicator like >- and quotes "… get rid of the quotes around the template.
Thanks. You are correct… the set_point was incorrect. I check in states. I’ve fixed that but it still isnt working.
It wont let me get rid of the quotes. I just get this message - Message malformed: template value should be a string for dictionary value @ data[‘value_template’]
Thanks Tinkerer, I’m really struggling to get my head around the value_template. I’ve put your code into an automation and it still doesnt trigger. I’m chaning the ‘temperature’ setpoint all over the place and it doesnt trigger. I’ve tried ‘temperature’ and ‘temperature_set_point’ (even though I know its ‘temperature’
Any ideas?
I’m eternally greatful for any help as this is really annoying me
I agree with @Tinkerer, just use a Template trigger.
The Numeric state trigger has somewhat complicated logic. For example, it will only fire on changes to the state of the entity listed under entity_id, not the other entity in the template. In analogous Template trigger changes to either entity can cause the trigger to fire.
@Didgeridrew OK thanks for explaining that… I found the automation on the HA website when I was trying to figure it out. It isnt going to work if the current temp is 3 degrees or more higher than the setpoint. I’ve changed it to 1 degree lower than the setpoint and it still isnt working.
All I want to do is fire the boiler relay when the set point is higher than the actual temperature? 1 degree higher will be fine. Then turn the boiler relay off when the actual temperature is 1 degree over the setpoint?
As always, any help is greatly appreciated. I’m new to this and managed to crack everything by myself so far. Its just this one which is destroying me.
The entity is ‘sensor.hot_water_control_air_temperautre’ and the state is the measured temperature. Basically, if the hot water is below 50 then the hot water relay fires
First, you have left out the value_template: key form the sensor configuration. This is the source of the error.
Second, your template is not surrounded in quotes or demarcated by a multiline quote indicator.
Third, you have not converted your state to an actual number. States are always strings. Attributes can be other data types. Any time you want to perform mathematical operations or numeric comparisons on a state, you must first convert it using either int() or float().
Thanks. I get the theory, I just dont understand the actual coding of value templates and I cant find anything online to learn from except you very helpful people… what does ‘float’ do? I’ve tried the following and it still doesnt trigger -
Home Assistant Templating : This is the the most comprehensive and up-to-date source for HA-specific functions.
Jinja Docs: These docs are not geared toward new/casual users, but they contain a lot of important information.
Jinja for Ninjas: This is a well organized tutorial and group of examples. It’s been a while since this was updated, so there are better/easier ways to do some of the things shown, but it’s still a good resource.
Basically, I’ve got a toggle on overview which allows the automation to run. When toggling it doesnt trigger. I’ve got an automation which refreshes the hot water sensor value every 5 minutes so I wait until the value is refreshed but still doesnt trigger. If I click ‘run’ in automations then it does fire the relays etc. It just getting it to trigger autmatically which I cant get working
Turning an automation on (aka enabling the automation) is not the same as triggering.
It doesn’t matter how often you “refresh” the sensor, a Template trigger will only fire when the evaluation of the template changes from “false” to “true”. You can temporarily manipulate the value of states or attributes in the Developer Tools > States tool by selecting the desired entity, editing the state in the “Set State” section then clicking the “Set State” button. Remember, if the current state is already less than 50, you need to set the value above fifty, then set it back below fifty (or wait until it updates normally).
Using the “Run” button or calling the automation.triggeronly runs the actions, the triggers and conditions are skipped.