Ok, a bit further update:
Last error I have is:
Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:230
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: April 4, 2024 at 11:02:03 PM (25 occurrences)
Last logged: 3:18:24 PM
[140350610552128] Failed to send request: Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>
[140350610577472] Failed to send request: Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>
[140350627997248] Failed to send request: Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>
[140350602169792] Failed to send request: Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>
[140350628033216] Failed to send request: Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/__init__.py", line 64, in wrap_zigpy_exceptions
yield
File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/__init__.py", line 84, in wrapper
return await RETRYABLE_REQUEST_DECORATOR(func)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/zigpy/util.py", line 138, in retry
return await func()
^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/zigpy/zcl/__init__.py", line 377, in request
return await self._endpoint.request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/zigpy/endpoint.py", line 253, in request
return await self.device.request(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/zigpy/device.py", line 297, in request
await self._application.request(
File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 768, in request
await self.send_packet(
File "/usr/local/lib/python3.11/site-packages/bellows/zigbee/application.py", line 872, in send_packet
raise zigpy.exceptions.DeliveryError(
zigpy.exceptions.DeliveryError: Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 230, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 2035, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2072, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
return await service.entity_service_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 876, in entity_service_call
response_data = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/zha/switch.py", line 88, in async_turn_on
await self._on_off_cluster_handler.turn_on()
File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/general.py", line 388, in turn_on
result = await self.on()
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/__init__.py", line 83, in wrapper
with wrap_zigpy_exceptions():
File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/__init__.py", line 75, in wrap_zigpy_exceptions
raise HomeAssistantError(message) from exc
homeassistant.exceptions.HomeAssistantError: Failed to send request: Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>
These errors are appearing with some delay - looks like there is a retry mechanism running for a while before reporting an error. After these errors are reported, the automations’ event queue is cleared and physical switch triggering executes it’s own automation only and the socket changes the state only once (no more multiple socket on/off at that time).
So:
- web UI state changes fail to execute automations after retry mechanism fails to send message to zigbee device. Error is reported
- If toggling physical switch while retry mechanism has not reported errors - the messages are send out and retry mechanism succeeds (that’s why multiple on/off cycles on tasmota socket).
- Physical button toggling changes the state of tasmota socket always.
This leads to:
- Automation is written correctly.
- Zigbee network and interference not being a problem.
Open questions:
- Why does HA fails to send these state changes if request comes from web UI?
- Why does it even need to send a Zigbee message, as the Zigbee device is stateless here, and only tasmota switch needs to get a state change request over wifi connection.