Mains routers can stay available while all directed APS requests fail

Open
#1,004 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python

Research direction

Start by reading the ZHA device availability and directed request handling paths, then determine whether outbound health belongs in ZHA or zigpy, as the issue leaves that design open. Compare tracking delivery failures and successful requests with the existing inbound last_seen signal; done means users can distinguish inbound-only traffic from confirmed bidirectional communication without changing availability after a single failure. No specific files or tests are named.

Written by the indexing model from the issue text.

Description

Summary

Mains-powered Zigbee routers can remain available in ZHA while every directed request to them fails at APS delivery. Periodic unsolicited reports keep last_seen fresh, so the current availability state does not reveal that the coordinator-to-device path is broken.

Shelly Gen4 firmware 2.0.x/2.1.x makes this reproducible, but the issue here is the generic ZHA health blind spot rather than a request to work around Shelly firmware.

Environment

  • Home Assistant Core 2026.11.0
  • ZHA 2.4.2, zigpy 2.4.1, bellows 1.2.1, zha-quirks 2.4.1
  • SONOFF ZBDongle-E, EmberZNet 6.10.3.0, channel 25, direct USB connection
  • 34 nodes: 24 routers and 9 end devices, all online during the capture
  • Six Shelly Mini 1PM Gen4 routers (Shelly / Mini1PM, model S4SW-001P8EU) on firmware 2.1.1

The same Shelly firmware failure is independently reproduced with Zigbee2MQTT, TI and Ember coordinators in Koenkk/zigbee2mqtt#32704. Shelly support has reportedly acknowledged it as a Gen4 firmware routing/mesh stability issue.

Observed behavior

  • The affected devices continue sending electrical measurement and metering reports.
  • ZHA therefore shows them as available: true, with a fresh last_seen and LQI values between 108 and 168.
  • A directed On/Off command or cluster read can fail with:
zigpy.exceptions.DeliveryError: Failed to deliver message:
<sl_Status.ZIGBEE_DELIVERY_FAILED: 3074>
  • During a short debug capture, five delivery failures targeted two of the six Shelly routers while their incoming reports continued.
  • The devices remain reachable through their local Wi-Fi API and the coordinator shows no reset, serial, queue or buffer failure.
  • Power cycling or rejoining a device can restore bidirectional Zigbee temporarily, after which it may degrade again without changing its NWK address.

This is particularly confusing operationally: Home Assistant presents a live state and an available device, but user commands fail.

Expected behavior

ZHA should make it possible to distinguish:

  1. no communication with a device;
  2. recent inbound traffic only;
  3. confirmed bidirectional communication.

One possible direction would be tracking the last successful directed request and/or consecutive APS delivery failures independently from inbound last_seen. This could be exposed as diagnostics or a degraded-health event rather than marking a device unavailable after a single failure. A periodic active probe for mains routers may be another option, although it would need conservative scheduling to avoid unnecessary mesh traffic.

Questions

  • Is a separate outbound-health signal appropriate in zha, or should this state be tracked in zigpy?
  • Would maintainers accept a PR that records consecutive directed delivery failures and clears the degraded state after the next successful request?
  • Which public API or event should expose it without changing existing availability semantics?

I can test a proposed implementation against six affected devices and provide a sanitized debug capture if useful.

Dominant language
Python
Stars
96
Forks
84
Avg merge
2d 4h
Merged PRs (30d)
30

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from zigpy/zha

All issues in zigpy/zha

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.