Repository navigation
5.16: Z-Wave code tables follow the standard, plus contract tests - #1
Merged
Merged
Conversation
- conftest.py: bundle on sys.path; reuses the bundle test_plugin.py indigo
stand-in (no second stub)
- test_xml_callbacks_and_changelog.py: every CallbackMethod and List method
exists; every state written by name is declared; docs/changelog.md newest
entry matches Info.plist
- test_zwave_code_tables.py: the code tables against the Z-Wave standard
(zwave-js definitions, fetched 01-11-2026) and the decoders on real-shaped
reports. Seven xfail(strict) tests pin real faults:
* BINARY_SENSOR_TYPES: 0x06 Water decoded as tamper, 0x08 Tamper as motion,
0x04 CO2 as waterLeak, 0x09 Aux / 0x0B Tilt as motion
* SENSOR_TYPES from 0x0B: e.g. 0x10 Current written to watts, 0x0F Voltage
to co2Level, 0x11 CO2 to uvIndex
* Home Security idle clears motion AND tamper on every idle and sets
onOffState False on a contact device
No plugin code changed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Z2FM7PBbhgq9QjrM5W2HY
Checked against the zwave-js definitions (BinarySensorType, Sensors.ts). - BINARY_SENSOR_TYPES: 0x06 Water -> waterLeak (was tamper), 0x08 Tamper -> tamper (was motion). 0x04 CO2, 0x09 Aux and 0x0B Tilt no longer map to waterLeak / motion; codes with no state of their own fall back to onOffState as before. - SENSOR_TYPES: correct from 0x0B up (0x0F voltage, 0x10 current, 0x11 CO2, 0x12 air flow, 0x1B UV, 0x1E loudness, 0x1F moisture, 0x22 target temperature, 0x23 PM2.5, 0x27 VOC; 0x06 velocity added). Codes with no matching state are logged as unknown instead of written somewhere wrong. - SENSOR_SCALES: unit per scale; mV and mA converted to V and A. Target temperature converted to degC/degF like temperature. - Self-test sample and six bundle tests that encoded the old codes updated to the standard codes. tests/test_zwave_code_tables.py: the five table xfails now pass and their markers are removed; new tests for every code, unknown codes, scales and conversions. The idle-event xfails remain. - Version 5.16: Info.plist, plugin.py header, README, docs/changelog.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019Z2FM7PBbhgq9QjrM5W2HY
3 of 4 tasks
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.
Summary
This adds new contract tests from a code review, and fixes the two Z-Wave code tables that the tests showed were wrong. The expected values come from the zwave-js project's definitions (
BinarySensorTypeinpackages/cc/src/lib/_Types.tsandpackages/core/src/registries/Sensors.ts), fetched on 01-11-2026.Tests
tests/conftest.pyreuses the bundle's owntest_plugin.pyindigo stand-in rather than adding a second one.test_xml_callbacks_and_changelog.pychecks that:CallbackMethodandList method=named in the XML existsdocs/changelog.mdentry matches Info.plisttest_zwave_code_tables.pychecks both tables against the standard, every mapped code, codes with no matching state, scales and conversions, and the notification codes.5.16: code tables (the plugin change)
BINARY_SENSOR_TYPES:waterLeak(it settamper)tamper(it setmotion)waterLeakormotion; like any type with no state of its own, they set onlyonOffStateSENSOR_TYPES:watts, 0x0F Voltage toco2Level, and 0x11 CO2 touvIndexSENSOR_SCALES: the unit follows the scale the sensor sends. mV and mA are converted to V and A. Target temperature (0x22) is converted to °C/°F like temperature.docs/changelog.md.Not fixed (still
xfail(strict))A Home Security "idle" notification clears motion and tamper on every idle. It also writes
onOffState=Falsewhatever the device type, so a contact device can show closed when a tamper clears. I'm fairly, but not fully, confident that the standard's idle event names the event that ended in its first event parameter.Test plan
pytest: 264 passed, 2 xfailed. Ruff and compileall are clean.--runxfail).Generated by Claude Code