Shelly Flood Notification on Water Detection

Hello,

I’m trying to set up a notification to go out when any of our Shelly Flood sensors detect water.
This is my first Automation with templating and I’m completely lost on figuring out on how to access data within the template.

First off I think my notification group isn’t working.
I think the service should be notify.mobile_app etc but I get this invalid slug error in my Check Configuration: invalid slug notify.mobile_app_michaels_iphone (try notify_mobile_app_michaels_iphone) for dictionary value @ data[‘services’][0][‘service’]. Got ‘notify.mobile_app_michaels_iphone’.

within the automation I have tried several template code in addition to below without avail.

{{trigger.to_state.attributes.friendly_name}}

Here is my relevant code snipits:

configuration.yaml
notify: !include notify.yaml

notify.yaml

- platform: group
  name: family_devices
  services:
    - service: notify_mobile_app_bianca_s_iphone
    - service: notify_mobile_app_michaels_iphone

automation

alias: Flood Sensor is wet
description: ''
trigger:
  - platform: state
    entity_id:
      - binary_sensor.laundry_flood_flood
      - binary_sensor.kitchen_flood_flood
    to: moist
condition: []
action:
  - service: notify.family_devices
    data:
      message: Water Detected!
      title: '{{ state_attr("trigger.entity_id", "friendly_name") }} is wet!'
mode: single
  - service: notify.family_devices
    data:
      message: Water Detected!
      title: "{{ trigger.to_state.name }} is wet!"

Also check the actual state of the binary_sensor in Developer Tools. You need to use the one from Developer Tools, not the translated one in the frontend.

When moisture is detected, the state should be on.

1 Like

Oh yeah. I missed that it will definitely be:

trigger:
  - platform: state
    entity_id:
      - binary_sensor.laundry_flood_flood
      - binary_sensor.kitchen_flood_flood
    to: 'on'

Thanks for the responses. Do you know if I set up my notification group correctly ?
Should it be notify_mobile … or notify.mobile … ?

I saw online it should be notify. but the configuration checker says it should be notify_

Any Idea @tom_l ?

alias: Flood Sensor is wet
description: ''
trigger:
  - platform: state
    entity_id:
      - binary_sensor.laundry_flood_flood
      - binary_sensor.kitchen_sink_flood_flood
      - binary_sensor.downstairs_bathroom_flood_flood
      - binary_sensor.upstairs_bathroom_flood_flood
    to: 'on'
condition: []
action:
  - service: notify.mobile_app_michaels_iphone
    data:
      message: '{{ trigger.to_state.name }} is wet!'
      title: test
mode: single

I’m guessing you triggered the automation manually, and not by getting one of the sensors wet.

If you trigger it manually there will be no trigger.to_state.

To test the automation, you can go to Developer Tools → States (tab) → Type binary_sensor.laundry_flood_flood in entity → Type on in state → Set States.