Input number component help, please

I have a ZWave dimmer switch (Innovelli NZW31).
In Node-Red, I can send this data to the “Call Service Node” and set the light brightness. (25% in this example).

{ "entity_id": "light.living_room","brightness_pct": 25 }

But I can’t figure out how to send the slider value to the light.
Tips would be appreciated.

In configuration.yaml:

input_number:
  livng_room_brightness:
    name: Brightness
    initial: 255
    min: 0
    max: 255
    step: 1
    mode: slider

In automations.yaml:

- alias: Living Room Light - Adjust Brightness
    hide_entity: True
    trigger:
      platform: state
      entity_id: input_number.livng_room_brightness
    action:
      - service: light.turn_on    

Sig

Something like the following should work…

- service: light.turn_on
  data_template:
    entity_id: light.living_room
    brightness_pct:  '{{ states.input_number.livng_room_brightness.state | int }}'

Many thanks. I suspected that the solution would be in a template, but none of my experiments worked. I am trying to learn more about Home Assistant, stumbling along as I go. Your tip is a grok moment for me. It’s a micro-grok, but to this newbie, it was like turning on the light.

The slider almost works as expected. Good enough for my purposes, but I want to learn more. Is there a mechanism for getting the dimmer switch status to effect the slider? If I manually change the brightness at the switch, is there a way to make the slider show the dimming level? (There is a Poll State node in Node-Red that I can feed back into the Slider Widget).

Sig

You can create an automation to do that using pretty much the same way…

Similar to this…

 - alias: Outside Min Temp
   initial_state: 'on'
   trigger:
     - platform: state
       entity_id: sensor.greenmintemp
   action:
     - service: input_number.set_value
       data_template:
         entity_id: input_number.out_min_temp
         value: "{{ states.sensor.greenmintemp.state|float|round(2) }}"

You would use your zwave switch brightness attribute but the same principle applies :slight_smile:

Thanks.
I think I am on the right track here, but this automations.yaml makes my slider disappear, so I don’t know if the action: is correct when the state of the light changes.

From my reading of the docs, the trigger: should happen with any change of the light, including any dim levels.

Your thoughts?

  - alias: Living Room Light - Adjust Brightness
    hide_entity: True
    trigger:
      platform: state
      entity_id: input_number.livng_room_brightness
    action:
      - service: light.turn_on  
        data_template:
          entity_id: light.living_room
          brightness_pct:  '{{ states.input_number.livng_room_brightness.state | int }}' 
#
  - alias: LR Light Level Changed
    trigger:
      platform: state
      entity_id: light.living_room                
    action:
      - service: input_number.set_value
        data_template:
          entity_id: input_number.livng_room_brightness
          value: "{{ states.input_number.livng_room_brightness.state | int }}"

Sig

I have no clue why the slider would disappear, however I have no clue what hide_entity: True does, tho’ it sounds like it might cause the issue. The state triggers should trigger when the state changes so they should work fine, tho’ I’m having problems with input_booleans which don’t seem to follow this rule :stuck_out_tongue: