Handle Battery CC notifications#1365
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for Battery CC notifications and updates existing notification handlers to use strongly-typed enums instead of raw integers. The changes improve type safety and code maintainability by replacing integer fields with enum types throughout the notification system.
Changes:
- Adds new BatteryNotification class with enums for event types and urgency levels
- Converts notification field types from integers/strings to enums (EntryControlEventType, NotificationType, NotificationEvent, MultilevelSwitchStartLevelChangeDirection)
- Updates notification handler to include Battery CC and reorders cases alphabetically for better maintainability
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| zwave_js_server/const/command_class/battery.py | Adds new enum constants for Battery CC notification events and replacement status |
| zwave_js_server/const/command_class/multilevel_switch.py | Adds MultilevelSwitchStartLevelChangeDirection enum for direction values |
| zwave_js_server/model/notification.py | Adds BatteryNotification class, updates existing notifications to use enum types, fixes direction field default value |
| zwave_js_server/model/node/init.py | Adds Battery CC case to notification handler, reorders cases alphabetically |
| test/model/test_node.py | Adds Battery CC notification test, updates existing tests to assert enum values, uses raw integers for ccId in test data |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MartinHjelmare
approved these changes
Feb 9, 2026
Contributor
MartinHjelmare
left a comment
There was a problem hiding this comment.
Thanks!
If you're looking for easy fixes around notifications, these comments would be nice to address:
21 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.
Adds support for Battery CC notifications
I noticed we don't convert Entry Control and Notification CC notification values to enums (
EntryControlEventType,EntryControlDataType,NotificationType,NotificationEvent) and just pass the raw ints. zwave-js provides the corresponding label attributes in the event automatically, so I guess this is OK, but it creates some inconsistency in what we convert to a Python friendly model and what we don't.If we did convert those values to enums, we'd have to figure out how to handle unrecognized enums so that we don't destroy data in the event (e.g. right now our strategy is to return the UNKNOWN value for enums that support it which is -1. If we were to replace an integer value that is unrecognized, it would get serialized as -1 when the event gets emitted by HA).