feat: resync device constants with Gladys (charging station, water heater, thermostat) - #26
Conversation
…ater, thermostat) Mirror the latest additions of DEVICE_FEATURE_CATEGORIES and DEVICE_FEATURE_TYPES in server/utils/constants.js of the Gladys repository (master): - new `charging-station` category, with its `connector-status` and `charging-state` feature types; - new `water-heater` category, with the six feature types of a domestic hot water appliance (binary, mode, target-temperature, remaining-hot-water, heating, boost); - two new `thermostat` feature types: mode and operating-state. DEVICE_FEATURE_UNITS is unchanged in Gladys, so it stays as is. The three objects remain byte-identical to the Gladys source, so the next resync is still a plain copy/paste. The typings are updated accordingly, and the existing index.d.ts parity test keeps both files in sync. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P55ka38W3TPuRLx7T7bunr
📝 WalkthroughWalkthroughThe SDK adds charging-station and water-heater categories. It adds related feature types and new thermostat mode and operating-state types. Runtime constants, TypeScript declarations, and tests are updated. ChangesDevice feature constants
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/device-constants.test.js (1)
64-69: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover all new water-heater feature types.
The added assertions check only
REMAINING_HOT_WATERandBOOST. Add assertions forBINARY,MODE,TARGET_TEMPERATURE, andHEATING.The parity test at
test/device-constants.test.js:94-100checks only runtime/declaration agreement. It cannot detect the same incorrect literal in both files.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/device-constants.test.js` around lines 64 - 69, Extend the DEVICE_FEATURE_TYPES.WATER_HEATER assertions in the device constants test to cover BINARY, MODE, TARGET_TEMPERATURE, and HEATING, verifying each against its expected feature-type literal alongside the existing REMAINING_HOT_WATER and BOOST checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@test/device-constants.test.js`:
- Around line 64-69: Extend the DEVICE_FEATURE_TYPES.WATER_HEATER assertions in
the device constants test to cover BINARY, MODE, TARGET_TEMPERATURE, and
HEATING, verifying each against its expected feature-type literal alongside the
existing REMAINING_HOT_WATER and BOOST checks.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1949e4cd-f41f-43cf-a189-9f2c41b25786
📒 Files selected for processing (3)
index.d.tslib/device-constants.jstest/device-constants.test.js
Resyncs
lib/device-constants.jswith the currentserver/utils/constants.jsofGladysAssistant/Gladys@master.What Gladys added since the last resync
DEVICE_FEATURE_CATEGORIES:CHARGING_STATION: 'charging-station'WATER_HEATER: 'water-heater'DEVICE_FEATURE_TYPES:CHARGING_STATIONgroup —connector-statusandcharging-state(aligned with OCPP 2.0.1/2.1 on the Gladys side);WATER_HEATERgroup —binary,mode,target-temperature,remaining-hot-water,heating,boost, with the Gladys comments describing the category boundary and the value conventions;THERMOSTATtypes —modeandoperating-state.DEVICE_FEATURE_UNITSis unchanged in Gladys, so it is left as is.Notes
WATER_HEATER_MODE,THERMOSTAT_MODE,CHARGING_STATION_CONNECTOR_STATUS, …) are not exposed by the SDK today and are left out, as withAC_MODE& co. previously.index.d.tsis updated in the same shape; the existing parity test (should declare the very same constants in index.d.ts) fails if one of the two files is forgotten.Checks
npm test(195 tests, 0 failures),npm run lint,npm run check-typesandnpm run prettier-checkall pass.Generated by Claude Code
Note
Low Risk
Additive string constants and typings only; no runtime behavior or security-sensitive logic changes.
Overview
Resyncs
lib/device-constants.jsandindex.d.tswith Gladysserver/utils/constants.jsso integrations can use the latest canonical category/type strings in discovery payloads.Categories added:
CHARGING_STATION(charging-station) andWATER_HEATER(water-heater).Types added: a
CHARGING_STATIONgroup (connector-status,charging-state); a fullWATER_HEATERgroup (binary,mode,target-temperature,remaining-hot-water,heating,boost) with Gladys’s scope/value comments in the JS mirror; andTHERMOSTATgainsmodeandoperating-state. Units are unchanged.Tests in
test/device-constants.test.jsassert the new strings and keepindex.d.tsparity with runtime exports.Reviewed by Cursor Bugbot for commit f5e720e. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
New Features
Tests