Receive an alarm message on my Android phone

Hi

Im totally new in this so please bear with me.

I have a sensor in my pond that states 1 if water is running, 0 if not (vannRenner = water flows)

I would like to have a alarm to my android phone if state = 1.

image

My jaml (forget about the Kg):

# dam= pond
  
    - name: 'Dam'
      unique_id: vannRenner
      state_topic: 'dam/vannRenner'
      state_class: measurement 
      unit_of_measurement: 'Kg' 

HA: water is running
image

Is it possible to get some guidance to figure this out, to make HA send to my android phone, preferably with a bad sound going off?

Thanks up front!

For the automation you will want to use a State trigger.

The details for using a service call to get an Alarm stream notification can be found in the HA Companion App Docs - Critical Notifications.

1 Like

Thanks @Didgeridrew

The jaml I partly understand, but as a first day user this is a bit cryptic so I hope its ok to ask for a bit more…

Variable I receive from my Arduino to HA is a counter, it starts on 1, and for each time alarm is triggered it increases with one.
When water stops, HA receives a 0

What I don’t have pr now:

entity_id
device id → is that something like 5589b34c8686d3213?

How to I connect my jaml name “Dam”, unique_id: vannRenner and topic dam/vannRenner to the jaml code?

Pseudo code(?):
if vannRenner >0;
then sound an alarm on my phone (then I run :slight_smile: )

This is what I understand:

automations:
  - alias: "water is running"

    trigger:
      - platform: state
        entity_id: sensor.pond_alarm
        to: "water"

    action:
      - service: notify.mobile_app_<your_device_id_here>
        data:
          message: TTS
          data:
            ttl: 0
            priority: high
            media_stream: alarm_stream_max
            tts_text: "The pond is starting to get empty!!!"

Based on the supplied configuration, the MQTT-based sensor’s entity ID should be sensor.dam. If you changed it to something else, make sure to adjust the automation accordingly.

You want to trigger an automation when the value of that sensor rises above 0. For that you use a Numeric State trigger.

# Example automations.yaml entry
- id: 'notify_pond_water_running_0001'
  alias: Notify Pond Water Running
  description: Send mobile TTS when pond water starts running
  trigger:
    - platform: numeric_state
      entity_id: sensor.dam
      above: 0
  condition: []
  action:
    - service: notify.mobile_app_<your_device_id_here>
      data:
        message: TTS
        data:
          ttl: 0
          priority: high
          media_stream: alarm_stream_max
          tts_text: "The pond is starting to get empty!!!"

EDIT: Modified for use directly in automations.yaml file.

1 Like

Hi
Thanks @Didgeridrew !

I added this code, but get error saving, may be some white spaces, but I dont manage to sort it out, can I get another helping hand?


)

# Alarm to phone android
trigger:
    - platform: numeric_state
      entity_id: sensor.dam
      above: 0
      condition: []
action:
    - service: notify.mobile_app_8axxxxxxxxxxxa6
      data:
      message: TTS
xdata:
    ttl: 0
    priority: high
    media_stream: alarm_stream_max
    tts_text: "The pond is starting to get empty!!!"

As mentioned in the first sentence of the post, what I posted above is an automation. As such it needs to be added to the configuration wherever you have automations. This would normally be the automations.yaml file. I have updated the post above to use the configuration syntax needed for use in that file.

As a new user, unless you are already familiar with YAML, you would be better served setting it up in the Automation Editor. There are differences in the configuration syntax depending on the specific file you are adding it into.

If you need a primer on how to transcribe YAML automation configurations that you find here on the forums using the UI Automation Editor, there is a (slightly dated) tutorial available on the Resin Chem Tech Youtube channel.

Also, some of the indentation has been altered incorrectly and variable keys have been changed to invalid values (data changed to xdata).