Hi,
I have a ZHA setup with a CC2351 coordinator and some Ikea Tradfri lights. When sending a command (e.g. turn off) to a light that is physical switched off (through the mains), the command obviously fails. But the device is not marked as unavailable/offline. The state in HA does not change and remains e.g. “on”
I would expect that the device would be marked as offline. The logging clearly shows that the command failed after 5 attempts with the status “MAC_NO_ACK”
2021-01-12 18:05:01 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.DataConfirm.Callback(Status=<Status.MAC_NO_ACK: 233>, Endpoint=1, TSN=125)
2021-01-12 18:05:01 DEBUG (MainThread) [zigpy_znp.api] AF.DataConfirm.Callback(Status=<Status.MAC_NO_ACK: 233>, Endpoint=1, TSN=125) matches OneShotResponseListener(matching_commands=(AF.DataConfirm.Callback(Status=None, Endpoint=None, TSN=125),), future=<Future finished result=AF.DataConfir...nt=1, TSN=125)>)
2021-01-12 18:05:01 DEBUG (MainThread) [zigpy_znp.api] Removing listener OneShotResponseListener(matching_commands=(AF.DataConfirm.Callback(Status=None, Endpoint=None, TSN=125),), future=<Future finished result=AF.DataConfir...nt=1, TSN=125)>)
2021-01-12 18:05:01 DEBUG (MainThread) [zigpy_znp.api] Cleaning up empty listener list for header CommandHeader(id=0x80, subsystem=Subsystem.AF, type=CommandType.AREQ)
2021-01-12 18:05:01 DEBUG (MainThread) [zigpy_znp.api] There are 5 callbacks and 0 one-shot listeners remaining
2021-01-12 18:05:01 DEBUG (MainThread) [zigpy_znp.api] Removing listener OneShotResponseListener(matching_commands=(AF.DataConfirm.Callback(Status=None, Endpoint=None, TSN=125),), future=<Future finished result=AF.DataConfir...nt=1, TSN=125)>)
2021-01-12 18:05:01 DEBUG (MainThread) [zigpy_znp.api] Cleaning up empty listener list for header CommandHeader(id=0x80, subsystem=Subsystem.AF, type=CommandType.AREQ)
2021-01-12 18:05:01 DEBUG (MainThread) [zigpy_znp.api] There are 5 callbacks and 0 one-shot listeners remaining
2021-01-12 18:05:01 DEBUG (MainThread) [zigpy_znp.zigbee.application] Request failed (Unsuccessful request status code: <Status.MAC_NO_ACK: 233>), retry attempt 5 of 5
2021-01-12 18:05:01 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x9D1D:1:0x0008]: command failed: 'move_to_level_with_on_off' args: '(184, 600.0)' kwargs '{}' exception: 'Request failed after 5 attempts: <Status.MAC_NO_ACK: 233>'
2021-01-12 18:05:01 DEBUG (MainThread) [homeassistant.components.zha.entity] light.light_desk: turned on: {'move_to_level_with_on_off': DeliveryError('Request failed after 5 attempts: <Status.MAC_NO_ACK: 233>')}
However, the device is marked as offline/unavailable after approximately 2 hours, probably as a result of ZHA device polling:
2021-01-12 20:08:44 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event zha_event[L]: device_ieee=00:0d:6f:ff:fe:fa:40:80, unique_id=00:0d:6f:ff:fe:fa:40:80, device_id=dc81d2740c71aa2d785d26035571d6ac, device_event_type=device_offline>
2021-01-12 20:08:44 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=light.light_desk, old_state=<state light.light_desk=on; brightness=254, off_brightness=None, friendly_name=light desk, supported_features=41 @ 2021-01-12T18:04:53.335591+01:00>, new_state=<state light.light_desk=unavailable; friendly_name=light desk, supported_features=41 @ 2021-01-12T20:08:44.129505+01:00>>
I have been unable to figure out whether this is an issue with:
- Ikea Tradfri
- the CC2531 stick
- ZHA, or
- zigpy
Does anyone have an idea?
Seeing the logs, it seems that ZHA processes the zigpy result, but takes no further action.