This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Alarm Cluster problem

Hi,

Someone has been working with Alarm Cluster. I tried to implement it on multiprotocol dorr lock example but it was impossible. I have been reading ZCL library revision 6 and no find how to implement it.

What I want to do is to send an alarm from EP to Alexa.

Some help?

Parents Reply Children
  • Hi Marte,

    Thanks for your answer.

    I have been reading the documentation and I tried to play with alarm cluster.

    1. I heve defined door_lock_cluster adding alarm_mask_id for enabling alarm reporting.

    zb_zcl_door_loock.h

    /** @brief Declare attribute list for DoorLock cluster
        @param attr_list - attribute list name
        @param lock_state
        @param lock_type
        @param actuator_enabled
        @param alarm_mask_id
    */
    #define ZB_ZCL_DECLARE_DOOR_LOCK_ATTRIB_LIST(attr_list,                               \
                                                 lock_state,                              \
                                                 lock_type,                               \
                                                 alarm_mask_id,                           \
                                                 actuator_enabled)                        \
      ZB_ZCL_START_DECLARE_ATTRIB_LIST(attr_list)                                         \
      ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DOOR_LOCK_LOCK_STATE_ID, (lock_state))             \
      ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DOOR_LOCK_LOCK_TYPE_ID, (lock_type))               \
      ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DOOR_LOCK_ACTUATOR_ENABLED_ID, (actuator_enabled)) \
      ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DOOR_LOCK_ALARM_MASK_ID,(alarm_mask_id))           \
      ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST

    #define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DOOR_LOCK_ALARM_MASK_ID(data_ptr)                 \
      {                                                                                          \
        ZB_ZCL_ATTR_DOOR_LOCK_ALARM_MASK_ID,                                                     \
        ZB_ZCL_ATTR_TYPE_8BIT_ENUM,                                                              \
        ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING | ZB_ZCL_ATTR_ACCESS_SCENE,  \
        (zb_voidp_t) data_ptr                                                                    \
      }

    zb_zcl_door_loock_addons.h

    typedef struct
    {
        zb_uint8_t lock_state;
        zb_uint8_t lock_type;
        zb_bool_t  actuator_enabled;
          zb_uint16_t  alarm_mask_id;
    } zb_zcl_door_lock_attrs_t;

    Main.c

    ZB_ZCL_DECLARE_DOOR_LOCK_ATTRIB_LIST(door_lock_attr_list,
                                         &m_dev_ctx.door_lock_attr.lock_state,
                                         &m_dev_ctx.door_lock_attr.lock_type,
                                         &m_dev_ctx.door_lock_attr.actuator_enabled,
                                                                             &m_dev_ctx.door_lock_attr.alarm_mask_id
                                                                             );

    m_dev_ctx.door_lock_attr.alarm_mask_id    = ZB_ZCL_DOOR_LOCK_ALARM_MASK_DEFAULT_VALUE;

    2. I tried to add Alarm Cluster but I have no idea how must I add this. Reading this page about implementing a Zigbee end product with ZCL you can see how to add a cluster step by step but Alarm cluster seems to bee diferent from other clusters.

    3.Then if Alarm cluster is defined How must I report an Alarm? Changing m_dev_ctx.door_lock_attr.alarm_mask_id value? I tried with 0x01 (Jammed) as show below:

    UNUSED_RETURN_VALUE(zb_zcl_set_attr_val(DOOR_LOCK_ENDPOINT,
                                                    ZB_ZCL_CLUSTER_ID_DOOR_LOCK,
                                                    ZB_ZCL_CLUSTER_SERVER_ROLE,
                                                    ZB_ZCL_ATTR_DOOR_LOCK_ALARM_MASK_ID,
                                                    &value,
                                                    ZB_FALSE));

    4. In other post I saw somebody recomends ZB_ZCL_ALARMS_SEND_RESET_ALARM_REQ from alarm cluster for reporting alarms but reading I have no idea to use it and how it works.

    Any suggest or feedback about my steps?

    Thanks

Related