Skip to content

Remove redundant native-state declarations from sensor device types#73

Merged
simons-plugins merged 3 commits into
simons-plugins:mainfrom
Highsteads:fix/sensor-native-state-declarations
Jul 6, 2026
Merged

Remove redundant native-state declarations from sensor device types#73
simons-plugins merged 3 commits into
simons-plugins:mainfrom
Highsteads:fix/sensor-native-state-declarations

Conversation

@Highsteads

@Highsteads Highsteads commented Jun 13, 2026

Copy link
Copy Markdown

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"> in Devices.xml. For the eleven where the matching creation prop is True (SupportsSensorValue or SupportsOnState), Indigo owns that state natively, so the client logs one error per device at startup:

Error (client)  illegal state key sensorValue defined by plugin -- native state keys cannot be overriden (ignoring)
Error (client)  illegal state key onOffState defined by plugin -- native state keys cannot be overriden (ignoring)

This PR removes those eleven redundant declarations. The native state is still created via the display_props your 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

  • sensorValue from Temperature, Humidity, Illuminance, Pressure, Flow, CO2, PM2.5, TVOC (all inherit SupportsSensorValue=True from _SensorHandler)
  • onOffState from Motion, Contact, Smoke/CO (SupportsOnState=True)

Deliberately left alone

matterAirQualitySensor keeps its <State id="sensorValue">. It sets both Supports* props False, so per your issue #56 note sensorValue is a legal XML-declared custom state there rather than the native key — removing it would break it. UiDisplayStateId lines are untouched throughout.

Verification

  • Devices.xml re-validates as well-formed
  • Full suite green: 773 passed (zoo + sensor + device_sync invariants all hold)

I 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

    • Simplified several Matter sensors and alarms so their primary status presentation on device pages and in triggers uses the existing display state rather than duplicate state declarations.
    • Improved consistency across temperature, humidity, air quality, motion, contact, and smoke/CO devices, making trigger/control-page labels align with the displayed status.
  • Chores

    • Bumped the plugin version to 2026.4.1.

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).
@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e0a3aa48-c7c5-44e5-9ff9-f3b1a05617b8

📥 Commits

Reviewing files that changed from the base of the PR and between 5a46c10 and cf0d789.

📒 Files selected for processing (2)
  • indigo-matter.indigoPlugin/Contents/Info.plist
  • indigo-matter.indigoPlugin/Contents/Server Plugin/Devices.xml
✅ Files skipped from review due to trivial changes (1)
  • indigo-matter.indigoPlugin/Contents/Info.plist
🚧 Files skipped from review as they are similar to previous changes (1)
  • indigo-matter.indigoPlugin/Contents/Server Plugin/Devices.xml

📝 Walkthrough

Walkthrough

The plugin version is incremented in Info.plist, and Devices.xml removes explicit primary display-state blocks from multiple Matter sensor and alarm templates while keeping the same UiDisplayStateId references and remaining state declarations.

Changes

Plugin version update

Layer / File(s) Summary
Version string bump
indigo-matter.indigoPlugin/Contents/Info.plist
The plugin version string changes from 2026.4.0 to 2026.4.1.

Matter device display state cleanup

Layer / File(s) Summary
Value sensor template cleanup
indigo-matter.indigoPlugin/Contents/Server Plugin/Devices.xml
Temperature, humidity, illuminance, CO₂, PM2.5, TVOC, pressure, and flow sensor templates remove explicit sensorValue state blocks while still referencing sensorValue via UiDisplayStateId and retaining batteryLevel.
Binary and alarm template cleanup
indigo-matter.indigoPlugin/Contents/Server Plugin/Devices.xml
Motion, contact, and smoke/CO alarm templates remove explicit onOffState blocks while keeping UiDisplayStateId set to onOffState; the alarm template keeps its other alarm-related states and batteryLevel.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: removing redundant native-state declarations from sensor device types.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

simons-plugins and others added 2 commits July 6, 2026 18:34
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 simons-plugins left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 set SupportsOnState=True, so those keys are Indigo-native and the XML declarations were only producing the startup errors you quoted.
  • The matterAirQualitySensor carve-out is exactly right (both props FalsesensorValue is 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

@simons-plugins simons-plugins merged commit daebeed into simons-plugins:main Jul 6, 2026
3 checks passed
simons-plugins added a commit that referenced this pull request Jul 6, 2026
…riant

test: zoo invariant pinning the PR #73 native-state class
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.

2 participants