core: Alert component does not trigger if problem state is at start

Home Assistant release with the issue:

All (?)

Last working Home Assistant release (if known): never (?)

Operating environment (Hass.io/Docker/Windows/etc.):

HASS.io Integration:

https://www.home-assistant.io/integrations/alert/

Description of problem: It looks like the alert component will not be triggered by a problem state for an entity if the entity is in this problem state at the start of homeassistant (HASSIO in my case).

For example, I am trying to use Alert for Meteo alarm binary sensor which can be in state on for a couple of days due to weather conditions. The Alert will be triggered only if the binary_sensor.meteoalarm changed state from off to on when the system is running, but it will not be triggered again if I restart homeassistant while the binary_sensor.meteoalarm is in the state on from the beginning.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):


Traceback (if applicable):


Additional information:

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 8
  • Comments: 17 (3 by maintainers)

Most upvoted comments

@mdegat01

I think I may have finally figured out why I didn’t see this issue with my config and it might be an alternate solution for you.

I have a condition built into all of my alert binary sensors that is a binary sensor (binary_sensor.alerts_enabled) that turns on after a restart once my zwave network is ready, and all sensors have registered their states etc. etc. This means all of my binary sensors are in an off state at startup and once that sensor turns on the alert binary sensors that resolve to true turn on. Hence why my alerts have always fired on startup for me (actually slightly after startup). It works so well I never realized there was an issue.

Another added benefit to this is that sensor is based on an boolean that I can turn off to disable all alerts for testing and whatnot.

binary_sensor:
  - platorm: template
    sensors:
      outdoor_low_temperature_alert:
        unique_id: outdoor_low_temperature_alert
        value_template: >
          {{ states('sensor.dark_sky_apparent_temperature')|int < states('input_number.outdoor_low_temperature_threshold')|int
              and is_state('binary_sensor.alerts_enabled','on') }}
        availability_template: >
          {{ is_state('binary_sensor.dark_sky_connected','on')
              and not states('sensor.dark_sky_apparent_temperature')|lower in ['unknown','unavailable','none'] }}