I am new to HA and trying to get my head around how it works with values from the dashboard to the automation part. Now, I have the following code:
action:
- service: persistent_notification.create #----> just for debugging
data:
message: "Test {{ states('input_number.hiti') }}" #-----> Prints out correct float value in notifications
- repeat:
while:
- type: is_temperature
condition: device
device_id: 1a6fe51f58034d8e221f1a97e6aa0490
entity_id: sensor.hiti_temp_1
domain: sensor
below: "{{ states('input_number.hiti') }}" #---> returns no value
What I want is to use the value from my slider as the “below” value in the while loop. It prints out correct value in the notification, a float value I set my slider (input_number.hiti) to, but when I restart the automation part I get the following error:
Invalid config for [automation]: expected float for dictionary value @ data[‘below’]. Got None. (See /config/configuration.yaml, line 11).
Replacing the “{{ states(‘input_number.hiti’) }}” with a float number makes all working again. Does anyone have tip how to solve this?
Another thing, I looked at the generic thermo and I would like to use it in my dashboard but use the set value there in my automation. I can´t figure out how to retreive the set value from it. Does anyone know how to do that?
Templates are not accepted in all trigger and condition types. So, don’t use a Device condition in your while, use a Numeric state condition or Template condition:
Also, from what you have posted it is impossible to tell if you have constructed your automation improperly, or you just left stuff out for the sake of brevity. The action(s) your want to repeat need to be nested under the repeat… in your example there are no actions that will repeat.
Thank you @Didgeridrew .This works as a charm. Now I just need to try to understand the difference in devices and numeric states. I just left out the rest of the config to keep things simple as I knew that part was working. But it’s no secret, I am basically just trying to do what the generic thermo does, except I want to use weather forecast and some other features. Let´s see how that goes
Thank you for your help
Ok…dumb question… below: input_number.hiti
How can I subtract or add a number to the input_number.hiti value? just adding - 1 or + 1 does not work
Nor value_template