Skip to content

fix(smarthome): gateway-count no longer miscounts GC secondary rules as external - #210

Merged
CallMeTechie merged 1 commit into
masterfrom
fix/smarthome-gateway-count
Jul 1, 2026
Merged

fix(smarthome): gateway-count no longer miscounts GC secondary rules as external#210
CallMeTechie merged 1 commit into
masterfrom
fix/smarthome-gateway-count

Conversation

@CallMeTechie

Copy link
Copy Markdown
Owner

Problem

GET /rules/gateway-count counted GC-owned rules from the DB column smarthome_rules.deconz_rule_id, which only holds the primary rule id of each logic chain. cancel/reset chains also create secondary gateway rules (GC:<id>:<name>#reset / #cancel) that aren't in that column, so external_rules = total - gc over-counted them as externally (Phoscon-)created rules.

Fix

Count GC-owned rules by the GC: name prefix over the live getRules() response. All GC rules (primary + #reset/#cancel) carry that prefix; CLIP (#flag) and schedules (#sched) don't appear in /rules, so they're correctly excluded. external_rules is now accurate.

Test

New service test (smarthome_rules_service.test.js) with a mixed gateway response (3 GC-named incl. #reset/#cancel + 2 external) asserts gc_rules=3, external_rules=2. Service 6/6, API 8/8 green. No migration.

Follow-up to the deferred minor from the TP3 whole-branch review (#209).

🤖 Generated with Claude Code

Cancel/reset chains create secondary #reset/#cancel rules whose ids are not
stored in smarthome_rules.deconz_rule_id, so gateway-count attributed them to
external_rules. Count GC-owned rules by the GC: name prefix over the live
getRules() response instead.
@CallMeTechie
CallMeTechie merged commit f3f2cb0 into master Jul 1, 2026
8 checks passed
@CallMeTechie
CallMeTechie deleted the fix/smarthome-gateway-count branch July 1, 2026 10:49
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