Alert - How to use

I feel like I’m a little confused about how to use the new Alert component. I understand what it does, and really like it for problematic issues, like the example of a low battery reminder. I even went as far as implementing a few alerts already.

After creating a low battery alert and restarting, i get a new alert entity, which makes sense. But where would that be displayed, when it does trigger?
Here’s what the new component looks like:
> alert.motionlow_batt idle hidden: true
> friendly_name: Motion Sensor battery low

So would I include “alert.motionlow_batt” somewhere in my groups or views?

I understand it’s not going to display anything right now, because it’s idle, and in a hidden state. But when it’s active, and hidden: false, where will it pop up in the UI? Especially if it’s not defined in my groups or views?

Anyways, a little clarification would be nice. Thanks!

Unfortunately you didn’t mark your component block as code, so the formatting was lost. It does look however like it may be missing the entity that’s being monitored, and the notifier to use. See this thread for another discussion.

You’ll then need to add it to a group that’s displayed, so that when triggered it’s visible. If you use a customised default view, and don’t add it to any group or view, it’ll never be visible.

Also missing the notifier, which is where you will get your alerts. Nothing will display in the UI; all alerts are sent to whatever notification platform you specify in the alert setup.

I think I accidently confused you guys, my initial post didn’t list the actual alert code from the yaml file. But instead listed the resulting alert component (entity ID) from the UI.

Here’s the actual alert code from my yaml file:

  motion_lowbatt:
    name: Motion Sensor battery low
    entity_id: switch.motionlow_bat
    state: 'on'
    repeat: 60
    can_acknowledge: True
    skip_first: False
    notifiers:
      - pushover

After adding this, I restarted HA and went into Dev Tools / States and found my new alert in the table:

alert.motion_lowbatt	      idle	              hidden: true
                                                  friendly_name: Motion Sensor battery low

My question is. Do I need to include “alert.motion_lowbatt” in a group/view in my groups.yaml file, so it gets displayed in my UI? How is this particular alert acknowledge-able?

I created another test alert from the same alert code above, but for the entity_id of a door (something I could control). When I opened the door, I got an alert via pushover, as expected, but I didn’t see anything in the UI related to it.

The documentation on the component page specifically states: Alerts will add an entity to the front end only when they are firing. This entity allows you to silence an alert until it is resolved.

Should I of seen anything in the UI? How can I acknowledge the alert? If they do pop up in the UI, is there a way to specify where they will pop up?

Hopefully this helps clarify the question a bit.

Yes, if you want to be able to acknowledge and disable it. Basically they’ll be hidden by default, as it shows in the bit you posted (well, they will be probably once 0.38.4 comes out, since there’s a bug that means they’re not hidden currently).

Once you do that, you’ll see them in the relevant view. Just keep in mind that once you customise the default view, nothing is displayed unless you’ve explicitly added it to a visible group.

Thanks @Tinkerer that’s what I was wondering. I’m aware that once i customize the default view nothing is displayed unless I explicitly add it.

So I’ve added “alert.motion_lowbatt” to a new group called “alerts”, then put that group into a view called “security”.

Currently if I open up the UI, and look at the “security” view, I see the group labeled “Alerts”, with the entry “Motion Sensor battery low” in a state of “on”. But if I go to Dev tools / States the entity “alert.motion_lowbatt” is in the state of “idle”, not “on”. I’d think if it was idle, the state would be off, not on… Is this the bug you were talking about?

Thanks, and sorry for all the “”"…

Yeah, that’s the bug. A change was submitted today that should fix it, and related issues.

2 Likes

Great, Thank you @Tinkerer

I’ve set up the alert component. While i get the first notification I can never get it to repeat. Anyone else experiencing this issue?

alert:
  light_still_on:
    name: light
    entity_id: light.his_lamp
    state: 'on'
    repeat: 5
    can_acknowledge: True
    skip_first: False
    notifiers:
      - pushover
      - iphone_7_plus

Possibly related to bug, see post by @Tinkerer above.

On 0.38.3 I’m seeing it behave as configured, so if you’re not getting repeats it’s not because of that bug.

1 Like

@Maaniac what version are you running?

@xstrex i’m running .38.3. I’ve noticed that i’m getting the alert notification every 5 hours instead of every 5 minutes.

I’d bring this up to @Tinkerer sounds like it could be another bug. The syntax looks right otherwise.

Sadly I’m not the feature dev, or any other kind of dev, so I can’t help with bugs. I’ve just got lots of experience of narrowing down the causes of problems :wink:

I’d check the logs to see that it’s not firing in between. If it isn’t, I’d raise an issue with a summary of the problem, the version of HA you’ve installed (and how), your alert configuration and the relevant lines from the log.

If it is firing between, then it sounds like a notifier issue.