fix(smarthome): gateway-count no longer miscounts GC secondary rules as external - #210
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
GET /rules/gateway-countcounted GC-owned rules from the DB columnsmarthome_rules.deconz_rule_id, which only holds the primary rule id of each logic chain.cancel/resetchains also create secondary gateway rules (GC:<id>:<name>#reset/#cancel) that aren't in that column, soexternal_rules = total - gcover-counted them as externally (Phoscon-)created rules.Fix
Count GC-owned rules by the
GC:name prefix over the livegetRules()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_rulesis now accurate.Test
New service test (
smarthome_rules_service.test.js) with a mixed gateway response (3 GC-named incl.#reset/#cancel+ 2 external) assertsgc_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