Skip to content
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

OnOff: Off With Effect message from coordinator gets a Default Response Invalid Field (0x85) from my device. (TZ-1233) #457

Closed
3 tasks done
honusz opened this issue Oct 18, 2024 · 3 comments
Labels

Comments

@honusz
Copy link

honusz commented Oct 18, 2024

Answers checklist.

  • I have read the documentation ESP Zigbee SDK Programming Guide and tried the debugging tips, the issue is not addressed there.
  • I have updated ESP Zigbee libs (esp-zboss-lib and esp-zigbee-lib) to the latest version, with corresponding IDF version, and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.3

esp-zigbee-lib version.

1.5.0

esp-zboss-lib version.

1.5.0

Espressif SoC revision.

ESP32-H2

What is the expected behavior?

The message should be passed to the attribute_handler.

What is the actual behavior?

Device replies to coordinator with Default Response (0x0b) Invalid Field (0x85)

Steps to reproduce.

NETWORK KEY: 6c:60:0a:40:c5:04:9a:b47f:0b:e9:62:17:4b:08:4b
off_with_effect-default_response.pcapng.zip

More Information.

I'm running a slightly modified version of the HA_Color_Dimmable_Light example @xieqinan has posted in other issues. It connects to my Philips Hue hub no problem, the light is added properly.
On commands (0x01) to the On/Off Cluster work fine.
Philips Hue uses Off with effect (0x40) with an Effect ID of Delayed All Off (0x00), and an Effect Variant of Fade to off in 0.8 seconds (0x00) which looks in-spec, but the command doesn't get to Attribute Handler, and the device responds with Default Response (0x0b) - Invalid Field (0x85)

Attaching the debug output, apologies I don't have the familiarity with this to isolate the relevant messages so just including it all. debug_output.txt

Does anything jump out? From as best as I can tell, the Off_with_effect message doesn't have any invalid fields.
From reading the docs, it looks like this command is supported.

@honusz honusz added the Bug label Oct 18, 2024
@github-actions github-actions bot changed the title OnOff: Off With Effect message from coordinator gets a Default Response Invalid Field (0x85) from my device. OnOff: Off With Effect message from coordinator gets a Default Response Invalid Field (0x85) from my device. (TZ-1233) Oct 18, 2024
@QDUNI
Copy link

QDUNI commented Oct 19, 2024

I’ve been working on the exact same approach and encountered the same outcome as described.

@xieqinan
Copy link
Contributor

@honusz @QDUNI ,

I think this issue is triggered by the missing optional on_off attributes ESP_ZB_ZCL_ATTR_ON_OFF_ON_TIME and ESP_ZB_ZCL_ATTR_ON_OFF_GLOBAL_SCENE_CONTROL. Could you please add them to your project? You can refer to the code below:

    uint16_t on_off_on_time = 0;
    bool on_off_global_scene_control = 0;
    esp_zb_cluster_list_t *cluster_list = esp_zb_ep_list_get_ep(esp_zb_on_off_light_ep, HA_ESP_LIGHT_ENDPOINT);
    esp_zb_attribute_list_t *attr_list =
        esp_zb_cluster_list_get_cluster(cluster_list, ESP_ZB_ZCL_CLUSTER_ID_ON_OFF, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE);

    esp_zb_on_off_cluster_add_attr(attr_list, ESP_ZB_ZCL_ATTR_ON_OFF_ON_TIME, &on_off_on_time);
    esp_zb_on_off_cluster_add_attr(attr_list, ESP_ZB_ZCL_ATTR_ON_OFF_GLOBAL_SCENE_CONTROL,
                                   &on_off_global_scene_control);

More details for them can refer to the On/Off section of ZCL spec.

@honusz
Copy link
Author

honusz commented Oct 21, 2024

@xieqinan That did the trick, thank you!

Reviewing the spec, I do see that I overlooked these indirect references in 3.8.2.3.4.3:

On receipt of the Off With Effect command and if the GlobalSceneControl attribute is equal to TRUE, the application on the associated endpoint SHALL store its settings in its global scene then set the GlobalSceneControl attribute to FALSE. The application SHALL then enter its “off” state, update the OnOff attribute accordingly and set the OnTime attribute to 0x0000.

I'm curious though: Is 0x85 INVALID_FIELD the appropriate response for this? When I see this, or 0x80 MALFORMED_COMMAND, this indicates to me that the issue it that the issue is with what the device is receiving, not that something isn't properly configured on the device.
Would 0x81 UNSUP_COMMAND or 0x86 UNSUPPORTED_ATTRIBUTE not be a more appropriate response from the device?

Regardless, I'll close this issue as complete, with my thanks. If you think the response should be changed, I'm happy to open a new issue.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants