Action data trouble

Hi,
I have an automation trouble. It’s literally the second one I’m trying to create and can’t make it work:

  - platform: modbus
    scan_interval: 0.5
    registers:
    - name: light
      hub: wago
      slave: 1
      register: 12310
      register_type: holding
      count: 1
      scale: 1
      offset: 0
      precision: 0
      data_type: int

input_number:
  target_temp:
    name: Target Heater Temperature Slider
    min: 0
    max: 3
    step: 1
    unit_of_measurement: bulbs
    icon: mdi:target

  - alias: Read from modbus to slider
    trigger:
      platform: state
      entity_id: sensor.light
    action:
      service: input_number.set_value
      data:
        entity_id: input_number.target_temp
        value: input_number.target_temp | int

It triggers every time I change value on modbus side (I can see that in logs) but it has no impact on slider so I’m guessing data section is wrong. What should it be to be correct? I want to pass value I read from register 12310 to set my slider at.

Try this:

    action:
      service: input_number.set_value
      data:
        entity_id: input_number.target_temp
        value: "{{ states('sensor.light') }}"

Your scan interval for the modbus light sensor is going to be spamming your network twice a second with that 0.5 value.

1 Like

That’s exactly what I was looking for.

You are right. In this particular case it’s not necessary but I have a few more sensors later on that I would like to be updated that frequently. And it’s RTU so has no impact on ethernet. Would be nice if I could set scan_interval per register though.