Skip to content

Add energy-flow device feature constants (production power, grid-sensor, home-output-sensor) - #8

Open
Terdious wants to merge 3 commits into
GladysAssistant:mainfrom
Terdious:feat/energy-production-sensor-power
Open

Add energy-flow device feature constants (production power, grid-sensor, home-output-sensor)#8
Terdious wants to merge 3 commits into
GladysAssistant:mainfrom
Terdious:feat/energy-production-sensor-power

Conversation

@Terdious

@Terdious Terdious commented Jul 20, 2026

Copy link
Copy Markdown

Mirrors GladysAssistant/Gladys#2693 in the SDK constants so external integrations can expose the full energy-flow telemetry:

  • DEVICE_FEATURE_TYPES.ENERGY_PRODUCTION_SENSOR.POWER ('power') — instantaneous production power in watt (live solar/production power);
  • new grid-sensor category — input-power, output-power, signed power, input-index, output-index (the device's own grid exchange);
  • new home-output-sensor category — power, index, off-grid-power, off-grid-index (power delivered to the home / backup output).

Added in lib/device-constants.js and index.d.ts, with test coverage.

Claude-Session: https://claude.ai/code/session_012157sX3FKhVYmndWLJdhfo

Summary by CodeRabbit

  • New Features

    • Added support for grid sensor features, including imported/exported power and energy indexes.
    • Added home output sensor features, including delivered power, energy indexes, and off-grid measurements.
    • Expanded energy production sensor feature mappings.
  • Tests

    • Added coverage validating the new energy-related categories and feature types.

Mirror of the core addition: energy-production-sensor gains a `power` type for
the instantaneous production power (watt, >= 0) that solar inverters and hybrid
storage systems report, alongside the existing cumulative/derived types.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012157sX3FKhVYmndWLJdhfo
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds grid and home-output sensor categories and feature types to runtime constants and TypeScript declarations, expands energy production types, and verifies the canonical string mappings with tests.

Changes

Energy feature constants

Layer / File(s) Summary
Add energy sensor constants and coverage
lib/device-constants.js, index.d.ts, test/device-constants.test.js
Adds grid and home-output sensor categories and feature types, expands energy production types, updates declarations, and tests canonical values.

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

Suggested reviewers: pierre-gilles

Poem

A rabbit hops through grids of light,
With power keys arranged just right.
New sensors bloom, types neatly flow,
Tests check each string in a row.
“Energy maps!” the bunny sings.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the added energy-related device feature constants and the new grid/home output sensor types.
✨ 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.

@Terdious Terdious changed the title Add energy-production-sensor power type constant Add energy-flow device feature constants (production power, grid-sensor, home-output-sensor) Jul 20, 2026
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