Issue with actionable notifications and wait for trigger?

This code used to work:

- id: '1679873069852'
  alias: Notification - Water Leak - Kitchen sink
  description: ''
  triggers:
  - type: moist
    device_id: ffc7d99ac2bbbc8ebcc955d5e1b86618
    entity_id: 5c18c7a0fe5dd3a79e95dd394f8d298f
    domain: binary_sensor
    trigger: device
  conditions: []
  actions:
  - action: switch.turn_on
    target:
      entity_id: switch.titan_water_valve_actuator
    data: {}
  - action: notify.mobile_app_jeffs_s25
    data:
      message: TTS
      data:
        tts_text: Water leak at home
        media_stream: alarm_stream_max
        ttl: 0
        priority: high
  - action: notify.mobile_app_aprils_pixel_9
    data:
      message: TTS
      data:
        tts_text: Water leak at home
        media_stream: alarm_stream_max
        ttl: 0
        priority: high
  - action: notify.mobile_app_jeffs_s25
    data:
      message: Water detected under the kitchen sink
      title: WATER!!!
      data:
        sticky: 'true'
        notification_icon: mdi:water
        color: red
        actions:
        - action: TURN_WATER_ON
          title: Turn water on
  - action: notify.mobile_app_aprils_pixel_9
    data:
      message: Water detected under the kitchen sink
      title: WATER!!!
      data:
        sticky: 'true'
        notification_icon: mdi:water
        color: red
        actions:
        - action: TURN_WATER_ON
          title: Turn water on
  - action: tts.google_say
    data:
      cache: false
      entity_id: media_player.ha_tts_group
      message: ALERT!  There is a water leak under the kitchen sink!
  - wait_for_trigger:
    - trigger: event
      event_type: mobile_app_notification_action
      event_data:
        action: TURN_WATER_ON
    timeout:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
    continue_on_timeout: false
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - action: switch.turn_off
    target:
      entity_id: switch.titan_water_valve_actuator
    data: {}
  mode: single

I’m migrating my Zigbee devices from one coordinator to another, and from ZHA to Z2M. As such, I was getting the leak sensors wet so they would report their various states.

Sure enough, this triggered the mobile alerts and the TTS announcement, but then… The water wasn’t turned off. I figured something was wrong with the valve since I recently migrated my z-wave coordinator to a PoE one as well. Made a mental not to check later.

Well, I checked. The trace timeline shows that the automation started at 16:10:04. It stopped and waited the requisite 5 minutes, and when no one pressed the notification, it aborted after a total runtime of 301.71 seconds. Seems right.

However - the history on the Titan shows otherwise, and instead shows that it was triggered to turn on at 16:10:05, and then at 16:10:06 it was triggered to turn off again, both triggered by the automation:

Titan Water Valve Actuator turned off triggered by automation Notification - Water Leak - Kitchen sink triggered by state of Kitchen Sink Leak Moisture
16:10:06 - 2 hours ago
Titan Water Valve Actuator turned on triggered by automation Notification - Water Leak - Kitchen sink triggered by state of Kitchen Sink Leak Moisture
16:10:05 - 2 hours ago

I’m at a loss here. Was there a breaking change I missed somewhere? :frowning:

Im guessing that’s probably your issue right there. device_id: ffc7d99ac2bbbc8ebcc955d5e1b86618

If you just switched coordinators and integrations, then there’s a HIGHLY likely chance your device_id has changed. If you have the automation saved via GUI, remove the device, then reselect it. That should refresh/populate the correct device_id. If your automation is purely yaml, you’ll need to check Developer Tools > States for the device_id. You might not even need to include the device_id.

@exx

(And already the second time I’m posting this today.)

All the examples in the actionable notification docs show action and title values surrounded in quotes.

Try changing this:

       actions:
       - action: TURN_WATER_ON
         title: Turn water on

to this:

        actions:
        - action: "TURN_WATER_ON"
          title: "Turn water on"

Remember to do the same in the event_data action under your wait_for_trigger.

I did do that already, that’s how the device-I’d got in there. I would never bother to look that nonsense up to manually put that in my yaml. Lol

That aside though, in the interest of learning - that’s on the trigger. How would that have caused the issue I’m describing where the action claims the automation triggered it? If the device I’d was wrong the automation would never be triggered, wouldn’t it?

I’ll give that a try, thanks!

Need to do some more work on the zigbee network first. Now that it’s had a chance to “bake” for a few days, I’m finding that some of my devices are reporting. Maybe need to add another router or two to increase signal levels. I have 8 or 10 battery powered devices that were last seen 1 day ago, when I know their states have changed (contact sensors).

It never ends. Lol