Scene status change that triggers a notification?

I have a scene that includes a designated “Dog is Out” button from each of 3 different (Insteon) 8-button Keypadlincs each of which are located near doors to our backyard. The scene lights up/turns off each of the corresponding buttons on the other 2 keypads when selected - but I would also like it to trigger an SMTP (email) notification each time the scene gets turned on (Dog is out) and back off (Dog came back in).
I already have the working smtp/mail notification method. I just have no idea how to trigger it based on the “scene” turning on/off?
New HA user working on migrating from UDI/ISY.

My suggestion would be to use a script instead of a scene. You can set all your lights etc… exactly the same as with a scene just by using service calls, then send the email notification. I have replaced all my scenes with scripts as they are far more versatile, you can use delays, repeats, and services that don’t actually set states, etc…

If that does not appeal to you, a scene’s state is the date it was last called (not “on” or “off”). So you could trigger an automation on any valid change of the scene state like this:

  - platform: state
    entity_id: scene.dog_is_out
      - unknown
      - unavailable
  - service: notify.smtp
    data: etc...

Thank you. Since I REALLY want to include the state (i.e. Dog is IN or Dog is OUT) in the notifications taking your advice and using a script that triggers of any of the 3 buttons (entities) instead.

2 followups since I’ve never done a script in HA before… Is the below YAML correct for triggering if ANY ONE of the 3 buttons is pressed?
And second - how do I turn a button in a 8-button keypad on? They’re “entities” in HA and there’s no action in the UI to change state on an entity?


  • platform: state
    entity_id: switch.mb_8_button_keypad_button_f
    from: “off”
    to: “on”
  • platform: state
    entity_id: switch.8_button_keypad_kitchen_button_e
    from: “off”
    to: “on”
  • platform: state
    entity_id: switch.basement_door_8_button_keypad_button_d
    from: “off”
    to: “on”

But yes that will wait until any of the buttons have been pressed. Which you really should not be doing if this is going to be a long time (> 10 minutes or so). Sounds like what you actually need is an automation that triggers on button presses.

And you don’t turn buttons on, you press them. See:

Thanks again. I’ll look into automations then.
FYI Insteon keypad buttons DO have state though - but not sure how HA handles them. When you press a keypad button it lights up and stays on until it is pressed again (which will turn it off). These are hardwired keypads with 6 or 8 buttons. In the Insteon world IIRC you do get a “button turned on” and “button turned off” signal.