Remove redundant native-state declarations from sensor device types#73
Conversation
The 11 type="sensor" device definitions that enable a native display state via their creation props (SupportsSensorValue or SupportsOnState True) still declared that same state in Devices.xml, so the Indigo client logs a "native state keys cannot be overriden (ignoring)" error per device at startup — the same issue already handled on the relay base type. Removed sensorValue from Temperature/Humidity/Illuminance/Pressure/Flow/CO2/ PM25/TVOC and onOffState from Motion/Contact/SmokeCO. matterAirQualitySensor is deliberately left untouched — it sets both Supports* props False, so there sensorValue is a legal XML-declared custom state (issue simons-plugins#56), not the native key. Full test suite green (773 passed).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe plugin version is incremented in ChangesPlugin version update
Matter device display state cleanup
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Maintainer commit on top of Highsteads' PR simons-plugins#73: merge current main (post-simons-plugins#80 split-endpoint energy) and bump PluginVersion per the every-PR version rule. Patch bump — startup-noise cleanup, no functional change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Arj5R66d73tc3PMPvHS65Z
simons-plugins
left a comment
There was a problem hiding this comment.
Thanks for this — genuinely well-researched contribution. Verified independently before approving:
- All eleven removals check out against the handlers: the value sensors set
SupportsSensorValue=True(sensors.py), motion/contact/smoke setSupportsOnState=True, so those keys are Indigo-native and the XML declarations were only producing the startup errors you quoted. - The
matterAirQualitySensorcarve-out is exactly right (both propsFalse→sensorValueis a legal custom state there). Nice catch reading the #56 history. - Applied cleanly onto current main (which has moved a fair bit since your branch — the #79/#80 split-endpoint energy work) and the full 806-test suite passes.
I pushed two maintainer commits to your branch: a merge of current main and the PluginVersion bump to 2026.4.1 that our version-check CI requires on every PR (repo convention — patch bump since this is cleanup). Hope that's OK; maintainerCanModify was on.
Follow-up on our side (not on you): we'll add a zoo invariant asserting that any device type whose handler sets a native Supports* prop True must NOT re-declare that state key in Devices.xml, so this class of redundancy can't creep back in.
🤖 Generated with Claude Code
…riant test: zoo invariant pinning the PR #73 native-state class
Hi Simon — small follow-on to the native-state-key cleanup you already did on the relay base type.
What
The twelve
type="sensor"device types still each declared a<State id="sensorValue">or<State id="onOffState">inDevices.xml. For the eleven where the matching creation prop isTrue(SupportsSensorValueorSupportsOnState), Indigo owns that state natively, so the client logs one error per device at startup:This PR removes those eleven redundant declarations. The native state is still created via the
display_propsyour handlers already set, so nothing changes functionally — it just clears the startup noise. Same fix you applied to the relay type, carried across to the sensors.Removed
sensorValuefrom Temperature, Humidity, Illuminance, Pressure, Flow, CO2, PM2.5, TVOC (all inheritSupportsSensorValue=Truefrom_SensorHandler)onOffStatefrom Motion, Contact, Smoke/CO (SupportsOnState=True)Deliberately left alone
matterAirQualitySensorkeeps its<State id="sensorValue">. It sets bothSupports*propsFalse, so per your issue #56 notesensorValueis a legal XML-declared custom state there rather than the native key — removing it would break it.UiDisplayStateIdlines are untouched throughout.Verification
Devices.xmlre-validates as well-formedI kept the diff surgical — happy to add the same explanatory comments you have on the relay base type if you would prefer them on the sensor types too. Thanks for the plugin.
Summary by CodeRabbit
Bug Fixes
Chores