Open jonsmirl opened 3 months ago
This works to send the attributes....
class ActionsAttrAccess : public AttributeAccessInterface
{
public:
// Register for the Actions cluster on endpoint 1.
ActionsAttrAccess() : AttributeAccessInterface(chip::Optional<chip::EndpointId>(1), Actions::Id) {}
CHIP_ERROR Read(const ConcreteReadAttributePath &aPath, AttributeValueEncoder &aEncoder) override
{
CHIP_ERROR err = CHIP_NO_ERROR;
ConcreteDataAttributePath EndpointListsPath(1, Actions::Id, Actions::Attributes::EndpointLists::Id);
ConcreteDataAttributePath ActionListPath(1, Actions::Id, Actions::Attributes::ActionList::Id);
if (EndpointListsPath.MatchesConcreteAttributePath(aPath))
{
err = aEncoder.EncodeList([](const auto &encoder) -> CHIP_ERROR {
EndpointId eps[] = { 3, 4, 5};
chip::app::DataModel::List<chip::EndpointId> endpoints;
endpoints = eps;
Actions::Structs::EndpointListStruct::Type endpointListStruct = {
1234, CharSpan::fromCharString("Yellow"), Actions::EndpointListTypeEnum::kZone,
DataModel::List<chip::EndpointId>(endpoints)
};
encoder.Encode(endpointListStruct);
return CHIP_NO_ERROR;
});
return CHIP_NO_ERROR;
} else if (ActionListPath.MatchesConcreteAttributePath(aPath))
{
err = aEncoder.EncodeEmptyList();
return CHIP_NO_ERROR;
}
return CHIP_NO_ERROR;
}
};
static ActionsAttrAccess gAttrAccess;
esp_err_t actions_cluster_create(endpoint_t *endpoint)
{
actions::config_t actions_config;
cluster::actions::create(endpoint, &actions_config, CLUSTER_FLAG_SERVER);
registerAttributeAccessOverride(&gAttrAccess);
return ESP_OK;
}
Doesn't appear to have any effect in Apple Home. I thought the Room field would be pre-filled with 'Yellow'.
@jonsmirl Esp-Matter's SDK doesn’t support reading structure/list from Esp-Matters storage. There are no src/app/clusters for the Actions
cluster which is why when the read request comes, the device doesn’t find that attribute in the Connectedhomeip, and when it comes to Esp-Matter, Esp-Matter doesn’t know how to encode the list so you get Attribute type 0x48 not handled
Look at the second comment, I built an AttributeAccessOverride to send the attribute and verified that is was correctly generated.
None of Google/Apple/Amazon appear to do anything with the Actions cluster. Can you ask around and see if anything is using it?
I tried coding up the Actions cluster to see if Apple Home understands it.
That code gives this error:
So maybe Attribute 0 is not getting initialized to an empty list? I did not use Attribute 0; Any idea what is wrong with my test code for Attribute 1?