Add device-info CLI command and InstallType enum#56
Merged
Conversation
Added new CLI command to retrieve basic device information from REST API and new InstallType enum for device installation classification. Features: - New 'device-info' CLI command to get DeviceInfo via REST API - New InstallType enum (RESIDENTIAL='R', COMMERCIAL='C') - New str_enum_validator() converter for string-based enums - DeviceInfo.install_type now uses InstallType enum with validation - Added INSTALL_TYPE_TEXT mapping for display This complements the existing 'info' command which gets DeviceFeature via MQTT, providing a lighter-weight option for basic device information. All 378 tests passing.
…sensitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Resolved conflicts: - Removed tou_status_to_python function (consolidated to device_bool_to_python) - Updated DeviceInfo.connected field to use ConnectionStatus enum - Changed DeviceInfo.install_type to plain string (removed InstallType enum) - Removed TestTouStatusConverter tests (functionality now covered by device_bool tests)
- Remove unused imports (str_enum_validator, InstallType) - Update CLI handler to work with string install_type - Fix line length in device info output
Owner
Author
Merge UpdateSuccessfully merged Changes MadeResolved conflicts:
Note: The Validation
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new CLI command for retrieving basic device information via REST API and introduces an InstallType enum for device installation classification.
Key Changes:
- New
device-infoCLI command that fetches device information from the REST API (complementing the existinginfocommand which uses MQTT) InstallTypeenum added to classify devices as residential or commercial installationsstr_enum_validator()converter function for validating string-based enums
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/nwp500/enums.py | Adds InstallType enum and INSTALL_TYPE_TEXT mapping for residential/commercial classification |
| src/nwp500/converters.py | Implements str_enum_validator() function for string-based enum validation |
| src/nwp500/cli/handlers.py | Adds handle_get_device_info_rest() handler to fetch and display device info via REST API |
| src/nwp500/cli/main.py | Implements device-info CLI command with raw JSON output option |
| src/nwp500/cli/init.py | Exports new handle_get_device_info_rest handler |
| src/nwp500/init.py | Exports InstallType enum in public API |
| README.rst | Updates CLI documentation to distinguish between info (MQTT) and device-info (REST API) commands |
| CHANGELOG.rst | Documents version 7.2.1 changes including new command and enum |
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.
Summary
New CLI command to retrieve basic device information from REST API, plus new InstallType enum for device installation classification.
Features Added
1. New
device-infoCLI CommandRetrieves basic device information via REST API (DeviceInfo model):
This complements the existing
infocommand which gets DeviceFeature via MQTT.2. InstallType Enum
New enum for device installation classification:
InstallType.RESIDENTIAL= "R" - Residential useInstallType.COMMERCIAL= "C" - Commercial use3. String Enum Validator
New
str_enum_validator()converter for string-based enums, similar to the existingenum_validator()but for str-based enums.Changes
install_typefield now usesInstallTypeenum instead of plain string with automatic validationinfo(MQTT) anddevice-info(REST API) commandsINSTALL_TYPE_TEXTmapping for human-readable displayTesting
✅ All 378 tests passing
✅ Linting checks passing
✅ Type checking passing
Documentation