I have an issue that driving me crazy. I have automations that are configured to do something if a trigger happened a few mins ago, but some are working and some are not working. For example, the following automation is configured to send a message if a motion sensor stops detecting motion for 5 mins.
After 5 mins, or more, of the motion sensor reporting that there is no motion, the automation isn’t triggered. Checking the automation section shows that it didn’t trigger. If I change the time from 5 mins to 3 mins, then it works just fine. I have replicated this issue with multiple different automations.
I’m running core-2021.12.2, supervisor-2021.12.2.
Of note is that I have a fairly large HA deployment, probably around 200 zigbee devices split up between two conbee II devices. Plus other devices such as my unifi protect cameras (around 10) and alexa echos (around 12). Everything works great except the timed automations issues I’ve described here. I also have around 40 automations configured.
trigger:
- platform: state
to: 'off'
entity_id: binary_sensor.motion_test
for:
minutes: 5
If that works then there is something wrong with the device trigger and you should report it here:
I’d also advice you to avoid device automations as much as possible and use state / numeric state triggers and conditions and use service calls instead of device actions.
It is a lot easier to change a new entity id to match an old one if you replace a device. It can be done in one location, Configuration / Entities. Changing device ids is more complicated and must be done everywhere you have used it.
You should be aware (I was not until the last few weeks). That if you are editing other automations while you are waiting, that every time you edit and save ANY automation, Home Assistant reloads ALL automations, not just the one that has changed - and ALL automations are reset, in this case your automation will only trigger AFTER a reload, when the sensor has started detected motion again and then gone back no motion for 5 minutes.
So I did this, and it worked, but only for motion sensors that are directly connected with the coordinator. The other motion sensors, that are exhibiting the automation problem, are connected through IKEA Tradfri plugs. Could this possible be the problem?
All the Tradfri plugs are connected to the coordinator without a problem, and I can control them without a problem. Also, the motion states are being reported accurately in HA, but HA just doesn’t act upon them.
I was able to find a workaround for this problem and I thought I’d update this thread if anyone else runs into the same problem.
I ended up putting each motion sensor into it’s own group.
After doing that, I reference the group as a trigger in the automation and I’m able to give it a timer of 5, 10, 15, 20, 30, or more minutes. The automation fires every time.