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

GH-34: Expose Z-Wave Generic and Specific Device Class #35

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/*****************************************************************
Expand Down
14 changes: 14 additions & 0 deletions applications/zpc/components/dotdot_mapper/rules/Basic.uam
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions components/uic_dotdot/dotdot-xml/Basic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ applicable to this document can be found in the LICENSE.md file.
<type:maxLength value="16" />
</restriction>
</attribute>
<attribute id="FF01" name="ZWaveGenericDeviceClass" type="uint8"/>
<attribute id="FF02" name="ZWaveSpecificDeviceClass" type="uint8"/>
</attributes>
<commands>
<command id="00" name="ResetToFactoryDefaults" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
92 changes: 91 additions & 1 deletion components/uic_dotdot/zap-generated/readme_ucl_mqtt_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,94 @@ ucl/by-unid/<UNID>/ep0/Basic/Attributes/SWBuildID/Reported { "value": <REPORTED_

<br><br>

\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/<UNID>/ep0/Basic/Attributes/ZWaveGenericDeviceClass/Desired { "value": <DESIRED_Z_WAVE_GENERIC_DEVICE_CLASS>}
ucl/by-unid/<UNID>/ep0/Basic/Attributes/ZWaveGenericDeviceClass/Reported { "value": <REPORTED_Z_WAVE_GENERIC_DEVICE_CLASS>}

```

<br><br>

\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/<UNID>/ep0/Basic/Attributes/ZWaveSpecificDeviceClass/Desired { "value": <DESIRED_Z_WAVE_SPECIFIC_DEVICE_CLASS>}
ucl/by-unid/<UNID>/ep0/Basic/Attributes/ZWaveSpecificDeviceClass/Reported { "value": <REPORTED_Z_WAVE_SPECIFIC_DEVICE_CLASS>}

```

<br><br>


\subsection basic_attr_cluster_revision Basic/ClusterRevision Attribute

Expand Down Expand Up @@ -1202,7 +1290,9 @@ mosquitto_pub -t 'ucl/by-unid/<UNID>/<EP>/Basic/Commands/WriteAttributes' -m '{
"DeviceEnabled",
"AlarmMask",
"DisableLocalConfig",
"SWBuildID"
"SWBuildID",
"ZWaveGenericDeviceClass",
"ZWaveSpecificDeviceClass"
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down
64 changes: 64 additions & 0 deletions components/uic_dotdot_mqtt/zap-generated/include/dotdot_mqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)(
Expand Down Expand Up @@ -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
Expand Down
Loading