Add get_kvs_value and set_kvs_value actions for Shelly RPC devices#157349
Conversation
|
Hey there @thecode, @chemelli74, @bdraco, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Pull request overview
This PR adds two new service actions (get_kvs_value and set_kvs_value) to the Shelly integration, enabling users to interact with the Key-Value Storage (KVS) feature available on Shelly RPC devices (Gen2 and newer). The implementation includes comprehensive validation, error handling, test coverage, and user-facing documentation.
Key changes:
- New services module with device validation and error handling for KVS operations
- Support for retrieving and setting KVS values on RPC-enabled Shelly devices
- Quality scale updates marking action-setup and related rules as complete
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
homeassistant/components/shelly/services.py |
New services module implementing get_kvs_value and set_kvs_value actions with comprehensive validation (RPC-only, non-sleeping devices) and error handling |
homeassistant/components/shelly/__init__.py |
Integrates services setup by calling async_setup_services during component initialization |
homeassistant/components/shelly/const.py |
Adds ATTR_KEY and ATTR_VALUE constants for service parameter definitions |
homeassistant/components/shelly/services.yaml |
Defines service schemas with device selector and text/object fields for KVS operations |
homeassistant/components/shelly/strings.json |
Adds service descriptions, field labels, and error messages for KVS functionality |
homeassistant/components/shelly/icons.json |
Adds import/export icons for get_kvs_value and set_kvs_value services |
homeassistant/components/shelly/quality_scale.yaml |
Updates quality scale marking action-related rules as complete |
tests/components/shelly/test_services.py |
Comprehensive test coverage including success cases, validation errors, device compatibility checks, and exception handling |
thecode
left a comment
There was a problem hiding this comment.
Tested with various payloads, looks great 👍
Breaking change
Proposed change
Adds following actions:
get_kvs_value- gets a value from the device's Key-Value-Storageset_kvs_value- sets a value in the device's Key-Value-StorageFeature request: https://community.home-assistant.io/t/support-for-shelly-kvs-values-as-sensors/757687
Waiting for home-assistant-libs/aioshelly#1000Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: