-
Notifications
You must be signed in to change notification settings - Fork 201
Fix incorrect Battery and Wired feature usage in Power Source cluster (CON-1728) #1464
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
base: release/v1.4
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -234,9 +234,9 @@ uint32_t get_id() | |
esp_err_t add(cluster_t *cluster, config_t *config) | ||
{ | ||
VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); | ||
uint32_t battery_feature_map = feature::battery::get_id(); | ||
if ((get_feature_map_value(cluster) & battery_feature_map) == battery_feature_map) { | ||
ESP_LOGE(TAG, "Cluster already supports Battery feature"); | ||
uint32_t wired_feature_map = feature::wired::get_id(); | ||
if ((get_feature_map_value(cluster) & wired_feature_map) == wired_feature_map) { | ||
ESP_LOGE(TAG, "Cluster already supports Wired feature"); | ||
Comment on lines
+237
to
+239
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not how it works, the battery and wired features for Power Source cluster are mutually exclusive, only one of them can be present on an endpoint. This check was to prevent addition of both features on the same endpoint. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This mutually exclusive check is not correct, you can try to create a battery storage device then it will not add battery feature to power source at all. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The check is correct, but the device type requirement is incorrect as mentioned in the Spec issue.
Because you already have added wired feature, only one should be there on an endpoint. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This means it is mandatory to remove this from battery storage endpoint to add battery feature to power source cluster: power_source::feature::wired::add(power_source_cluster, &config->power_source_device.power_source.wired); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We cannot break the spec compliance, for your use case please maintain a patch to allow |
||
return ESP_ERR_NOT_SUPPORTED; | ||
} | ||
update_feature_map(cluster, get_id()); | ||
|
@@ -259,9 +259,9 @@ uint32_t get_id() | |
esp_err_t add(cluster_t *cluster, config_t *config) | ||
{ | ||
VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); | ||
uint32_t wired_feature_map = feature::wired::get_id(); | ||
if ((get_feature_map_value(cluster) & wired_feature_map) == wired_feature_map) { | ||
ESP_LOGE(TAG, "Cluster already supports Wired feature"); | ||
uint32_t battery_feature_map = feature::battery::get_id(); | ||
if ((get_feature_map_value(cluster) & battery_feature_map) == battery_feature_map) { | ||
ESP_LOGE(TAG, "Cluster already supports Battery feature"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
return ESP_ERR_NOT_SUPPORTED; | ||
} | ||
update_feature_map(cluster, get_id()); | ||
|
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.
This is the bug in the specification PTAL https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/10912, one of the wired and battery feature should be present on one endpoint. Once the spec is fixed then we should change this code.
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.
Only one should be present, not both wired or battery
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.
Has it been corrected now?