Copy slider value to sensor value


I’m busy for more than 2 hours to copy a value from a slider to a sensor.

I create an automation but, this automation is triggered by change in value of the slider. So that’s fine I think?

But how to push the value of the slider into the sensor?
This is what i tried already.

- id: '1718523494835'
  alias: ESS Setpoint
  description: ''
  - platform: state
    - input_number.ess_setpoint_slider
  condition: []
  - service: sensor.set_value
      value: '{{ sensor.ess_loop_set_point }}'
  mode: single

Why not just use the input_number as your sensor?

You can generally not set a number for a sensor.
A sensor is updated through its integration.

The integration might have service calls to set the value.

The sensor, is an modbus address for my ESS system. So i want to change that value.

     - name: "ESS Loop Set Point"
        unit_of_measurement: "w"
        scale: 1
        precision: 2
        data_type: 'int16'
        slave: 100
        address: 2700

Sensors are generally read only, so you will have to find another way around it.

Either define sensors for each of the values you want to read or if you can read the modbus value with a service call, then you can make a script that extract the data you want and store it in a helper of some kind.

An alternative might be to use a thirdparty app to read the value and then pipe it into HA.
I think Node Red have a modbus palette, but I do not know how it works.

1 Like

Many thanks!
I did it with node-red and it works as expected.