How to set value by calculation and sensor value

hi,
so I have the nordpool and nordpool diff components. Now I want to adjust the thermostat temperature with the number nordpool diff gives me. In an automation, I have to set a value. I want it to be something like 20 (or set temperature) +/- (whatever the sensor.nordpool diff says divided by 10). I don’t know the syntax. The visual editor lets me put in only numbers, and now I am looking for how to write yaml. This what I have:

device_id: f611a70ba345
domain: number
entity_id: number.thermostat_hc1_manual_temperature
type: set_value
value: 20 + (sensor.nordpool_diff_rectangle_4)

With this a get “message malformed expected float for dictionary value @ data value”
How do I get a valid value through a calculation? (if possible)

You can’t do that with a Device Action. Use a Service Call. number.set_value

  - service: number.set_value
    target:
      entity_id: number.thermostat_hc1_manual_temperature
    data:
      value: "{{ states('sensor.nordpool_diff_rectangle_4') | float(0) + 20 }}"
2 Likes