Skip to content

Add is_charging to power sensor GetBatteryPercent - #953

Merged
Eliot Horowitz (erh) merged 2 commits into
mainfrom
claude/vibrant-mccarthy-13ub9p
Nov 25, 2026
Merged

Eliot Horowitz (erh) merged 2 commits into
mainfrom
claude/vibrant-mccarthy-13ub9p

Conversation

@erh

Copy link
Copy Markdown
Member

Follow-up to #950. Lets clients show whether a battery is charging.

  • GetBatteryPercentResponse gains bool is_charging = 2.
  • GetPropertiesResponse gains bool is_charging_supported = 2, so clients can tell "not charging" apart from "this sensor can't tell".

Charging state rides on the existing GetBatteryPercent call instead of a new RPC. Clients get percent and charging state in one request, and implementers don't need another method. This mirrors GetVoltage and GetCurrent, which return is_ac alongside the reading.

Both are new fields, so the change is wire-compatible.

Generated code

powersensor.pb.go was regenerated with the plugin versions pinned in mise.toml. The gen/js output was not regenerated. The ready-for-protos label will have CI build it.

Follow-ups

  • rdk: BatteryPercent returns (percent, isCharging, err), and Properties gains IsChargingSupported.
  • viam-typescript-sdk: getBatteryPercent() returns [percent, isCharging].
  • test-widgets and app: show charging state when supported.

Generated by Claude Code

Adds is_charging to GetBatteryPercentResponse and is_charging_supported to
GetPropertiesResponse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PadCBBrmNND7WigDbb1ZFQ
@erh Eliot Horowitz (erh) added the ready-for-protos add this when you want protos to compile on every commit label Nov 25, 2026
@erh Eliot Horowitz (erh) removed the ready-for-protos add this when you want protos to compile on every commit label Nov 25, 2026
@erh
Eliot Horowitz (erh) merged commit d5d953d into main Nov 25, 2026
3 checks passed
@erh
Eliot Horowitz (erh) deleted the claude/vibrant-mccarthy-13ub9p branch November 25, 2026 01:31
Eliot Horowitz (erh) pushed a commit to viamrobotics/viam-typescript-sdk that referenced this pull request Nov 25, 2026
Picks up is_charging and is_charging_supported from viamrobotics/api#953.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PadCBBrmNND7WigDbb1ZFQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

protos-compiled safe to test committer is a member of this org

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants