From ac581002047946d87d0a12e954c93d829abd3f18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boris=20Labb=C3=A9?= Date: Mon, 11 Mar 2024 14:51:00 +0100 Subject: [PATCH] GH-34: Expose Z-Wave Generic and Specific Device Class Forwarded: https://github.com/SiliconLabs/UnifySDK/pull/34 Bug-SiliconLabs: UIC-3224 Bug-Github: https://github.com/SiliconLabs/UnifySDK/pull/34 --- .../cluster-types/cluster-type-attributes.ts | 20 ++ .../src/zigpc_attrmgmt_publish.cpp | 14 ++ .../src/zigpc_command_mapper_handlers.cpp | 12 + .../zap-generated/src/zcl_attribute_lists.cpp | 18 ++ .../zap-generated/include/zcl_definitions.h | 2 + .../components/dotdot_mapper/rules/Basic.uam | 14 ++ components/uic_dotdot/dotdot-xml/Basic.xml | 2 + .../include/dotdot_attribute_id_definitions.h | 2 + .../readme_ucl_mqtt_reference.md | 92 ++++++- .../src/dotdot_attribute_id_definitions.c | 16 +- .../zap-generated/include/dotdot_mqtt.h | 64 +++++ .../include/dotdot_mqtt_attributes.h | 26 ++ .../zap-generated/src/dotdot_mqtt.cpp | 144 +++++++++++ .../src/dotdot_mqtt_attributes.cpp | 170 +++++++++++++ .../zap-generated/src/dotdot_mqtt_helpers.cpp | 24 ++ .../include/dotdot_attributes.uam | 2 + .../include/dotdot_attributes_camel_case.uam | 2 + .../unify_dotdot_attribute_store_helpers.h | 212 ++++++++++++++++ .../unify_dotdot_defined_attribute_types.h | 2 + ...ot_attribute_store_attribute_publisher.cpp | 72 ++++++ ..._force_read_attributes_command_callbacks.c | 10 + .../unify_dotdot_attribute_store_helpers.cpp | 228 ++++++++++++++++++ ...fy_dotdot_attribute_store_registration.cpp | 48 ++++ .../test/unify_dotdot_attribute_store_test.c | 2 + 24 files changed, 1196 insertions(+), 2 deletions(-) diff --git a/applications/dev_ui/dev_gui/zap-generated/src/cluster-types/cluster-type-attributes.ts b/applications/dev_ui/dev_gui/zap-generated/src/cluster-types/cluster-type-attributes.ts index 15eb5413cb..3e7fbd0b58 100644 --- a/applications/dev_ui/dev_gui/zap-generated/src/cluster-types/cluster-type-attributes.ts +++ b/applications/dev_ui/dev_gui/zap-generated/src/cluster-types/cluster-type-attributes.ts @@ -405,6 +405,26 @@ export let ClusterTypeAttrs: any = { writable: false, isArray: false, default: 0, + }, + { + id: 65281, + name: "ZWaveGenericDeviceClass", + type: "number", + required: false, + reportRequired: false, + sceneRequired: false, + writable: false, + isArray: false, + }, + { + id: 65282, + name: "ZWaveSpecificDeviceClass", + type: "number", + required: false, + reportRequired: false, + sceneRequired: false, + writable: false, + isArray: false, } ], commands: [ diff --git a/applications/zigpc/components/attribute_management/zap-generated/src/zigpc_attrmgmt_publish.cpp b/applications/zigpc/components/attribute_management/zap-generated/src/zigpc_attrmgmt_publish.cpp index 06ecc9d767..1312c1cf0f 100644 --- a/applications/zigpc/components/attribute_management/zap-generated/src/zigpc_attrmgmt_publish.cpp +++ b/applications/zigpc/components/attribute_management/zap-generated/src/zigpc_attrmgmt_publish.cpp @@ -214,6 +214,20 @@ sl_status_t zigpc_attrmgmt_basic_publish(const char* unid_ep_topic, const zcl_at status = uic_mqtt_dotdot_basic_sw_buildid_publish(unid_ep_topic, value, UCL_MQTT_PUBLISH_TYPE_REPORTED); } break; + case ZIGPC_ZCL_CLUSTER_BASIC_ATTR_Z_WAVE_GENERIC_DEVICE_CLASS: + { + uint8_t value; + memcpy(&value, attr_value, sizeof(uint8_t)); + status = uic_mqtt_dotdot_basic_z_wave_generic_device_class_publish(unid_ep_topic, value, UCL_MQTT_PUBLISH_TYPE_REPORTED); + } + break; + case ZIGPC_ZCL_CLUSTER_BASIC_ATTR_Z_WAVE_SPECIFIC_DEVICE_CLASS: + { + uint8_t value; + memcpy(&value, attr_value, sizeof(uint8_t)); + status = uic_mqtt_dotdot_basic_z_wave_specific_device_class_publish(unid_ep_topic, value, UCL_MQTT_PUBLISH_TYPE_REPORTED); + } + break; case ZIGPC_ZCL_GLOBAL_ATTR_CLUSTER_REVISION: { uint16_t value; diff --git a/applications/zigpc/components/command_mapper/zap-generated/src/zigpc_command_mapper_handlers.cpp b/applications/zigpc/components/command_mapper/zap-generated/src/zigpc_command_mapper_handlers.cpp index 2e9f51e680..807a669d13 100644 --- a/applications/zigpc/components/command_mapper/zap-generated/src/zigpc_command_mapper_handlers.cpp +++ b/applications/zigpc/components/command_mapper/zap-generated/src/zigpc_command_mapper_handlers.cpp @@ -357,6 +357,18 @@ sl_status_t zigpc_command_mapper_basic_force_read_attributes_handler( ZIGPC_ZCL_CLUSTER_BASIC_ATTR_SW_BUILDID ); } + if (attributes_to_read.z_wave_generic_device_class == true) { + zigpc_command_mapper_populate_read_attr_record( + read_attr_data, read_attr_ids, + ZIGPC_ZCL_CLUSTER_BASIC_ATTR_Z_WAVE_GENERIC_DEVICE_CLASS + ); + } + if (attributes_to_read.z_wave_specific_device_class == true) { + zigpc_command_mapper_populate_read_attr_record( + read_attr_data, read_attr_ids, + ZIGPC_ZCL_CLUSTER_BASIC_ATTR_Z_WAVE_SPECIFIC_DEVICE_CLASS + ); + } if ((status == SL_STATUS_OK) && (read_attr_data.size() > 0)) { zigpc_command_mapper_send_unicast( diff --git a/applications/zigpc/components/zcl_profiles/zap-generated/src/zcl_attribute_lists.cpp b/applications/zigpc/components/zcl_profiles/zap-generated/src/zcl_attribute_lists.cpp index 1567c09b2e..dab946da9a 100644 --- a/applications/zigpc/components/zcl_profiles/zap-generated/src/zcl_attribute_lists.cpp +++ b/applications/zigpc/components/zcl_profiles/zap-generated/src/zcl_attribute_lists.cpp @@ -216,6 +216,24 @@ const zcl_attribute_t basic_attribute_list[] = { "SWBuildID", // attribute_name "", // desired_payload "", // reported_payload + }, + { + ZIGPC_ZCL_CLUSTER_BASIC, // cluster_id + ZIGPC_ZCL_CLUSTER_BASIC_ATTR_Z_WAVE_GENERIC_DEVICE_CLASS, // attribute_id + (e_zcl_attribute_type) ZIGPC_ZCL_DATA_TYPE_UINT8, // type + false, // is_reportable + "ZWaveGenericDeviceClass", // attribute_name + "", // desired_payload + "", // reported_payload + }, + { + ZIGPC_ZCL_CLUSTER_BASIC, // cluster_id + ZIGPC_ZCL_CLUSTER_BASIC_ATTR_Z_WAVE_SPECIFIC_DEVICE_CLASS, // attribute_id + (e_zcl_attribute_type) ZIGPC_ZCL_DATA_TYPE_UINT8, // type + false, // is_reportable + "ZWaveSpecificDeviceClass", // attribute_name + "", // desired_payload + "", // reported_payload }, { ZIGPC_ZCL_CLUSTER_BASIC, // cluster_id diff --git a/applications/zigpc/components/zcl_util/zap-generated/include/zcl_definitions.h b/applications/zigpc/components/zcl_util/zap-generated/include/zcl_definitions.h index c27f541a19..60e6535fb7 100644 --- a/applications/zigpc/components/zcl_util/zap-generated/include/zcl_definitions.h +++ b/applications/zigpc/components/zcl_util/zap-generated/include/zcl_definitions.h @@ -229,6 +229,8 @@ typedef enum { ZIGPC_ZCL_CLUSTER_BASIC_ATTR_ALARM_MASK = 0x13, ZIGPC_ZCL_CLUSTER_BASIC_ATTR_DISABLE_LOCAL_CONFIG = 0x14, ZIGPC_ZCL_CLUSTER_BASIC_ATTR_SW_BUILDID = 0x4000, + ZIGPC_ZCL_CLUSTER_BASIC_ATTR_Z_WAVE_GENERIC_DEVICE_CLASS = 0xFF01, + ZIGPC_ZCL_CLUSTER_BASIC_ATTR_Z_WAVE_SPECIFIC_DEVICE_CLASS = 0xFF02, } zigpc_zcl_basic_attr_type_t; /***************************************************************** diff --git a/applications/zpc/components/dotdot_mapper/rules/Basic.uam b/applications/zpc/components/dotdot_mapper/rules/Basic.uam index f9af23e7fb..40e7fa88db 100644 --- a/applications/zpc/components/dotdot_mapper/rules/Basic.uam +++ b/applications/zpc/components/dotdot_mapper/rules/Basic.uam @@ -21,6 +21,9 @@ def DOTDOT_ATTRIBUTE_ID_BASIC_DISABLE_LOCAL_CONFIG 0xba5c0014 def DOTDOT_ATTRIBUTE_ID_BASIC_SW_BUILDID 0xba5c4000 def zb_HWVersion 0xba5c0003 +def DOTDOT_ATTRIBUTE_ID_BASIC_ZWAVE_GENERIC_DEVICE_CLASS 0xba5cff01 +def DOTDOT_ATTRIBUTE_ID_BASIC_ZWAVE_SPECIFIC_DEVICE_CLASS 0xba5cff02 + // Z-Wave Attributes def ep 0x04 @@ -34,6 +37,11 @@ def NOTIFICATION_SYSTEM_TYPE 0x09 def NOTIFICATION_SYSTEM_STATE_HARDWARE_FAILURE 0x01 def NOTIFICATION_SYSTEM_STATE_SOFTWARE_FAILURE 0x02 +// This represents the Z-Wave Generic Device Type of a node/endpoint +def zwATTRIBUTE_ZWAVE_GENERIC_DEVICE_CLASS 0x0104 +// This represents the Z-Wave Specific Device Type of a node/endpoint. +def zwATTRIBUTE_ZWAVE_SPECIFIC_DEVICE_CLASS 0x0105 + // NIF flags def zwLISTENING 0x0008 def zwOPTIONAL 0x0009 @@ -52,6 +60,12 @@ scope 0 { undefined } +// ZWave Generic / Specific Device class +scope 0 { + r'DOTDOT_ATTRIBUTE_ID_BASIC_ZWAVE_GENERIC_DEVICE_CLASS = r'zwATTRIBUTE_ZWAVE_GENERIC_DEVICE_CLASS + r'DOTDOT_ATTRIBUTE_ID_BASIC_ZWAVE_SPECIFIC_DEVICE_CLASS = r'zwATTRIBUTE_ZWAVE_SPECIFIC_DEVICE_CLASS +} + // Map at the NodeID level scope 0 common_parent_type(0x03) { // TBD: UIC-1717 can we somehow get the path evaluation of the left-hand diff --git a/components/uic_dotdot/dotdot-xml/Basic.xml b/components/uic_dotdot/dotdot-xml/Basic.xml index 06a27cfe93..9f2e2e4467 100644 --- a/components/uic_dotdot/dotdot-xml/Basic.xml +++ b/components/uic_dotdot/dotdot-xml/Basic.xml @@ -230,6 +230,8 @@ applicable to this document can be found in the LICENSE.md file. + + diff --git a/components/uic_dotdot/zap-generated/include/dotdot_attribute_id_definitions.h b/components/uic_dotdot/zap-generated/include/dotdot_attribute_id_definitions.h index 70c0a280c2..e32fff89f6 100644 --- a/components/uic_dotdot/zap-generated/include/dotdot_attribute_id_definitions.h +++ b/components/uic_dotdot/zap-generated/include/dotdot_attribute_id_definitions.h @@ -69,6 +69,8 @@ typedef enum { #define DOTDOT_BASIC_ALARM_MASK_ATTRIBUTE_ID ((dotdot_attribute_id_t)0x13) #define DOTDOT_BASIC_DISABLE_LOCAL_CONFIG_ATTRIBUTE_ID ((dotdot_attribute_id_t)0x14) #define DOTDOT_BASIC_SW_BUILDID_ATTRIBUTE_ID ((dotdot_attribute_id_t)0x4000) +#define DOTDOT_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS_ATTRIBUTE_ID ((dotdot_attribute_id_t)0xFF01) +#define DOTDOT_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS_ATTRIBUTE_ID ((dotdot_attribute_id_t)0xFF02) // Definitions for cluster: PowerConfiguration #define DOTDOT_POWER_CONFIGURATION_MAINS_VOLTAGE_ATTRIBUTE_ID ((dotdot_attribute_id_t)0x0) #define DOTDOT_POWER_CONFIGURATION_MAINS_FREQUENCY_ATTRIBUTE_ID ((dotdot_attribute_id_t)0x1) diff --git a/components/uic_dotdot/zap-generated/readme_ucl_mqtt_reference.md b/components/uic_dotdot/zap-generated/readme_ucl_mqtt_reference.md index dbdfa36ecb..1601d6d02f 100644 --- a/components/uic_dotdot/zap-generated/readme_ucl_mqtt_reference.md +++ b/components/uic_dotdot/zap-generated/readme_ucl_mqtt_reference.md @@ -956,6 +956,94 @@ ucl/by-unid//ep0/Basic/Attributes/SWBuildID/Reported { "value":
+\subsection basic_attr_z_wave_generic_device_class Basic/ZWaveGenericDeviceClass Attribute + +**MQTT Topic Pattern:** + +``` +[PREFIX]/Basic/Attributes/ZWaveGenericDeviceClass/Reported +[PREFIX]/Basic/Attributes/ZWaveGenericDeviceClass/Desired +``` + +**MQTT Payload JSON Schema:** + +```json +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Basic Cluster ZWaveGenericDeviceClass Attribute Properties", + "type": "object", + "properties": { + "value": { + "type": "integer" + } + }, + "required": [ + "value" + ] +} +``` + + +**Example Mosquitto CLI Tool Usage** + +To see desired/reported value for ZWaveGenericDeviceClass attribute under the by-unid topic space: + +```console +mosquitto_sub -t 'ucl/by-unid/+/+/Basic/Attributes/ZWaveGenericDeviceClass/+' + +# Example output + +ucl/by-unid//ep0/Basic/Attributes/ZWaveGenericDeviceClass/Desired { "value": } +ucl/by-unid//ep0/Basic/Attributes/ZWaveGenericDeviceClass/Reported { "value": } + +``` + +

