Set entity value with template

Hi,

I have a danfoss termostat which expose an entity number.thermostat_salon_external_measured_room_sensor which i want to update with an external sensor

So i did an automation but there is no thermostat service to set this so I’m using the action device and use sub action to set this value.
now i put an harcoded value, it works but if i try to use a template it keep complaining that it’s not a float value

device_id: 26657ff769f11ef36986b51b3b024ca0
domain: number
entity_id: 9043d142bb3a5be63f851d8046f14ee2
type: set_value
value: "{{ states('sensor.sonde_salon_temperature') | float(0) }}"

Now i did try this template in the development tools and it’s working
So are template not supported here ? how can i set this number.thermostat_salon_external_measured_room_sensor ?

i have managed to do what I wanted by sending a mqqt message, but still it should be possible to change the entity value with a template

Device actions do not support templates, but it is possible. Use the number set value service instead: https://www.home-assistant.io/integrations/number/#services

- service: number.set_value
  target:
    entity_id: number.thermostat_salon_external_measured_room_sensor
  data:
    value:: "{{ states('sensor.sonde_salon_temperature') | float(0) }}"

You should stop using device triggers, conditions and actions. See: Why and how to avoid device_ids in automations and scripts

1 Like

I did try this, but i had an error, something like unsupported entity
Though this one was only for input_number as the visual editor only let you choose them

And i think i use device nowhere in my automation, always service but thanks for the link

Try again and post the exact error text.

ha my bad i was not calling the right service, it was input_number.set_value

btw number can’t be a float value in HA ?

each time it’s set to a float value, something trigger a round and value change

1 Like

Number does support float values. However just like input_number they can have a defined precision or “step” attribute that you can not exceed. For example step: 0.5 gives 0.0, 0.5, 1.0, 1.5… as allowed values, step: 1 gives 0.0, 1.0, 2.0, 3.0… as allowed values.

thanks for the help