Skip to content

fix: discovery wedge, command limits, and dim timing - #180

Merged
cursor[bot] merged 5 commits into
masterfrom
dougrathbone/fix-discovery-wedge-and-command-limits-c063
Nov 21, 2026
Merged

cursor[bot] merged 5 commits into
masterfrom
dougrathbone/fix-discovery-wedge-and-command-limits-c063

Conversation

@dougrathbone

@dougrathbone dougrathbone commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

Four fixes, released as 1.40.5.

Changes

  • An empty TREEXML (start then end, no body) now fails that network's discovery request and retries. It used to clear the session and leave the network on discovering.
  • MQTT gettree, getall, and bridge/announce share a sliding-window limit, 30 of each kind per minute, and drop the rest. Each kind has its own counter. The cap is a standalone setting.
  • INCREASE and DECREASE start their level-read timeout when the GET leaves the command queue, not when it is queued. A read dropped from a full queue fails the dim immediately.
  • A second network auto-discovery run is no longer cleared when the first run finishes. Only the current run may clear the handler and apply the networks it found.

Test plan

  • npm test passes locally with no failures (3414 tests)
  • npm run lint and npm run typecheck pass
  • New code has unit test coverage (aim for ≥ 60% on changed files)
  • Existing tests were not broken or removed without justification

Checklist

  • Version bumped in package.json and homeassistant-addon/config.yaml (if releasing)
  • CHANGELOG.md updated (if releasing)
  • No sensitive data or credentials included
Open in Web Open in Cursor 

A 343 followed by a 344 and no data cleared the tree session and the
stall timer, then returned without scheduling a retry. The network
stayed on discovering until restart. An empty body for a known network
now fails the request the same way a malformed tree does. A tree that
cannot be attributed to a network is still dropped.
Any client that can publish can ask C-Gate for a whole network as fast
as the broker will take it. gettree, getall, and bridge/announce now
share the existing sliding-window limiter, with a separate counter per
command, and drop further commands once a kind exceeds 30 in a minute.
The cap is a standalone setting so it can be raised without an add-on
option that invites turning the limit off.
INCREASE and DECREASE armed their five-second wait as soon as the GET
was queued. While the command pool was down that wait expired, Home
Assistant was told the old level, and the ramp never went out. The wait
now starts when the queue dequeues the read, and a read dropped from a
full queue fails the dim immediately so the listener does not stay
registered.
Each tree //PROJECT pass stored its handler on one field and cleared
that field when it finished. A second pass replaced the handler, then
the first pass's timeout or error nulled the new handler and could
apply the first pass's networks. A generation counter lets only the
current pass clear the handler and publish what it found.
@cursor
cursor Bot merged commit 4e6a22f into master Nov 21, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant