I have created an automation that should trigger when the “Last Boot” entity from the ASUSWRT integration is Unavailable or Unknown for 5 minutes, but is does not.
Below is the automation:
alias: ASUS Integration Reload
description: ""
triggers:
- trigger: state
entity_id:
- sensor.192_168_1_1_last_boot
to:
- unavailable
- unknown
for:
hours: 0
minutes: 5
seconds: 0
conditions: []
actions:
- action: homeassistant.reload_config_entry
data: {}
target:
device_id: 35b7a8532028ebfa9cad26453f0e3d20
mode: single
The Last Boot sensor had a status of Unavailable for greater than 5 minutes earlier today, but the automation did not trigger, why?
Can you share the logbook for that time period, there’s nothing wrong with your yaml so it should trigger. Only explanation would be that the state is not unavailable.
Found this is the logs, but still unsure why the Unavailable state was recorded in the History and not the Logbook. How do I catch this situation and use it to trigger my automation?
2026-07-31 09:46:30.240 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 192.168.1.1 for asuswrt
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 798, in __async_setup_with_context
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/asuswrt/__init__.py", line 18, in async_setup_entry
await router.setup()
File "/usr/src/homeassistant/homeassistant/components/asuswrt/router.py", line 270, in setup
await self.update_devices()
File "/usr/src/homeassistant/homeassistant/components/asuswrt/router.py", line 288, in update_devices
wrt_devices = await self._api.async_get_connected_devices()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/asuswrt/bridge.py", line 460, in async_get_connected_devices
for mac, dev in api_devices.items()
^^^^^^^^^^^^^^^^^
Well that would be why, the system restarted. The initial trigger was never registered to start waiting the 5 minutes.
FYI, I know the system restarted because of the log lines that you removed from your previous message. Those log lines mentioning custom integrations only appear at startup.
I restarted the system while the Last Boot entity was still available. After the restart the ASUSWRT integration failed to load and the Last Boot entity became unavailable until I manually restarted it.
I restarted the system at 9:45 am and the Last Boot entity became Unavailable at 9:46:43 am after the system restarted.
Right, so automations need a state change in order to trigger. During a restart, triggers can only be captured if the automation engine is running. The integration failed before the automation was running (and before recorder was able to record it).
That will only catch the case where your router is offline after a Home Assistant restart. If you also want to catch the issue when home assistant is running add your original trigger too.
triggers:
- trigger: homeassistant
event: start
- trigger: state
entity_id:
- sensor.192_168_1_1_last_boot
to:
- unavailable
- unknown
for:
hours: 0
minutes: 3 # (there is the 2 minute delay in your actions giving 5 minutes total).
seconds: 0