Simple Sensor Alert Notification

Hi,

I am trying to get an Open/Close sensor to notify all devices when a gate has been opened. I tried both “open” and “on” for the state but I am not receiving any notifications.

Thanks in advance.

alert:
  gate_open:
    name: Gate Open
    title: ALERT Gate
    message: The Gate has been opened.
    entity_id: binary_sensor.open_close_sensor_gate
    state: on
    repeat: 1
    notifiers:
    - notify.notify

What state is binary_sensor.open_close_sensor_gate showing in Developer Tools?

And you’re missing the quotation marks around on.

state: "on"

or

state: "open"

Hi Roger, thanks for getting back to me so quickly.

In Developer Tools, it shows as off when closed and on when open.

I changed the state: “on” restarted and still nothing. Weird.

You’re welcome.

Never used alert before but at least you indentation looks off as the desciption shows the notifier to spots indented.

alert:
  gate_open:
    name: Gate Open
    title: ALERT Gate
    message: The Gate has been opened.
    entity_id: binary_sensor.open_close_sensor_gate
    state: 'on'
    repeat: 1
    notifiers:
      - notify.notify

Is you alert shown properly as a new entity und entities?

Ok, I made the change, restarted and still nothing.

alert:
  gate_open:
    name: Gate Open
    title: ALERT Gate
    message: The Gate has been opened.
    entity_id: binary_sensor.open_close_sensor_gate
    state: "on"
    repeat: 1
    notifiers:
      - notify.notify

The alert is showing under entities.

When I click on the alert entity, I see the following:


Sorry, didn’t notice you changed “on” to ‘on’. Made that change as well, restarted and tried it again… nothing.

alert:
  gate_open:
    name: Gate Open
    title: ALERT Gate
    message: The Gate has been opened.
    entity_id: binary_sensor.open_close_sensor_gate
    state: 'on'
    repeat: 1
    notifiers:
      - notify.notify

It gave me no rest and I tinkered around with it by myself.

First off all you can click on image
to see what state your alert entity has (idle, on, off) as stated in the description for alert.

Then I remembered SlackerLabs very good video for alerts: Easy home Assistant Notifications using Alerts! - YouTube

Give this one a try:

alter:
  gate_open:
    name: Gate Open
    title: ALERT Gate
    message: The Gate has been opened.
    entity_id: binary_sensor.open_close_sensor_gate
    state: "on"
    repeat: 1
    notifiers:
      - mobile_app_RCOOKANTHOMs_PHONE #<-- see hint below

Hint: Jeff tells a pretty important notice in his video for the notifier. That is to leave out the ‘notify.’ in that line. So I tried mine where the real name of the service is

notify.mobile_app_pixel_6_pro

and put in the notifiers line a simple

mobile_app_pixel_6_pro

So you probably have to set your mobile app notify service or a notfiy group in there too as ‘notify.notify’ is just a something like placeholder.

The code above is working just fine with my office window sensor and is spamming my phone every minute with an alter while typing this. :wink:

Best of luck!

Ok, thanks again for your assistance. I will check out the video and give that a try later and let you know.

Have a great weekend!

1 Like