+ +\subsection basic_attr_z_wave_specific_device_class Basic/ZWaveSpecificDeviceClass Attribute + +**MQTT Topic Pattern:** + +``` +[PREFIX]/Basic/Attributes/ZWaveSpecificDeviceClass/Reported +[PREFIX]/Basic/Attributes/ZWaveSpecificDeviceClass/Desired +``` + +**MQTT Payload JSON Schema:** + +```json +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Basic Cluster ZWaveSpecificDeviceClass Attribute Properties", + "type": "object", + "properties": { + "value": { + "type": "integer" + } + }, + "required": [ + "value" + ] +} +``` + + +**Example Mosquitto CLI Tool Usage** + +To see desired/reported value for ZWaveSpecificDeviceClass attribute under the by-unid topic space: + +```console +mosquitto_sub -t 'ucl/by-unid/+/+/Basic/Attributes/ZWaveSpecificDeviceClass/+' + +# Example output + +ucl/by-unid//ep0/Basic/Attributes/ZWaveSpecificDeviceClass/Desired { "value": } +ucl/by-unid//ep0/Basic/Attributes/ZWaveSpecificDeviceClass/Reported { "value": } + +``` + +

+ \subsection basic_attr_cluster_revision Basic/ClusterRevision Attribute @@ -1202,7 +1290,9 @@ mosquitto_pub -t 'ucl/by-unid///Basic/Commands/WriteAttributes' -m '{ "DeviceEnabled", "AlarmMask", "DisableLocalConfig", - "SWBuildID" + "SWBuildID", + "ZWaveGenericDeviceClass", + "ZWaveSpecificDeviceClass" ] } } diff --git a/components/uic_dotdot/zap-generated/src/dotdot_attribute_id_definitions.c b/components/uic_dotdot/zap-generated/src/dotdot_attribute_id_definitions.c index cd3e175e69..cb6bb0e288 100644 --- a/components/uic_dotdot/zap-generated/src/dotdot_attribute_id_definitions.c +++ b/components/uic_dotdot/zap-generated/src/dotdot_attribute_id_definitions.c @@ -68,6 +68,10 @@ const char *uic_dotdot_get_attribute_name(dotdot_cluster_id_t cluster_id, return "DisableLocalConfig"; case DOTDOT_BASIC_SW_BUILDID_ATTRIBUTE_ID: return "SWBuildID"; + case DOTDOT_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS_ATTRIBUTE_ID: + return "ZWaveGenericDeviceClass"; + case DOTDOT_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS_ATTRIBUTE_ID: + return "ZWaveSpecificDeviceClass"; // clang-format on default: return "Unknown"; @@ -2101,6 +2105,12 @@ dotdot_attribute_id_t if (strcmp ("SWBuildID", attribute_name) == 0) { return DOTDOT_BASIC_SW_BUILDID_ATTRIBUTE_ID; } + if (strcmp ("ZWaveGenericDeviceClass", attribute_name) == 0) { + return DOTDOT_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS_ATTRIBUTE_ID; + } + if (strcmp ("ZWaveSpecificDeviceClass", attribute_name) == 0) { + return DOTDOT_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS_ATTRIBUTE_ID; + } break; case DOTDOT_POWER_CONFIGURATION_CLUSTER_ID: if (strcmp ("MainsVoltage", attribute_name) == 0) { @@ -4469,7 +4479,11 @@ dotdot_attribute_json_type_t return JSON_TYPE_NUMBER; case DOTDOT_BASIC_SW_BUILDID_ATTRIBUTE_ID: return JSON_TYPE_STRING; - // clang-format on + case DOTDOT_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS_ATTRIBUTE_ID: + return JSON_TYPE_NUMBER; + case DOTDOT_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS_ATTRIBUTE_ID: + return JSON_TYPE_NUMBER; + // clang-format on default: return JSON_TYPE_UNKNOWN; } diff --git a/components/uic_dotdot_mqtt/zap-generated/include/dotdot_mqtt.h b/components/uic_dotdot_mqtt/zap-generated/include/dotdot_mqtt.h index f0dc62b095..22186b1507 100644 --- a/components/uic_dotdot_mqtt/zap-generated/include/dotdot_mqtt.h +++ b/components/uic_dotdot_mqtt/zap-generated/include/dotdot_mqtt.h @@ -132,6 +132,8 @@ typedef struct { uint8_t alarm_mask; uint8_t disable_local_config; const char* sw_buildid; + uint8_t z_wave_generic_device_class; + uint8_t z_wave_specific_device_class; } uic_mqtt_dotdot_basic_state_t; typedef struct { @@ -156,6 +158,8 @@ typedef struct { bool alarm_mask; bool disable_local_config; bool sw_buildid; + bool z_wave_generic_device_class; + bool z_wave_specific_device_class; } uic_mqtt_dotdot_basic_updated_state_t; typedef sl_status_t (*uic_mqtt_dotdot_basic_write_attributes_callback_t)( @@ -895,6 +899,66 @@ sl_status_t uic_mqtt_dotdot_basic_sw_buildid_unretain( uic_mqtt_dotdot_attribute_publish_type_t publish_type ); +/** + * @brief Publish the attribute; Basic/Attributes/ZWaveGenericDeviceClass + * + * @param base_topic topic prefix to publish, /z_wave_generic_device_class + * will be appended + * @param value Value to publish + * @param publish_type Whether to publish as Desired, Reported, or Both. + * + * @returns SL_STATUS_OK on success + */ +sl_status_t uic_mqtt_dotdot_basic_z_wave_generic_device_class_publish( + const char *base_topic, + uint8_t value, + uic_mqtt_dotdot_attribute_publish_type_t publish_type +); + +/** + * @brief Unretains a published attribute; Basic/Attributes/ZWaveGenericDeviceClass + * + * @param base_topic topic prefix to publish, /z_wave_generic_device_class + * will be appended + * @param publish_type Whether to publish as Desired, Reported, or Both. + * + * @returns SL_STATUS_OK on success + */ +sl_status_t uic_mqtt_dotdot_basic_z_wave_generic_device_class_unretain( + const char *base_topic, + uic_mqtt_dotdot_attribute_publish_type_t publish_type +); + +/** + * @brief Publish the attribute; Basic/Attributes/ZWaveSpecificDeviceClass + * + * @param base_topic topic prefix to publish, /z_wave_specific_device_class + * will be appended + * @param value Value to publish + * @param publish_type Whether to publish as Desired, Reported, or Both. + * + * @returns SL_STATUS_OK on success + */ +sl_status_t uic_mqtt_dotdot_basic_z_wave_specific_device_class_publish( + const char *base_topic, + uint8_t value, + uic_mqtt_dotdot_attribute_publish_type_t publish_type +); + +/** + * @brief Unretains a published attribute; Basic/Attributes/ZWaveSpecificDeviceClass + * + * @param base_topic topic prefix to publish, /z_wave_specific_device_class + * will be appended + * @param publish_type Whether to publish as Desired, Reported, or Both. + * + * @returns SL_STATUS_OK on success + */ +sl_status_t uic_mqtt_dotdot_basic_z_wave_specific_device_class_unretain( + const char *base_topic, + uic_mqtt_dotdot_attribute_publish_type_t publish_type +); + /** * @brief Publish the Basic/ClusterRevision attribute diff --git a/components/uic_dotdot_mqtt/zap-generated/include/dotdot_mqtt_attributes.h b/components/uic_dotdot_mqtt/zap-generated/include/dotdot_mqtt_attributes.h index 92daf48a23..9d9c97dee0 100644 --- a/components/uic_dotdot_mqtt/zap-generated/include/dotdot_mqtt_attributes.h +++ b/components/uic_dotdot_mqtt/zap-generated/include/dotdot_mqtt_attributes.h @@ -190,6 +190,20 @@ typedef sl_status_t (*uic_mqtt_dotdot_basic_attribute_sw_buildid_callback_t)( uic_mqtt_dotdot_attribute_update_type_t update_type, const char* sw_buildid ); +typedef sl_status_t (*uic_mqtt_dotdot_basic_attribute_z_wave_generic_device_class_callback_t)( + dotdot_unid_t unid, + dotdot_endpoint_id_t endpoint, + bool unretained, + uic_mqtt_dotdot_attribute_update_type_t update_type, + uint8_t z_wave_generic_device_class +); +typedef sl_status_t (*uic_mqtt_dotdot_basic_attribute_z_wave_specific_device_class_callback_t)( + dotdot_unid_t unid, + dotdot_endpoint_id_t endpoint, + bool unretained, + uic_mqtt_dotdot_attribute_update_type_t update_type, + uint8_t z_wave_specific_device_class +); // Callback types used by the power_configuration cluster typedef sl_status_t (*uic_mqtt_dotdot_power_configuration_attribute_mains_voltage_callback_t)( dotdot_unid_t unid, @@ -5272,6 +5286,18 @@ void uic_mqtt_dotdot_basic_attribute_disable_local_config_callback_set(const uic * this callback will overwrite the previous set callback */ void uic_mqtt_dotdot_basic_attribute_sw_buildid_callback_set(const uic_mqtt_dotdot_basic_attribute_sw_buildid_callback_t callback); +/** + * Setup callback to be called when a + * Basic/Attributes/z_wave_generic_device_class/# is received. Setting + * this callback will overwrite the previous set callback + */ +void uic_mqtt_dotdot_basic_attribute_z_wave_generic_device_class_callback_set(const uic_mqtt_dotdot_basic_attribute_z_wave_generic_device_class_callback_t callback); +/** + * Setup callback to be called when a + * Basic/Attributes/z_wave_specific_device_class/# is received. Setting + * this callback will overwrite the previous set callback + */ +void uic_mqtt_dotdot_basic_attribute_z_wave_specific_device_class_callback_set(const uic_mqtt_dotdot_basic_attribute_z_wave_specific_device_class_callback_t callback); /** diff --git a/components/uic_dotdot_mqtt/zap-generated/src/dotdot_mqtt.cpp b/components/uic_dotdot_mqtt/zap-generated/src/dotdot_mqtt.cpp index 5dbf0c607a..352a28b02c 100644 --- a/components/uic_dotdot_mqtt/zap-generated/src/dotdot_mqtt.cpp +++ b/components/uic_dotdot_mqtt/zap-generated/src/dotdot_mqtt.cpp @@ -341,6 +341,8 @@ static void uic_mqtt_dotdot_on_basic_force_read_attributes( force_update.alarm_mask = true; force_update.disable_local_config = true; force_update.sw_buildid = true; + force_update.z_wave_generic_device_class = true; + force_update.z_wave_specific_device_class = true; trigger_handler = true; } else { std::unordered_map supported_attrs = { @@ -365,6 +367,8 @@ static void uic_mqtt_dotdot_on_basic_force_read_attributes( {"AlarmMask", &force_update.alarm_mask }, {"DisableLocalConfig", &force_update.disable_local_config }, {"SWBuildID", &force_update.sw_buildid }, + {"ZWaveGenericDeviceClass", &force_update.z_wave_generic_device_class }, + {"ZWaveSpecificDeviceClass", &force_update.z_wave_specific_device_class }, }; for (auto& attribute : attributes) { @@ -1832,6 +1836,146 @@ sl_status_t uic_mqtt_dotdot_basic_sw_buildid_unretain( } // clang-format off +sl_status_t uic_mqtt_dotdot_basic_z_wave_generic_device_class_publish( + const char *base_topic, + uint8_t value, + uic_mqtt_dotdot_attribute_publish_type_t publish_type +) +{ + nlohmann::json jsn; + + // This is a single value + + if (true == uic_dotdot_has_attribute_value_a_name(0,65281,value)) { + jsn["value"] = uic_dotdot_get_attribute_value_name(0,65281,value); + }else{ + jsn["value"] = value; + } + + + std::string payload_str; + try { + // Payload contains data from end nodes, which we cannot control, thus we handle if there are non-utf8 characters + payload_str = jsn.dump(-1, ' ', false, nlohmann::detail::error_handler_t::replace); + } catch (const nlohmann::json::exception& e) { + sl_log_debug(LOG_TAG, LOG_FMT_JSON_ERROR, "Basic/Attributes/ZWaveGenericDeviceClass", e.what()); + return SL_STATUS_OK; + } + + + std::string topic = std::string(base_topic) + "/Basic/Attributes/ZWaveGenericDeviceClass"; + if (publish_type & UCL_MQTT_PUBLISH_TYPE_DESIRED) + { + std::string topic_desired = topic + "/Desired"; + uic_mqtt_publish(topic_desired.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + } + if (publish_type & UCL_MQTT_PUBLISH_TYPE_REPORTED) + { + std::string topic_reported = topic + "/Reported"; + uic_mqtt_publish(topic_reported.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + } + return SL_STATUS_OK; +} + +sl_status_t uic_mqtt_dotdot_basic_z_wave_generic_device_class_unretain( + const char *base_topic, + uic_mqtt_dotdot_attribute_publish_type_t publish_type) +{ + // clang-format on + std::string topic + = std::string(base_topic) + + "/Basic/Attributes/ZWaveGenericDeviceClass"; + + if ((publish_type == UCL_MQTT_PUBLISH_TYPE_DESIRED) + || (publish_type == UCL_MQTT_PUBLISH_TYPE_ALL)) { + std::string topic_desired = topic + "/Desired"; + uic_mqtt_publish(topic_desired.c_str(), NULL, 0, true); + } + if ((publish_type == UCL_MQTT_PUBLISH_TYPE_REPORTED) + || (publish_type == UCL_MQTT_PUBLISH_TYPE_ALL)) { + std::string topic_reported = topic + "/Reported"; + uic_mqtt_publish(topic_reported.c_str(), NULL, 0, true); + } + return SL_STATUS_OK; +} +// clang-format off + +sl_status_t uic_mqtt_dotdot_basic_z_wave_specific_device_class_publish( + const char *base_topic, + uint8_t value, + uic_mqtt_dotdot_attribute_publish_type_t publish_type +) +{ + nlohmann::json jsn; + + // This is a single value + + if (true == uic_dotdot_has_attribute_value_a_name(0,65282,value)) { + jsn["value"] = uic_dotdot_get_attribute_value_name(0,65282,value); + }else{ + jsn["value"] = value; + } + + + std::string payload_str; + try { + // Payload contains data from end nodes, which we cannot control, thus we handle if there are non-utf8 characters + payload_str = jsn.dump(-1, ' ', false, nlohmann::detail::error_handler_t::replace); + } catch (const nlohmann::json::exception& e) { + sl_log_debug(LOG_TAG, LOG_FMT_JSON_ERROR, "Basic/Attributes/ZWaveSpecificDeviceClass", e.what()); + return SL_STATUS_OK; + } + + + std::string topic = std::string(base_topic) + "/Basic/Attributes/ZWaveSpecificDeviceClass"; + if (publish_type & UCL_MQTT_PUBLISH_TYPE_DESIRED) + { + std::string topic_desired = topic + "/Desired"; + uic_mqtt_publish(topic_desired.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + } + if (publish_type & UCL_MQTT_PUBLISH_TYPE_REPORTED) + { + std::string topic_reported = topic + "/Reported"; + uic_mqtt_publish(topic_reported.c_str(), + payload_str.c_str(), + payload_str.length(), + true); + } + return SL_STATUS_OK; +} + +sl_status_t uic_mqtt_dotdot_basic_z_wave_specific_device_class_unretain( + const char *base_topic, + uic_mqtt_dotdot_attribute_publish_type_t publish_type) +{ + // clang-format on + std::string topic + = std::string(base_topic) + + "/Basic/Attributes/ZWaveSpecificDeviceClass"; + + if ((publish_type == UCL_MQTT_PUBLISH_TYPE_DESIRED) + || (publish_type == UCL_MQTT_PUBLISH_TYPE_ALL)) { + std::string topic_desired = topic + "/Desired"; + uic_mqtt_publish(topic_desired.c_str(), NULL, 0, true); + } + if ((publish_type == UCL_MQTT_PUBLISH_TYPE_REPORTED) + || (publish_type == UCL_MQTT_PUBLISH_TYPE_ALL)) { + std::string topic_reported = topic + "/Reported"; + uic_mqtt_publish(topic_reported.c_str(), NULL, 0, true); + } + return SL_STATUS_OK; +} +// clang-format off + sl_status_t uic_mqtt_dotdot_basic_init() { diff --git a/components/uic_dotdot_mqtt/zap-generated/src/dotdot_mqtt_attributes.cpp b/components/uic_dotdot_mqtt/zap-generated/src/dotdot_mqtt_attributes.cpp index 43090fc989..668bd0338c 100644 --- a/components/uic_dotdot_mqtt/zap-generated/src/dotdot_mqtt_attributes.cpp +++ b/components/uic_dotdot_mqtt/zap-generated/src/dotdot_mqtt_attributes.cpp @@ -87,6 +87,8 @@ static uic_mqtt_dotdot_basic_attribute_device_enabled_callback_t uic_mqtt_dotdot static uic_mqtt_dotdot_basic_attribute_alarm_mask_callback_t uic_mqtt_dotdot_basic_attribute_alarm_mask_callback = nullptr; static uic_mqtt_dotdot_basic_attribute_disable_local_config_callback_t uic_mqtt_dotdot_basic_attribute_disable_local_config_callback = nullptr; static uic_mqtt_dotdot_basic_attribute_sw_buildid_callback_t uic_mqtt_dotdot_basic_attribute_sw_buildid_callback = nullptr; +static uic_mqtt_dotdot_basic_attribute_z_wave_generic_device_class_callback_t uic_mqtt_dotdot_basic_attribute_z_wave_generic_device_class_callback = nullptr; +static uic_mqtt_dotdot_basic_attribute_z_wave_specific_device_class_callback_t uic_mqtt_dotdot_basic_attribute_z_wave_specific_device_class_callback = nullptr; /////////////////////////////////////////////////////////////////////////////// // Attribute update handlers for Basic @@ -1718,6 +1720,158 @@ static void uic_mqtt_dotdot_on_basic_sw_buildid_attribute_update( sw_buildid ); +} +static void uic_mqtt_dotdot_on_basic_z_wave_generic_device_class_attribute_update( + const char *topic, + const char *message, + const size_t message_length) { + if (uic_mqtt_dotdot_basic_attribute_z_wave_generic_device_class_callback == nullptr) { + return; + } + + std::string unid; + uint8_t endpoint = 0; // Default value for endpoint-less topics. + if(! uic_dotdot_mqtt::parse_topic(topic,unid,endpoint)) { + sl_log_debug(LOG_TAG, + "Error parsing UNID / Endpoint ID from topic %s. Ignoring", + topic); + return; + } + + std::string last_item; + if (SL_STATUS_OK != uic_dotdot_mqtt::get_topic_last_item(topic,last_item)){ + sl_log_debug(LOG_TAG, + "Error parsing last item from topic %s. Ignoring", + topic); + return; + } + + uic_mqtt_dotdot_attribute_update_type_t update_type; + if (last_item == "Reported") { + update_type = UCL_REPORTED_UPDATED; + } else if (last_item == "Desired") { + update_type = UCL_DESIRED_UPDATED; + } else { + sl_log_debug(LOG_TAG, + "Unknown value type (neither Desired/Reported) for topic %s. Ignoring", + topic); + return; + } + + // Empty message means unretained value. + bool unretained = false; + if (message_length == 0) { + unretained = true; + } + + + uint8_t z_wave_generic_device_class = {}; + + nlohmann::json json_payload; + try { + + if (unretained == false) { + json_payload = nlohmann::json::parse(std::string(message)); + + if (json_payload.find("value") == json_payload.end()) { + sl_log_debug(LOG_TAG, "Basic::ZWaveGenericDeviceClass: Missing attribute element: 'value'\n"); + return; + } +// Start parsing value + z_wave_generic_device_class = json_payload.at("value").get(); + + // End parsing value + } + + } catch (const std::exception& e) { + sl_log_debug(LOG_TAG, LOG_FMT_JSON_ERROR, "value", message); + return; + } + + uic_mqtt_dotdot_basic_attribute_z_wave_generic_device_class_callback( + static_cast(unid.c_str()), + endpoint, + unretained, + update_type, + z_wave_generic_device_class + ); + +} +static void uic_mqtt_dotdot_on_basic_z_wave_specific_device_class_attribute_update( + const char *topic, + const char *message, + const size_t message_length) { + if (uic_mqtt_dotdot_basic_attribute_z_wave_specific_device_class_callback == nullptr) { + return; + } + + std::string unid; + uint8_t endpoint = 0; // Default value for endpoint-less topics. + if(! uic_dotdot_mqtt::parse_topic(topic,unid,endpoint)) { + sl_log_debug(LOG_TAG, + "Error parsing UNID / Endpoint ID from topic %s. Ignoring", + topic); + return; + } + + std::string last_item; + if (SL_STATUS_OK != uic_dotdot_mqtt::get_topic_last_item(topic,last_item)){ + sl_log_debug(LOG_TAG, + "Error parsing last item from topic %s. Ignoring", + topic); + return; + } + + uic_mqtt_dotdot_attribute_update_type_t update_type; + if (last_item == "Reported") { + update_type = UCL_REPORTED_UPDATED; + } else if (last_item == "Desired") { + update_type = UCL_DESIRED_UPDATED; + } else { + sl_log_debug(LOG_TAG, + "Unknown value type (neither Desired/Reported) for topic %s. Ignoring", + topic); + return; + } + + // Empty message means unretained value. + bool unretained = false; + if (message_length == 0) { + unretained = true; + } + + + uint8_t z_wave_specific_device_class = {}; + + nlohmann::json json_payload; + try { + + if (unretained == false) { + json_payload = nlohmann::json::parse(std::string(message)); + + if (json_payload.find("value") == json_payload.end()) { + sl_log_debug(LOG_TAG, "Basic::ZWaveSpecificDeviceClass: Missing attribute element: 'value'\n"); + return; + } +// Start parsing value + z_wave_specific_device_class = json_payload.at("value").get(); + + // End parsing value + } + + } catch (const std::exception& e) { + sl_log_debug(LOG_TAG, LOG_FMT_JSON_ERROR, "value", message); + return; + } + + uic_mqtt_dotdot_basic_attribute_z_wave_specific_device_class_callback( + static_cast(unid.c_str()), + endpoint, + unretained, + update_type, + z_wave_specific_device_class + ); + } /////////////////////////////////////////////////////////////////////////////// @@ -1812,6 +1966,14 @@ sl_status_t uic_mqtt_dotdot_basic_attributes_init() subscription_topic = base_topic + "Basic/Attributes/SWBuildID/#"; uic_mqtt_subscribe(subscription_topic.c_str(), &uic_mqtt_dotdot_on_basic_sw_buildid_attribute_update); } + if(uic_mqtt_dotdot_basic_attribute_z_wave_generic_device_class_callback) { + subscription_topic = base_topic + "Basic/Attributes/ZWaveGenericDeviceClass/#"; + uic_mqtt_subscribe(subscription_topic.c_str(), &uic_mqtt_dotdot_on_basic_z_wave_generic_device_class_attribute_update); + } + if(uic_mqtt_dotdot_basic_attribute_z_wave_specific_device_class_callback) { + subscription_topic = base_topic + "Basic/Attributes/ZWaveSpecificDeviceClass/#"; + uic_mqtt_subscribe(subscription_topic.c_str(), &uic_mqtt_dotdot_on_basic_z_wave_specific_device_class_attribute_update); + } return SL_STATUS_OK; } @@ -1904,6 +2066,14 @@ void uic_mqtt_dotdot_basic_attribute_sw_buildid_callback_set(const uic_mqtt_dotd { uic_mqtt_dotdot_basic_attribute_sw_buildid_callback = callback; } +void uic_mqtt_dotdot_basic_attribute_z_wave_generic_device_class_callback_set(const uic_mqtt_dotdot_basic_attribute_z_wave_generic_device_class_callback_t callback) +{ + uic_mqtt_dotdot_basic_attribute_z_wave_generic_device_class_callback = callback; +} +void uic_mqtt_dotdot_basic_attribute_z_wave_specific_device_class_callback_set(const uic_mqtt_dotdot_basic_attribute_z_wave_specific_device_class_callback_t callback) +{ + uic_mqtt_dotdot_basic_attribute_z_wave_specific_device_class_callback = callback; +} // End of supported cluster. diff --git a/components/uic_dotdot_mqtt/zap-generated/src/dotdot_mqtt_helpers.cpp b/components/uic_dotdot_mqtt/zap-generated/src/dotdot_mqtt_helpers.cpp index e777d585ab..6f09a675a9 100644 --- a/components/uic_dotdot_mqtt/zap-generated/src/dotdot_mqtt_helpers.cpp +++ b/components/uic_dotdot_mqtt/zap-generated/src/dotdot_mqtt_helpers.cpp @@ -5577,6 +5577,18 @@ std::string get_enum_value_name( return basic_sw_buildid_get_enum_value_name(value); } #endif + #ifdef BASIC_Z_WAVE_GENERIC_DEVICE_CLASS_ENUM_NAME_AVAILABLE + if (65281 == attribute_id) { + // FIXME: Some attributes don't work because multi-upper case names end up like this: basicz_wave_generic_device_class instead of this: basic_z_wave_generic_device_class + return basic_z_wave_generic_device_class_get_enum_value_name(value); + } + #endif + #ifdef BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS_ENUM_NAME_AVAILABLE + if (65282 == attribute_id) { + // FIXME: Some attributes don't work because multi-upper case names end up like this: basicz_wave_specific_device_class instead of this: basic_z_wave_specific_device_class + return basic_z_wave_specific_device_class_get_enum_value_name(value); + } + #endif } if (1 == cluster_id) { @@ -10045,6 +10057,18 @@ uint32_t get_enum_name_value( return basic_sw_buildid_get_enum_value_number(name); } #endif + #ifdef BASIC_Z_WAVE_GENERIC_DEVICE_CLASS_ENUM_NAME_AVAILABLE + if (65281 == attribute_id) { + // FIXME: Some attributes don't work because multi-upper case names end up like this: basicz_wave_generic_device_class instead of this: basic_z_wave_generic_device_class + return basic_z_wave_generic_device_class_get_enum_value_number(name); + } + #endif + #ifdef BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS_ENUM_NAME_AVAILABLE + if (65282 == attribute_id) { + // FIXME: Some attributes don't work because multi-upper case names end up like this: basicz_wave_specific_device_class instead of this: basic_z_wave_specific_device_class + return basic_z_wave_specific_device_class_get_enum_value_number(name); + } + #endif } if (1 == cluster_id) { diff --git a/components/unify_dotdot_attribute_store/zap-generated/include/dotdot_attributes.uam b/components/unify_dotdot_attribute_store/zap-generated/include/dotdot_attributes.uam index 88967fac0a..6db5db273c 100644 --- a/components/unify_dotdot_attribute_store/zap-generated/include/dotdot_attributes.uam +++ b/components/unify_dotdot_attribute_store/zap-generated/include/dotdot_attributes.uam @@ -21,6 +21,8 @@ def DOTDOT_ATTRIBUTE_ID_BASIC_DEVICE_ENABLED 0xba5c0012 def DOTDOT_ATTRIBUTE_ID_BASIC_ALARM_MASK 0xba5c0013 def DOTDOT_ATTRIBUTE_ID_BASIC_DISABLE_LOCAL_CONFIG 0xba5c0014 def DOTDOT_ATTRIBUTE_ID_BASIC_SW_BUILDID 0xba5c4000 +def DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS 0xba5cff01 +def DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS 0xba5cff02 // This represents the attributes in the DotDot PowerConfiguration cluster def DOTDOT_ATTRIBUTE_ID_POWER_CONFIGURATION_MAINS_VOLTAGE 0x00010000 diff --git a/components/unify_dotdot_attribute_store/zap-generated/include/dotdot_attributes_camel_case.uam b/components/unify_dotdot_attribute_store/zap-generated/include/dotdot_attributes_camel_case.uam index c4ef2c208c..9e23bf3d65 100644 --- a/components/unify_dotdot_attribute_store/zap-generated/include/dotdot_attributes_camel_case.uam +++ b/components/unify_dotdot_attribute_store/zap-generated/include/dotdot_attributes_camel_case.uam @@ -21,6 +21,8 @@ def zb_DeviceEnabled 0xba5c0012 def zb_AlarmMask 0xba5c0013 def zb_DisableLocalConfig 0xba5c0014 def zb_SWBuildID 0xba5c4000 +def zb_ZWaveGenericDeviceClass 0xba5cff01 +def zb_ZWaveSpecificDeviceClass 0xba5cff02 // This represents short CamelCase labels the attributes in the DotDot PowerConfiguration cluster def zb_MainsVoltage 0x00010000 diff --git a/components/unify_dotdot_attribute_store/zap-generated/include/unify_dotdot_attribute_store_helpers.h b/components/unify_dotdot_attribute_store/zap-generated/include/unify_dotdot_attribute_store_helpers.h index 16d75f051f..1a5cd3b73d 100644 --- a/components/unify_dotdot_attribute_store/zap-generated/include/unify_dotdot_attribute_store_helpers.h +++ b/components/unify_dotdot_attribute_store/zap-generated/include/unify_dotdot_attribute_store_helpers.h @@ -2294,6 +2294,218 @@ bool dotdot_basic_sw_buildid_is_desired_defined( sl_status_t dotdot_create_basic_sw_buildid( const dotdot_unid_t unid, const dotdot_endpoint_id_t endpoint_id); +// Basic ZWaveGenericDeviceClass +/** + * @brief Verifies if the DotDot Basic - ZWaveGenericDeviceClass is supported + * under a UNID/EndpoinID + * + * @param unid Node's UNID + * @param endpoint_id Endpoint ID + * + * @returns true if ZWaveGenericDeviceClass is supported + * @returns false if ZWaveGenericDeviceClass is not supported + */ +bool dotdot_is_supported_basic_z_wave_generic_device_class ( + const dotdot_unid_t unid, const dotdot_endpoint_id_t endpoint_id); + +/** + * @brief Gets the DotDot Basic - ZWaveGenericDeviceClass attribute value under a UNID/EndpoinID + * + * @param unid Node's UNID + * @param endpoint_id Endpoint ID + * @param value_state value state to get, + * see \ref attribute_store_get_node_attribute_value + * + * + * @returns ZWaveGenericDeviceClass attribute + */ +uint8_t dotdot_get_basic_z_wave_generic_device_class( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id, + attribute_store_node_value_state_t value_state); + +/** + * @brief Set the DotDot Basic - ZWaveGenericDeviceClass attribute under a UNID/EndpoinID + * + * @param unid Node's UNID + * @param endpoint_id Endpoint ID + * @param value_state value state to write for the node, + * see \ref attribute_store_set_node_attribute_value + * + * @param new_z_wave_generic_device_class new value to set + * @returns sl_status_t SL_STATUS_OK on success + */ +sl_status_t dotdot_set_basic_z_wave_generic_device_class( + const dotdot_unid_t unid, + dotdot_endpoint_id_t endpoint_id, + attribute_store_node_value_state_t value_state, + uint8_t new_z_wave_generic_device_class + ); + +/** + * @brief Undefines the Reported value of the the DotDot Basic - ZWaveGenericDeviceClass + * attribute under a UNID/EndpoinID + * + * @param unid Node's UNID + * @param endpoint_id Endpoint ID + * @returns sl_status_t SL_STATUS_OK on success + */ +sl_status_t dotdot_basic_z_wave_generic_device_class_undefine_reported( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id); + +/** + * @brief Undefines the Desired value of the DotDot + * Basic - ZWaveGenericDeviceClass attribute under a UNID/EndpointID + * + * @param unid Node's UNID + * @param endpoint_id Endpoint ID + * @returns sl_status_t SL_STATUS_OK on success + */ +sl_status_t dotdot_basic_z_wave_generic_device_class_undefine_desired( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id); + +/** + * @brief Checks if the reported value is defined for the DotDot + * Basic - ZWaveGenericDeviceClass attribute under a UNID/EndpointID + * + * @param unid Node's UNID + * @param endpoint_id Endpoint ID + * @returns true if defined, false is undefined or non-existent + */ +bool dotdot_basic_z_wave_generic_device_class_is_reported_defined( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id); + +/** + * @brief Checks if the desired value is defined for the DotDot + * Basic - ZWaveGenericDeviceClass attribute under a UNID/EndpointID + * + * @param unid Node's UNID + * @param endpoint_id Endpoint ID + * @returns true if defined, false is undefined or non-existent + */ +bool dotdot_basic_z_wave_generic_device_class_is_desired_defined( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id); + +/** + * @brief Creates a DotDot Basic - ZWaveGenericDeviceClass attribute under a UNID/EndpoinID + * + * @param unid Node's UNID + * @param endpoint_id Endpoint ID + * @returns sl_status_t SL_STATUS_OK on success + */ +sl_status_t dotdot_create_basic_z_wave_generic_device_class( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id); +// Basic ZWaveSpecificDeviceClass +/** + * @brief Verifies if the DotDot Basic - ZWaveSpecificDeviceClass is supported + * under a UNID/EndpoinID + * + * @param unid Node's UNID + * @param endpoint_id Endpoint ID + * + * @returns true if ZWaveSpecificDeviceClass is supported + * @returns false if ZWaveSpecificDeviceClass is not supported + */ +bool dotdot_is_supported_basic_z_wave_specific_device_class ( + const dotdot_unid_t unid, const dotdot_endpoint_id_t endpoint_id); + +/** + * @brief Gets the DotDot Basic - ZWaveSpecificDeviceClass attribute value under a UNID/EndpoinID + * + * @param unid Node's UNID + * @param endpoint_id Endpoint ID + * @param value_state value state to get, + * see \ref attribute_store_get_node_attribute_value + * + * + * @returns ZWaveSpecificDeviceClass attribute + */ +uint8_t dotdot_get_basic_z_wave_specific_device_class( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id, + attribute_store_node_value_state_t value_state); + +/** + * @brief Set the DotDot Basic - ZWaveSpecificDeviceClass attribute under a UNID/EndpoinID + * + * @param unid Node's UNID + * @param endpoint_id Endpoint ID + * @param value_state value state to write for the node, + * see \ref attribute_store_set_node_attribute_value + * + * @param new_z_wave_specific_device_class new value to set + * @returns sl_status_t SL_STATUS_OK on success + */ +sl_status_t dotdot_set_basic_z_wave_specific_device_class( + const dotdot_unid_t unid, + dotdot_endpoint_id_t endpoint_id, + attribute_store_node_value_state_t value_state, + uint8_t new_z_wave_specific_device_class + ); + +/** + * @brief Undefines the Reported value of the the DotDot Basic - ZWaveSpecificDeviceClass + * attribute under a UNID/EndpoinID + * + * @param unid Node's UNID + * @param endpoint_id Endpoint ID + * @returns sl_status_t SL_STATUS_OK on success + */ +sl_status_t dotdot_basic_z_wave_specific_device_class_undefine_reported( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id); + +/** + * @brief Undefines the Desired value of the DotDot + * Basic - ZWaveSpecificDeviceClass attribute under a UNID/EndpointID + * + * @param unid Node's UNID + * @param endpoint_id Endpoint ID + * @returns sl_status_t SL_STATUS_OK on success + */ +sl_status_t dotdot_basic_z_wave_specific_device_class_undefine_desired( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id); + +/** + * @brief Checks if the reported value is defined for the DotDot + * Basic - ZWaveSpecificDeviceClass attribute under a UNID/EndpointID + * + * @param unid Node's UNID + * @param endpoint_id Endpoint ID + * @returns true if defined, false is undefined or non-existent + */ +bool dotdot_basic_z_wave_specific_device_class_is_reported_defined( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id); + +/** + * @brief Checks if the desired value is defined for the DotDot + * Basic - ZWaveSpecificDeviceClass attribute under a UNID/EndpointID + * + * @param unid Node's UNID + * @param endpoint_id Endpoint ID + * @returns true if defined, false is undefined or non-existent + */ +bool dotdot_basic_z_wave_specific_device_class_is_desired_defined( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id); + +/** + * @brief Creates a DotDot Basic - ZWaveSpecificDeviceClass attribute under a UNID/EndpoinID + * + * @param unid Node's UNID + * @param endpoint_id Endpoint ID + * @returns sl_status_t SL_STATUS_OK on success + */ +sl_status_t dotdot_create_basic_z_wave_specific_device_class( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id); /** * @brief Checks if a UNID/Endpoint supports any attribute for the Basic diff --git a/components/unify_dotdot_attribute_store/zap-generated/include/unify_dotdot_defined_attribute_types.h b/components/unify_dotdot_attribute_store/zap-generated/include/unify_dotdot_defined_attribute_types.h index 0118d5ba2d..ea7351cda9 100644 --- a/components/unify_dotdot_attribute_store/zap-generated/include/unify_dotdot_defined_attribute_types.h +++ b/components/unify_dotdot_attribute_store/zap-generated/include/unify_dotdot_defined_attribute_types.h @@ -47,6 +47,8 @@ DEFINE_ATTRIBUTE(DOTDOT_ATTRIBUTE_ID_BASIC_DEVICE_ENABLED , 0xba5c0012) DEFINE_ATTRIBUTE(DOTDOT_ATTRIBUTE_ID_BASIC_ALARM_MASK , 0xba5c0013) DEFINE_ATTRIBUTE(DOTDOT_ATTRIBUTE_ID_BASIC_DISABLE_LOCAL_CONFIG , 0xba5c0014) DEFINE_ATTRIBUTE(DOTDOT_ATTRIBUTE_ID_BASIC_SW_BUILDID , 0xba5c4000) +DEFINE_ATTRIBUTE(DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS , 0xba5cff01) +DEFINE_ATTRIBUTE(DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS , 0xba5cff02) // Attribute Defines for PowerConfiguration DEFINE_ATTRIBUTE(DOTDOT_ATTRIBUTE_ID_POWER_CONFIGURATION_MAINS_VOLTAGE , 0x00010000) DEFINE_ATTRIBUTE(DOTDOT_ATTRIBUTE_ID_POWER_CONFIGURATION_MAINS_FREQUENCY , 0x00010001) diff --git a/components/unify_dotdot_attribute_store/zap-generated/src/unify_dotdot_attribute_store_attribute_publisher.cpp b/components/unify_dotdot_attribute_store/zap-generated/src/unify_dotdot_attribute_store_attribute_publisher.cpp index 2aba63453d..aafa719eaa 100644 --- a/components/unify_dotdot_attribute_store/zap-generated/src/unify_dotdot_attribute_store_attribute_publisher.cpp +++ b/components/unify_dotdot_attribute_store/zap-generated/src/unify_dotdot_attribute_store_attribute_publisher.cpp @@ -251,6 +251,20 @@ static void basic_cluster_publish_desired_value_callback( static_cast(str_desired.data()), UCL_MQTT_PUBLISH_TYPE_DESIRED); return; + } + if (type == DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS) { + uic_mqtt_dotdot_basic_z_wave_generic_device_class_publish( + base_topic.c_str(), + static_cast(attr.desired_or_reported()), + UCL_MQTT_PUBLISH_TYPE_DESIRED); + return; + } + if (type == DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS) { + uic_mqtt_dotdot_basic_z_wave_specific_device_class_publish( + base_topic.c_str(), + static_cast(attr.desired_or_reported()), + UCL_MQTT_PUBLISH_TYPE_DESIRED); + return; } } catch (std::exception &ex) { sl_log_warning(LOG_TAG, "Failed to publish the Desired attribute value: %s", ex.what()); @@ -481,6 +495,22 @@ static void basic_cluster_publish_reported_value_callback( // clang-format off uic_mqtt_dotdot_basic_sw_buildid_unretain(base_topic.c_str(), UCL_MQTT_PUBLISH_TYPE_ALL); break; + case DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS: + // clang-format on + sl_log_debug(LOG_TAG, + "Unretaining Basic::ZWaveGenericDeviceClass under topic %s", + base_topic.c_str()); + // clang-format off + uic_mqtt_dotdot_basic_z_wave_generic_device_class_unretain(base_topic.c_str(), UCL_MQTT_PUBLISH_TYPE_ALL); + break; + case DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS: + // clang-format on + sl_log_debug(LOG_TAG, + "Unretaining Basic::ZWaveSpecificDeviceClass under topic %s", + base_topic.c_str()); + // clang-format off + uic_mqtt_dotdot_basic_z_wave_specific_device_class_unretain(base_topic.c_str(), UCL_MQTT_PUBLISH_TYPE_ALL); + break; default: break; } @@ -654,6 +684,20 @@ static void basic_cluster_publish_reported_value_callback( static_cast( str_desired.data() ), (attr.desired_exists() && !attribute_store_is_value_matched(updated_node)) ? UCL_MQTT_PUBLISH_TYPE_REPORTED : UCL_MQTT_PUBLISH_TYPE_ALL); return; + } + if (type == DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS) { + uic_mqtt_dotdot_basic_z_wave_generic_device_class_publish( + base_topic.c_str(), + static_cast(attr.reported()), + (attr.desired_exists() && !attribute_store_is_value_matched(updated_node)) ? UCL_MQTT_PUBLISH_TYPE_REPORTED : UCL_MQTT_PUBLISH_TYPE_ALL); + return; + } + if (type == DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS) { + uic_mqtt_dotdot_basic_z_wave_specific_device_class_publish( + base_topic.c_str(), + static_cast(attr.reported()), + (attr.desired_exists() && !attribute_store_is_value_matched(updated_node)) ? UCL_MQTT_PUBLISH_TYPE_REPORTED : UCL_MQTT_PUBLISH_TYPE_ALL); + return; } } catch (std::exception &ex) { sl_log_warning(LOG_TAG, "Failed to publish the Reported attribute value: %s", ex.what()); @@ -25932,6 +25976,34 @@ sl_status_t unify_dotdot_attribute_store_attribute_publisher_init() basic_cluster_cluster_revision_callback, DOTDOT_ATTRIBUTE_ID_BASIC_SW_BUILDID); //Desired attribute state + attribute_store_register_callback_by_type_and_state( + basic_cluster_publish_desired_value_callback, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS, + DESIRED_ATTRIBUTE); + //Reported attribute state + attribute_store_register_callback_by_type_and_state( + basic_cluster_publish_reported_value_callback, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS, + REPORTED_ATTRIBUTE); + //registering a callback when an attribute is created for publishing cluster revision + attribute_store_register_callback_by_type( + basic_cluster_cluster_revision_callback, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS); + //Desired attribute state + attribute_store_register_callback_by_type_and_state( + basic_cluster_publish_desired_value_callback, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS, + DESIRED_ATTRIBUTE); + //Reported attribute state + attribute_store_register_callback_by_type_and_state( + basic_cluster_publish_reported_value_callback, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS, + REPORTED_ATTRIBUTE); + //registering a callback when an attribute is created for publishing cluster revision + attribute_store_register_callback_by_type( + basic_cluster_cluster_revision_callback, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS); + //Desired attribute state attribute_store_register_callback_by_type_and_state( power_configuration_cluster_publish_desired_value_callback, DOTDOT_ATTRIBUTE_ID_POWER_CONFIGURATION_MAINS_VOLTAGE, diff --git a/components/unify_dotdot_attribute_store/zap-generated/src/unify_dotdot_attribute_store_force_read_attributes_command_callbacks.c b/components/unify_dotdot_attribute_store/zap-generated/src/unify_dotdot_attribute_store_force_read_attributes_command_callbacks.c index 5d488fb5a1..cd79420dd6 100644 --- a/components/unify_dotdot_attribute_store/zap-generated/src/unify_dotdot_attribute_store_force_read_attributes_command_callbacks.c +++ b/components/unify_dotdot_attribute_store/zap-generated/src/unify_dotdot_attribute_store_force_read_attributes_command_callbacks.c @@ -157,6 +157,16 @@ static sl_status_t uic_mqtt_dotdot_basic_force_read_attributes_callback ( sl_log_debug(LOG_TAG, "Undefined Reported value of Basic::SWBuildID under %s - Endpoint %d", unid, endpoint_id); } } + if (true == attribute_list.z_wave_generic_device_class) { + if (SL_STATUS_OK == dotdot_basic_z_wave_generic_device_class_undefine_reported(unid, endpoint_id)) { + sl_log_debug(LOG_TAG, "Undefined Reported value of Basic::ZWaveGenericDeviceClass under %s - Endpoint %d", unid, endpoint_id); + } + } + if (true == attribute_list.z_wave_specific_device_class) { + if (SL_STATUS_OK == dotdot_basic_z_wave_specific_device_class_undefine_reported(unid, endpoint_id)) { + sl_log_debug(LOG_TAG, "Undefined Reported value of Basic::ZWaveSpecificDeviceClass under %s - Endpoint %d", unid, endpoint_id); + } + } return SL_STATUS_OK; } //////////////////////////////////////////////////////////////////////////////// diff --git a/components/unify_dotdot_attribute_store/zap-generated/src/unify_dotdot_attribute_store_helpers.cpp b/components/unify_dotdot_attribute_store/zap-generated/src/unify_dotdot_attribute_store_helpers.cpp index e170bb45b1..ee1a1694ca 100644 --- a/components/unify_dotdot_attribute_store/zap-generated/src/unify_dotdot_attribute_store_helpers.cpp +++ b/components/unify_dotdot_attribute_store/zap-generated/src/unify_dotdot_attribute_store_helpers.cpp @@ -2370,6 +2370,228 @@ sl_status_t dotdot_create_basic_sw_buildid( return (node != ATTRIBUTE_STORE_INVALID_NODE) ? SL_STATUS_OK : SL_STATUS_FAIL; } +bool dotdot_is_supported_basic_z_wave_generic_device_class( + const dotdot_unid_t unid, const dotdot_endpoint_id_t endpoint_id) +{ + attribute_store_node_t endpoint_node = unify_dotdot_attributes_get_endpoint_node()(unid, endpoint_id); + attribute_store_node_t node + = attribute_store_get_first_child_by_type( + endpoint_node, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS); + return attribute_store_node_exists(node); +} + +uint8_t dotdot_get_basic_z_wave_generic_device_class( + const dotdot_unid_t unid, + dotdot_endpoint_id_t endpoint_id, + attribute_store_node_value_state_t value_state) +{ + attribute_store_node_t endpoint_node = unify_dotdot_attributes_get_endpoint_node()(unid, endpoint_id); + attribute_store_node_t node + = attribute_store_get_first_child_by_type( + endpoint_node, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS); + + uint8_t result = {}; + attribute_store_read_value(node, + value_state, + (uint8_t *)&result, + sizeof(result)); + return result; +} + +sl_status_t dotdot_set_basic_z_wave_generic_device_class( + const dotdot_unid_t unid, + dotdot_endpoint_id_t endpoint_id, + attribute_store_node_value_state_t value_state, + uint8_t new_z_wave_generic_device_class + ) +{ + attribute_store_node_t endpoint_node = unify_dotdot_attributes_get_endpoint_node()(unid, endpoint_id); + + attribute_store_node_t node + = attribute_store_get_first_child_by_type( + endpoint_node, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS); + + return attribute_store_set_node_attribute_value(node, + value_state, + (uint8_t *)&new_z_wave_generic_device_class, + sizeof(uint8_t)); + } + +sl_status_t dotdot_basic_z_wave_generic_device_class_undefine_reported( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id) { + attribute_store_node_t endpoint_node = unify_dotdot_attributes_get_endpoint_node()(unid, endpoint_id); + attribute_store_node_t node + = attribute_store_get_first_child_by_type( + endpoint_node, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS); + attribute_store_undefine_reported(node); + return (node != ATTRIBUTE_STORE_INVALID_NODE) ? SL_STATUS_OK : SL_STATUS_FAIL; +} + +sl_status_t dotdot_basic_z_wave_generic_device_class_undefine_desired( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id) { + + attribute_store_node_t endpoint_node = unify_dotdot_attributes_get_endpoint_node()(unid, endpoint_id); + attribute_store_node_t node + = attribute_store_get_first_child_by_type( + endpoint_node, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS); + attribute_store_undefine_desired(node); + return (node != ATTRIBUTE_STORE_INVALID_NODE) ? SL_STATUS_OK : SL_STATUS_FAIL; +} + + +bool dotdot_basic_z_wave_generic_device_class_is_reported_defined( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id) +{ + attribute_store_node_t endpoint_node = unify_dotdot_attributes_get_endpoint_node()(unid, endpoint_id); + attribute_store_node_t node + = attribute_store_get_first_child_by_type( + endpoint_node, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS); + return attribute_store_is_reported_defined(node); +} + +bool dotdot_basic_z_wave_generic_device_class_is_desired_defined( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id) +{ + attribute_store_node_t endpoint_node = unify_dotdot_attributes_get_endpoint_node()(unid, endpoint_id); + attribute_store_node_t node + = attribute_store_get_first_child_by_type( + endpoint_node, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS); + return attribute_store_is_desired_defined(node); +} + +sl_status_t dotdot_create_basic_z_wave_generic_device_class( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id) { + + attribute_store_node_t endpoint_node = unify_dotdot_attributes_get_endpoint_node()(unid, endpoint_id); + attribute_store_node_t node = + attribute_store_create_child_if_missing(endpoint_node, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS); + + return (node != ATTRIBUTE_STORE_INVALID_NODE) ? SL_STATUS_OK : SL_STATUS_FAIL; +} +bool dotdot_is_supported_basic_z_wave_specific_device_class( + const dotdot_unid_t unid, const dotdot_endpoint_id_t endpoint_id) +{ + attribute_store_node_t endpoint_node = unify_dotdot_attributes_get_endpoint_node()(unid, endpoint_id); + attribute_store_node_t node + = attribute_store_get_first_child_by_type( + endpoint_node, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS); + return attribute_store_node_exists(node); +} + +uint8_t dotdot_get_basic_z_wave_specific_device_class( + const dotdot_unid_t unid, + dotdot_endpoint_id_t endpoint_id, + attribute_store_node_value_state_t value_state) +{ + attribute_store_node_t endpoint_node = unify_dotdot_attributes_get_endpoint_node()(unid, endpoint_id); + attribute_store_node_t node + = attribute_store_get_first_child_by_type( + endpoint_node, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS); + + uint8_t result = {}; + attribute_store_read_value(node, + value_state, + (uint8_t *)&result, + sizeof(result)); + return result; +} + +sl_status_t dotdot_set_basic_z_wave_specific_device_class( + const dotdot_unid_t unid, + dotdot_endpoint_id_t endpoint_id, + attribute_store_node_value_state_t value_state, + uint8_t new_z_wave_specific_device_class + ) +{ + attribute_store_node_t endpoint_node = unify_dotdot_attributes_get_endpoint_node()(unid, endpoint_id); + + attribute_store_node_t node + = attribute_store_get_first_child_by_type( + endpoint_node, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS); + + return attribute_store_set_node_attribute_value(node, + value_state, + (uint8_t *)&new_z_wave_specific_device_class, + sizeof(uint8_t)); + } + +sl_status_t dotdot_basic_z_wave_specific_device_class_undefine_reported( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id) { + attribute_store_node_t endpoint_node = unify_dotdot_attributes_get_endpoint_node()(unid, endpoint_id); + attribute_store_node_t node + = attribute_store_get_first_child_by_type( + endpoint_node, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS); + attribute_store_undefine_reported(node); + return (node != ATTRIBUTE_STORE_INVALID_NODE) ? SL_STATUS_OK : SL_STATUS_FAIL; +} + +sl_status_t dotdot_basic_z_wave_specific_device_class_undefine_desired( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id) { + + attribute_store_node_t endpoint_node = unify_dotdot_attributes_get_endpoint_node()(unid, endpoint_id); + attribute_store_node_t node + = attribute_store_get_first_child_by_type( + endpoint_node, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS); + attribute_store_undefine_desired(node); + return (node != ATTRIBUTE_STORE_INVALID_NODE) ? SL_STATUS_OK : SL_STATUS_FAIL; +} + + +bool dotdot_basic_z_wave_specific_device_class_is_reported_defined( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id) +{ + attribute_store_node_t endpoint_node = unify_dotdot_attributes_get_endpoint_node()(unid, endpoint_id); + attribute_store_node_t node + = attribute_store_get_first_child_by_type( + endpoint_node, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS); + return attribute_store_is_reported_defined(node); +} + +bool dotdot_basic_z_wave_specific_device_class_is_desired_defined( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id) +{ + attribute_store_node_t endpoint_node = unify_dotdot_attributes_get_endpoint_node()(unid, endpoint_id); + attribute_store_node_t node + = attribute_store_get_first_child_by_type( + endpoint_node, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS); + return attribute_store_is_desired_defined(node); +} + +sl_status_t dotdot_create_basic_z_wave_specific_device_class( + const dotdot_unid_t unid, + const dotdot_endpoint_id_t endpoint_id) { + + attribute_store_node_t endpoint_node = unify_dotdot_attributes_get_endpoint_node()(unid, endpoint_id); + attribute_store_node_t node = + attribute_store_create_child_if_missing(endpoint_node, + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS); + + return (node != ATTRIBUTE_STORE_INVALID_NODE) ? SL_STATUS_OK : SL_STATUS_FAIL; +} bool dotdot_is_any_basic_attribute_supported( const dotdot_unid_t unid, @@ -2438,6 +2660,12 @@ bool dotdot_is_any_basic_attribute_supported( if (true == dotdot_is_supported_basic_sw_buildid(unid, endpoint_id)) { return true; } + if (true == dotdot_is_supported_basic_z_wave_generic_device_class(unid, endpoint_id)) { + return true; + } + if (true == dotdot_is_supported_basic_z_wave_specific_device_class(unid, endpoint_id)) { + return true; + } return false; } diff --git a/components/unify_dotdot_attribute_store/zap-generated/src/unify_dotdot_attribute_store_registration.cpp b/components/unify_dotdot_attribute_store/zap-generated/src/unify_dotdot_attribute_store_registration.cpp index 0423e9305d..e4360ab086 100644 --- a/components/unify_dotdot_attribute_store/zap-generated/src/unify_dotdot_attribute_store_registration.cpp +++ b/components/unify_dotdot_attribute_store/zap-generated/src/unify_dotdot_attribute_store_registration.cpp @@ -607,6 +607,54 @@ sl_status_t unify_dotdot_attribute_store_registration_init() // clang-format off // clang-format on + { + // uint8 // uint8 // uint8_t + std::string attribute_type_string = "uint8_t"; + attribute_store_storage_type_t storage_type = UNKNOWN_STORAGE_TYPE; + + // clang-format off + storage_type = attribute_storage_type_conversion(attribute_type_string); + + if (storage_type == UNKNOWN_STORAGE_TYPE) { + sl_log_warning(LOG_TAG, + "Unkown storage type for ZCL Basic ZWaveGenericDeviceClass, " + "type: uint8 // uint8_t"); + } + + status |= attribute_store_register_type( + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_GENERIC_DEVICE_CLASS, + "ZCL Basic ZWaveGenericDeviceClass", + ATTRIBUTE_STORE_INVALID_ATTRIBUTE_TYPE, + storage_type); + } + + // clang-format off + // clang-format on + + { + // uint8 // uint8 // uint8_t + std::string attribute_type_string = "uint8_t"; + attribute_store_storage_type_t storage_type = UNKNOWN_STORAGE_TYPE; + + // clang-format off + storage_type = attribute_storage_type_conversion(attribute_type_string); + + if (storage_type == UNKNOWN_STORAGE_TYPE) { + sl_log_warning(LOG_TAG, + "Unkown storage type for ZCL Basic ZWaveSpecificDeviceClass, " + "type: uint8 // uint8_t"); + } + + status |= attribute_store_register_type( + DOTDOT_ATTRIBUTE_ID_BASIC_Z_WAVE_SPECIFIC_DEVICE_CLASS, + "ZCL Basic ZWaveSpecificDeviceClass", + ATTRIBUTE_STORE_INVALID_ATTRIBUTE_TYPE, + storage_type); + } + + // clang-format off + // clang-format on + { // uint16 // uint16 // uint16_t std::string attribute_type_string = "uint16_t"; diff --git a/components/unify_dotdot_attribute_store/zap-generated/test/unify_dotdot_attribute_store_test.c b/components/unify_dotdot_attribute_store/zap-generated/test/unify_dotdot_attribute_store_test.c index fda0a48f1a..ab0e7f71a3 100644 --- a/components/unify_dotdot_attribute_store/zap-generated/test/unify_dotdot_attribute_store_test.c +++ b/components/unify_dotdot_attribute_store/zap-generated/test/unify_dotdot_attribute_store_test.c @@ -3864,6 +3864,8 @@ void test_automatic_deduction_of_supported_commands() TEST_ASSERT_EQUAL(SL_STATUS_OK, dotdot_create_basic_alarm_mask(expected_unid,expected_endpoint_id) ); TEST_ASSERT_EQUAL(SL_STATUS_OK, dotdot_create_basic_disable_local_config(expected_unid,expected_endpoint_id) ); TEST_ASSERT_EQUAL(SL_STATUS_OK, dotdot_create_basic_sw_buildid(expected_unid,expected_endpoint_id) ); + TEST_ASSERT_EQUAL(SL_STATUS_OK, dotdot_create_basic_z_wave_generic_device_class(expected_unid,expected_endpoint_id) ); + TEST_ASSERT_EQUAL(SL_STATUS_OK, dotdot_create_basic_z_wave_specific_device_class(expected_unid,expected_endpoint_id) ); TEST_ASSERT_EQUAL(SL_STATUS_OK, dotdot_create_power_configuration_mains_voltage(expected_unid,expected_endpoint_id) ); TEST_ASSERT_EQUAL(SL_STATUS_OK, dotdot_create_power_configuration_mains_frequency(expected_unid,expected_endpoint_id) ); TEST_ASSERT_EQUAL(SL_STATUS_OK, dotdot_create_power_configuration_mains_alarm_mask(expected_unid,expected_endpoint_id) );