Skip to content

feat: resync device constants with Gladys (charging station, water heater, thermostat) - #26

Merged
Pierre-Gilles merged 1 commit into
mainfrom
claude/sdk-gladys-update-zbg1yu
Aug 7, 2026
Merged

feat: resync device constants with Gladys (charging station, water heater, thermostat)#26
Pierre-Gilles merged 1 commit into
mainfrom
claude/sdk-gladys-update-zbg1yu

Conversation

@Pierre-Gilles

@Pierre-Gilles Pierre-Gilles commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Resyncs lib/device-constants.js with the current server/utils/constants.js of GladysAssistant/Gladys@master.

What Gladys added since the last resync

DEVICE_FEATURE_CATEGORIES:

  • CHARGING_STATION: 'charging-station'
  • WATER_HEATER: 'water-heater'

DEVICE_FEATURE_TYPES:

  • new CHARGING_STATION group — connector-status and charging-state (aligned with OCPP 2.0.1/2.1 on the Gladys side);
  • new WATER_HEATER group — binary, mode, target-temperature, remaining-hot-water, heating, boost, with the Gladys comments describing the category boundary and the value conventions;
  • two new THERMOSTAT types — mode and operating-state.

DEVICE_FEATURE_UNITS is unchanged in Gladys, so it is left as is.

Notes

  • The three objects stay byte-identical to the Gladys source (verified by extracting each block from both files and diffing them), so the next resync remains a plain copy/paste and the diff keeps showing exactly what Gladys added.
  • Only the three mirrored objects are in scope: the value enums Gladys defines alongside them (WATER_HEATER_MODE, THERMOSTAT_MODE, CHARGING_STATION_CONNECTOR_STATUS, …) are not exposed by the SDK today and are left out, as with AC_MODE & co. previously.
  • index.d.ts is 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.
  • New assertions cover the added categories and types.

Checks

npm test (195 tests, 0 failures), npm run lint, npm run check-types and npm run prettier-check all 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.js and index.d.ts with Gladys server/utils/constants.js so integrations can use the latest canonical category/type strings in discovery payloads.

Categories added: CHARGING_STATION (charging-station) and WATER_HEATER (water-heater).

Types added: a CHARGING_STATION group (connector-status, charging-state); a full WATER_HEATER group (binary, mode, target-temperature, remaining-hot-water, heating, boost) with Gladys’s scope/value comments in the JS mirror; and THERMOSTAT gains mode and operating-state. Units are unchanged.

Tests in test/device-constants.test.js assert the new strings and keep index.d.ts parity 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

    • Added support for charging-station devices, including connector status and charging state.
    • Added support for water-heater devices, including power, mode, target temperature, hot-water availability, heating, and boost controls.
    • Added thermostat mode and operating-state feature types.
  • Tests

    • Expanded coverage for the new device categories and feature types.

…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
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The 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.

Changes

Device feature constants

Layer / File(s) Summary
Add device categories and feature types
index.d.ts, lib/device-constants.js
Adds charging-station and water-heater categories, charging-station feature types, thermostat mode and operating-state types, and water-heater feature types.
Validate exported constants
test/device-constants.test.js
Tests the new category strings and selected feature type constants.

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

Possibly related PRs

Poem

A rabbit hops through constants bright,
Charging stations join the night.
Warm water modes now take their place,
Thermostat states run the race.
Types and tests align just right.

🚥 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 clearly summarizes the synchronization of device constants and identifies the added charging station, water heater, and thermostat features.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/sdk-gladys-update-zbg1yu

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
test/device-constants.test.js (1)

64-69: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover all new water-heater feature types.

The added assertions check only REMAINING_HOT_WATER and BOOST. Add assertions for BINARY, MODE, TARGET_TEMPERATURE, and HEATING.

The parity test at test/device-constants.test.js:94-100 checks 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

📥 Commits

Reviewing files that changed from the base of the PR and between 6a15242 and f5e720e.

📒 Files selected for processing (3)
  • index.d.ts
  • lib/device-constants.js
  • test/device-constants.test.js

@Pierre-Gilles
Pierre-Gilles merged commit 3a60fda into main Aug 7, 2026
7 checks passed
@Pierre-Gilles
Pierre-Gilles deleted the claude/sdk-gladys-update-zbg1yu branch August 7, 2026 13:26
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