To reproduce the issue: shut down HAOS. Put water on the esphome based water alarm. Boot up HAOS. You will see the sensor transition from dry to unknown to wet while the HA is starting up. But the automation that is supposed to trigger on wet for 1 second duration never fires.
As a result my basement will flood after a power failure and when power returns HA doesn't alert me even though it sees the sensor is wet. How can I insure that I always get an alert for water alarm? The current configuration isn't working reliably for me. Is this due to automations feature is started up after the esphome API starts getting all the devices status? It seems like the state change is being missed entirely.
#Automation not run during HA bootup.
1 messages · Page 1 of 1 (latest)
can you post the automation yaml?
is it set to trigger on dry-> wet instead of *->wet?
alias: "Water alarm! "
description: ""
triggers:
- type: moist
device_id: 7805eea8c762ea2e880e94f18e486b34
entity_id: binary_sensor.waterbug_water_alarm
domain: binary_sensor
for:
hours: 0
minutes: 0
seconds: 1
trigger: device
conditions: []
actions:
- action: notify.mobile_app_pixel_9
data:
message: Water alarm! Ha
- action: notify.pushover
data:
message: Water alarm! (Pushover)
data:
priority: 2
sound: pianobar
expire: 300
retry: 30
- repeat:
count: "21"
sequence:
- action: scene.turn_on
metadata: {}
target:
entity_id: scene.emergency_exit_lights_off
data: {}
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- action: scene.turn_on
metadata: {}
target:
entity_id: scene.emergency_exit_lights_on
data: {}
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
mode: single
The trigger only needs to see wet. The prior state doesn't matter.
To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.
that trigger has no to section
you havent told it what to trigger on (in this case wet)
That's a device trigger.
Doesn't have a to
I guess that's what type: moist is doing.
Correct, a device trigger is a different format
have you tried entity instead?
Changing to entity trigger, stand by.
Same behavior with entity trigger. No alert on bootup. But if I clear and retrigger the sensor, meaning remove water and reapply water I get a normal trigger when HA is running normally.
as a work around you could have an automation that triggers on HA startup, waits a few seconds then checks the state
something like this kind of layout
you could implement it into your current automtion too as an additional trigger
maybe just adding the trigger on start and adding a condition of entity=wet would work
if the state is settled by then
and the condition shouldnt effect the other trigger either
Thank you! It's working now. I used your last suggestion: additional trigger for startup in the existing automation and a new condition for wet.
This seems like a bug to me. The HA bootup should start automations before the esphome API starts changing entity values. I think the current bootup is in the wrong order. Because state changes that should trigger automations are getting missed.
it probably comes up and is "wet" before the automation engine starts watching
make sure to test it in normal failure mode too, not just the startup fail
should all work anyway
I have the SAME issue for postal mail delivery. HA is down for repairs, postal mail is delivered. HA is booted up and I don't get notification that "you have mail". This actually happened to me today which is why I was testing the water alarm to see if it also had the issue.
ah gotcha, how is the post sensor done? just door sensor on the box?
Yes, just a door sensor. Nothing fancy.
so theres no continous state once its closed again which is a pain as theres nothing to check
Yes, I'm aware that the specific use case is not quite the same. But I was just noticing that they have similar limitations.
yeah gotcha, i was trying to think of possible solutions