question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Alerts with "skip_first: True" should not have their entity states go from 'idle' to 'on' until they actually fire for the first time

See original GitHub issue

The problem

The Alert integration creates entities that have “idle” or “on” states. The “skip_first” attribute for these entities is often used to alert the user after a certain time period (most common being e.g. a door left open for more than 5 minutes). However, the state of this entity turns “on” immediately when the tracked entity switches to the required state instead of when the Alert actually fires. This not only spams the Logbook for those preferring to track the Alert states every time a door is opened (even if the door was open less than skip_first requires to actually activate the Alert), but because of the simplicity of the Alert integration, simply repeats in the database, logbook, and history the state of the tracked entity instead of providing anything useful (which would be seeing when the Alerts were actually activated).

So all in all, I believe the more correct behavior for Alerts is that the Alert entities should only turn “on” when the Alert first fires when skip_first is specified.

The documentation seems to imply this should already be the case (not sure what it means by “add an entity to the front end” because you can add the entity to a view as soon as you create the configuration for it), but it is not:

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.

Environment

  • Home Assistant Core release with the issue: 0.112.3
  • Last working Home Assistant Core release (if known): N/A
  • Operating environment (OS/Container/Supervised/Core): Container
  • Integration causing this issue: Alert
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/alert/

Problem-relevant configuration.yaml

alert:
  front_door_left_open:
    name: Front Door left open
    entity_id: binary_sensor.front_door
    state: 'on'
    repeat:
    - 3
    - 15
    - 30
    - 60
    - 120
    skip_first: true
    can_acknowledge: true
    message: "Warning: Front Door has been left open for {{ relative_time(states.binary_sensor.front_door.last_changed) }}."
    notifiers:
    - slack

Traceback/Error logs


Additional information

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
larsxschneidercommented, Feb 7, 2022

FYI: I did run into the same problem and opened a PR to fix it: https://github.com/home-assistant/core/pull/65948

0reactions
larsxschneidercommented, Jul 16, 2022

@melyux if we find someone to review it, then I am happy to update my PR. The code runs flawlessly in my fork of Home Assistant for months now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Alert component does not trigger if problem state is at start
For example, I am trying to use Alert for Meteo alarm binary sensor which can be in state on for a couple of...
Read more >
Alert - Home Assistant
This entity allows you to silence an alert until it is resolved and has ... was set to true , the first notification...
Read more >
Obtain A Driver's License - Bureau of Motor Vehicles
Safe driving is a life-long commitment and one that you must reaffirm every time you get behind the wheel. As you take your...
Read more >
how to skip first few rows from data file in pyspark - YouTube
Pyspark Scenarios 3 : how to skip first few rows from data file in ... Your browser can 't play this video. Learn...
Read more >
The Thing About Jetpacks - Medium
It's funny how you can meet somebody for the first time, but feel like you know ... Skip First, Aim for Best ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found