Input_number as automation trigger

Hello,

I would like to send ir command to my av receiver when I change the chromecast volume slider from 0.

What is the right trigger command?

Thank you!

This will trigger for any change of the input_number.

  trigger:
    platform: state
    entity_id: input_number.your_vol_silder_name

If you only want it to trigger when moved from 0 this might work (untested) :

  trigger:
    platform: numeric
    entity_id: input_number.your_vol_silder_name
    from: 0

Otherwise you could try:

  trigger:
    platform: state
    entity_id: input_number.your_vol_silder_name
  condition: template
  value_template: "{{ trigger.from_state.state == 0 }}

That won’t work as numeric isn’t a valid trigger and the valid numeric_state trigger appears to not use the ‘from’ attribute.

the correct syntax would be:

  trigger:
    - platform: state
      entity_id: input_number.your_vol_silder_name
      from: 0
1 Like

Thank you for your reply.

I got it working with this one:

  - alias: 'Radio on'
    trigger:
      platform: numeric_state
      entity_id: input_number.volume_radio
      above: 0

and off command:

  - alias: 'Radi off'
    trigger:
      platform: numeric_state
      entity_id: input_number.volume_radio
      below: 0.1
1 Like

That also works, that’s the correct numeric_state trigger. Just keep in mind, that automation will fire every time the slider is above 0. So if you move from 1 to 44 it will fire.

Actually, it won’t. It will only fire when it changes from 0 or below to above 0. (And there’s a special case at startup - it will fire for the first state change if the new value is above 0, even if the previous value was not 0 or below.)

I actually spent some time digging pretty deep into this one because at first I incorrectly decided the docs were wrong and made some incorrect comments on this forum to that effect, although I did try to go back and correct those misstatements.

1 Like

Ah, good to know. I may have read that from one of your posts, or the docs. Not sure where. I use appdaemon for my automations so I’ve never used numeric_state before.