Skip to content

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

Open
Highsteads wants to merge 1 commit into
simons-plugins:mainfrom
Highsteads:fix/sensor-native-state-declarations
Open

Remove redundant native-state declarations from sensor device types#73
Highsteads wants to merge 1 commit 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 how several Matter sensors and alarms present their primary status on device pages and in triggers.
    • Improved consistency for temperature, humidity, air quality, motion, contact, smoke, and CO devices by relying on the existing display state instead of duplicate state definitions.

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: ea88012e-e115-4f11-9b5c-46112994544a

📥 Commits

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

📒 Files selected for processing (1)
  • indigo-matter.indigoPlugin/Contents/Server Plugin/Devices.xml
💤 Files with no reviewable changes (1)
  • indigo-matter.indigoPlugin/Contents/Server Plugin/Devices.xml

📝 Walkthrough

Walkthrough

This change removes explicit primary display-state definitions from multiple Matter device templates in Devices.xml while keeping the same UiDisplayStateId references and leaving the remaining state declarations, including batteryLevel and existing alarm states, intact.

Changes

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

Possibly related PRs

  • simons-plugins/indigo-matter#57: Both changes touch Matter sensor display-state handling in Indigo, including sensorValue/onOffState display behavior and related device presentation wiring.

Poem

🐇 I tidied states from XML rows,
Where display names once chose to pose.
The sensors still point where they should,
With battery notes still standing good.
A neat little hop, a lighter file—
And rabbit ears rest for a while.

🚥 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 primary change: removing redundant native-state declarations from sensor device types in the changeset.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

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