-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for capability attributes in demo #21263
Conversation
WalkthroughWalkthroughThe changes improve the entity handling in a system by adding a Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant System
participant LightEntity
participant MediaPlayerEntity
participant ClimateEntity
participant WaterHeaterEntity
User->>System: Send attributes
System->>LightEntity: Filter attributes for LightEntity
System->>MediaPlayerEntity: Filter attributes for MediaPlayerEntity
System->>ClimateEntity: Filter attributes for ClimateEntity
System->>WaterHeaterEntity: Filter attributes for WaterHeaterEntity
LightEntity->>System: Return filtered attributes
MediaPlayerEntity->>System: Return filtered attributes
ClimateEntity->>System: Return filtered attributes
WaterHeaterEntity->>System: Return filtered attributes
System->>User: Send filtered attributes
sequenceDiagram
participant Developer
participant provideHassFunction
participant Console
Developer->>provideHassFunction: Invoke callService
provideHassFunction->>Console: Log service call
provideHassFunction->>Service: Make asynchronous service call
Service-->>provideHassFunction: Return response
provideHassFunction-->>Developer: Return service response
Tip AI model upgrade
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
// eslint-disable-next-line | ||
console.log("Entity service call", domain, service, data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a debug flag for logging.
Logging service calls is useful for debugging, but it might not be necessary for production environments. Consider adding a debug flag to control this logging.
- console.log("Entity service call", domain, service, data);
+ if (hass().debugConnection) {
+ console.log("Entity service call", domain, service, data);
+ }
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// eslint-disable-next-line | |
console.log("Entity service call", domain, service, data); | |
// eslint-disable-next-line | |
if (hass().debugConnection) { | |
console.log("Entity service call", domain, service, data); | |
} |
Breaking change
Proposed change
This adds capability attribute support to demo entities and allows for state restore when turning a device off and on. When a device is off, we only write the capability attributes, as we do in Home Assistant, as there is no state.
Also adds support for the set_cover_position service.
This fixes:
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: