From c5d588cf7e359a22e80152f492d0142a8030a426 Mon Sep 17 00:00:00 2001 From: Monika Rathor Date: Wed, 29 Nov 2023 10:16:53 -0800 Subject: [PATCH] Delete notification_types_node when there are no supported notification types --- .../src/zwave_command_class_notification.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/applications/zpc/components/zwave_command_classes/src/zwave_command_class_notification.cpp b/applications/zpc/components/zwave_command_classes/src/zwave_command_class_notification.cpp index f7b363dbc6..2637e296c4 100644 --- a/applications/zpc/components/zwave_command_classes/src/zwave_command_class_notification.cpp +++ b/applications/zpc/components/zwave_command_classes/src/zwave_command_class_notification.cpp @@ -354,6 +354,23 @@ static sl_status_t = attribute_store_get_first_child_by_type( ep_node, ATTRIBUTE(SUPPORTED_NOTIFICATION_TYPES)); + // Delete notification_types_node when there are no supported notification types. + if (number_of_supported_notification_types == 0) { + sl_status_t status + = attribute_store_delete_node(supported_notification_types_node); + if (status != SL_STATUS_OK) { + sl_log_debug(LOG_TAG, + "Failed to remove node %u", + supported_notification_types_node); + } + return SL_STATUS_OK; + } + if (supported_notification_types_node == ATTRIBUTE_STORE_INVALID_NODE) { + sl_log_info(LOG_TAG, + "Failed to find node %u", + supported_notification_types_node); + return SL_STATUS_FAIL; + } attribute_store_set_node_attribute_value( supported_notification_types_node, REPORTED_ATTRIBUTE, @@ -794,4 +811,4 @@ sl_status_t zwave_command_class_notification_init() zwave_command_handler_register_handler(handler); return SL_STATUS_OK; -} \ No newline at end of file +}