[ST Edge] How to create child devices with edge?

The modification you sent does not work because of:

  • When press the button on the power strip, a status message is received in the logcat, not a command message and therefore it does not execute the function “on, off handler”. Only switch 1 status updated in app
***********  press general button in device ********************

2021-09-15T09:52:37.807858082+00:00 TRACE Zigbee Multi Switch  Received event with handler zigbee
2021-09-15T09:52:37.816951749+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: faced48a-1d28-4a63-b543-7e08c5a182b8 [0xC174] (Lidl MultiPlug)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0xC174, src_endpoint: 0x01, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: OnOff >, lqi: 0xAC, rssi: -57, body_length: 0x0007, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x18, seqno: 0x4F, ZCLCommandId: 0x0A >, < ReportAttribute || < AttributeRecord || AttributeId: 0x0000, DataType: Boolean, OnOff: true > > > >
2021-09-15T09:52:37.832359749+00:00 TRACE Zigbee Multi Switch  Found ZigbeeMessageDispatcher handler in Zigbee_Multi_Switch
2021-09-15T09:52:37.837640416+00:00 INFO Zigbee Multi Switch  Executing ZclClusterAttributeValueHandler: cluster: OnOff, attribute: OnOff
2021-09-15T09:52:37.844479082+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: faced48a-1d28-4a63-b543-7e08c5a182b8 [0xC174] (Lidl MultiPlug)> emitting event: {"attribute_id":"switch","capability_id":"switch","state":{"value":"on"},"component_id":"main"}
2021-09-15T09:52:37.863571416+00:00 DEBUG Zigbee Multi Switch  Lidl MultiPlug device thread event handled

  • When you press switch 1 or activate with a scene in the app, a command is sent and therefore the "on, off handler" function is executed and the three switches are turned on or off.
*********** pushed "switch 1" on in app ********************

2021-09-15T09:56:03.247370847+00:00 TRACE Zigbee Multi Switch  Received event with handler capability
2021-09-15T09:56:03.256782847+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: faced48a-1d28-4a63-b543-7e08c5a182b8 [0xC174] (Lidl MultiPlug)> received command: {"positional_args":[],"component":"main","command":"on","capability":"switch","args":[]}
2021-09-15T09:56:03.262963847+00:00 TRACE Zigbee Multi Switch  Found CapabilityCommandDispatcher handler in Zigbee_Multi_Switch
2021-09-15T09:56:03.270443514+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: faced48a-1d28-4a63-b543-7e08c5a182b8 [0xC174] (Lidl MultiPlug)> sending Zigbee message: < ZigbeeMessageTx || Uint16: 0x0000, < AddressHeader || src_addr: 0x0000, src_endpoint: 0x01, dest_addr: 0xC174, dest_endpoint: 0x01, profile: 0x0104, cluster: OnOff >, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x01, seqno: 0x00, ZCLCommandId: 0x01 >, < On ||  > > >     
2021-09-15T09:56:03.283406180+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: faced48a-1d28-4a63-b543-7e08c5a182b8 [0xC174] (Lidl MultiPlug)> emitting event: {"attribute_id":"switch","capability_id":"switch","state":{"value":"on"},"component_id":"main"}
2021-09-15T09:56:03.319916514+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: faced48a-1d28-4a63-b543-7e08c5a182b8 [0xC174] (Lidl MultiPlug)> sending Zigbee message: < ZigbeeMessageTx || Uint16: 0x0000, < AddressHeader || src_addr: 0x0000, src_endpoint: 0x01, dest_addr: 0xC174, dest_endpoint: 0x02, profile: 0x0104, cluster: OnOff >, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x01, seqno: 0x00, ZCLCommandId: 0x01 >, < On ||  > > >     
2021-09-15T09:56:03.333332180+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: faced48a-1d28-4a63-b543-7e08c5a182b8 [0xC174] (Lidl MultiPlug)> emitting event: {"attribute_id":"switch","capability_id":"switch","state":{"value":"on"},"component_id":"switch2"}
2021-09-15T09:56:03.375424514+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: faced48a-1d28-4a63-b543-7e08c5a182b8 [0xC174] (Lidl MultiPlug)> sending Zigbee message: < ZigbeeMessageTx || Uint16: 0x0000, < AddressHeader || src_addr: 0x0000, src_endpoint: 0x01, dest_addr: 0xC174, dest_endpoint: 0x03, profile: 0x0104, cluster: OnOff >, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x01, seqno: 0x00, ZCLCommandId: 0x01 >, < On ||  > > >     
2021-09-15T09:56:03.393597514+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: faced48a-1d28-4a63-b543-7e08c5a182b8 [0xC174] (Lidl MultiPlug)> emitting event: {"attribute_id":"switch","capability_id":"switch","state":{"value":"on"},"component_id":"switch3"}
2021-09-15T09:56:03.442634514+00:00 DEBUG Zigbee Multi Switch  Lidl MultiPlug device thread event handled
2021-09-15T09:56:03.450842847+00:00 TRACE Zigbee Multi Switch  Received event with handler zigbee
2021-09-15T09:56:03.461276181+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: faced48a-1d28-4a63-b543-7e08c5a182b8 [0xC174] (Lidl MultiPlug)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0xC174, src_endpoint: 0x01, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: OnOff >, lqi: 0xC8, rssi: -50, body_length: 0x0007, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x18, seqno: 0x57, ZCLCommandId: 0x0A >, < ReportAttribute || < AttributeRecord || AttributeId: 0x0000, DataType: Boolean, OnOff: true > > > >
2021-09-15T09:56:03.482010847+00:00 TRACE Zigbee Multi Switch  Found ZigbeeMessageDispatcher handler in Zigbee_Multi_Switch
2021-09-15T09:56:03.489218514+00:00 INFO Zigbee Multi Switch  Executing ZclClusterAttributeValueHandler: cluster: OnOff, attribute: OnOff
2021-09-15T09:56:03.496397181+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: faced48a-1d28-4a63-b543-7e08c5a182b8 [0xC174] (Lidl MultiPlug)> emitting event: {"attribute_id":"switch","capability_id":"switch","state":{"value":"on"},"component_id":"main"}
2021-09-15T09:56:03.511886847+00:00 DEBUG Zigbee Multi Switch  Lidl MultiPlug device thread event handled
2021-09-15T09:56:03.518088847+00:00 TRACE Zigbee Multi Switch  Received event with handler zigbee
2021-09-15T09:56:03.526790181+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: faced48a-1d28-4a63-b543-7e08c5a182b8 [0xC174] (Lidl MultiPlug)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0xC174, src_endpoint: 0x01, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: OnOff >, lqi: 0xC8, rssi: -50, body_length: 0x0005, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x08, seqno: 0x7B, ZCLCommandId: 0x0B >, < DefaultResponse || cmd: 0x01, ZclStatus: SUCCESS > > >
2021-09-15T09:56:03.835019514+00:00 DEBUG Zigbee Multi Switch  Lidl MultiPlug device thread event handled
2021-09-15T09:56:03.841309847+00:00 TRACE Zigbee Multi Switch  Received event with handler zigbee
2021-09-15T09:56:03.850178181+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: faced48a-1d28-4a63-b543-7e08c5a182b8 [0xC174] (Lidl MultiPlug)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0xC174, src_endpoint: 0x02, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: OnOff >, lqi: 0xC8, rssi: -50, body_length: 0x0005, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x08, seqno: 0x7C, ZCLCommandId: 0x0B >, < DefaultResponse || cmd: 0x01, ZclStatus: SUCCESS > > >
2021-09-15T09:56:03.865384514+00:00 DEBUG Zigbee Multi Switch  Lidl MultiPlug device thread event handled
2021-09-15T09:56:03.871327514+00:00 TRACE Zigbee Multi Switch  Received event with handler zigbee
2021-09-15T09:56:03.880331847+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: faced48a-1d28-4a63-b543-7e08c5a182b8 [0xC174] (Lidl MultiPlug)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0xC174, src_endpoint: 0x03, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: OnOff >, lqi: 0xC8, rssi: -50, body_length: 0x0005, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x08, seqno: 0x7D, ZCLCommandId: 0x0B >, < DefaultResponse || cmd: 0x01, ZclStatus: SUCCESS > > >

What I think happens:

  • When the device is installed you see in the logcat the following steps:
  • I don´t see in log “init”: the endpoints are assigned to the 3 components
  • “added” is executed
  • “doCofigure” is executed: attribute configuration and reports of the 3 components are sent, with min = 0 and max 0x12C (300sec)
***** doConfigure ********
2021-09-15T10:31:47.059171109+00:00 TRACE Zigbee Multi Switch  Received event with handler device_lifecycle
2021-09-15T10:31:47.065263775+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> received lifecycle event: doConfigure
2021-09-15T10:31:47.074557109+00:00 TRACE Zigbee Multi Switch  Found DeviceLifecycleDispatcher handler in Zigbee_Multi_Switch
2021-09-15T10:31:47.080569109+00:00 TRACE Zigbee Multi Switch  Found CapabilityCommandDispatcher handler in Zigbee_Multi_Switch
2021-09-15T10:31:47.099199442+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> sending Zigbee message: < ZigbeeMessageTx || Uint16: 0x0000, < AddressHeader || src_addr: 0x0000, src_endpoint: 0x01, dest_addr: 0x00DB, dest_endpoint: 0x01, profile: 0x0104, cluster: OnOff >, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x00, seqno: 0x00, ZCLCommandId: 0x00 >, < ReadAttribute || 
AttributeId: 0x0000 > > >
2021-09-15T10:31:47.140569775+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> sending Zigbee message: < ZigbeeMessageTx || Uint16: 0x0000, < AddressHeader || src_addr: 0x0000, src_endpoint: 0x01, dest_addr: 0x00DB, dest_endpoint: 0x02, profile: 0x0104, cluster: OnOff >, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x00, seqno: 0x00, ZCLCommandId: 0x00 >, < ReadAttribute || 
AttributeId: 0x0000 > > >
2021-09-15T10:31:47.158773775+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> sending Zigbee message: < ZigbeeMessageTx || Uint16: 0x0000, < AddressHeader || src_addr: 0x0000, src_endpoint: 0x01, dest_addr: 0x00DB, dest_endpoint: 0x03, profile: 0x0104, cluster: OnOff >, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x00, seqno: 0x00, ZCLCommandId: 0x00 >, < ReadAttribute || 
AttributeId: 0x0000 > > >
2021-09-15T10:31:47.190206109+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> sending Zigbee message: < ZigbeeMessageTx || Uint16: 0x0000, < AddressHeader || src_addr: 0x0000, src_endpoint: 0x01, dest_addr: 0x00DB, dest_endpoint: 0x01, profile: 0x0000, cluster: 0x0021 >, < ZDOMessageBody || < ZDOHeader || seqno: 0x00 >, < BindRequest || src_address: EC1BBDFFFEAED9B9, src_endpoint: 0x01, cluster: OnOff, dest_addr_mode: 0x03, dest_address: 286D97000204B680, dest_endpoint: 0x01 > > >
2021-09-15T10:31:47.219830109+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> sending Zigbee message: < ZigbeeMessageTx || Uint16: 0x0000, < AddressHeader || src_addr: 0x0000, src_endpoint: 0x01, dest_addr: 0x00DB, dest_endpoint: 0x01, profile: 0x0104, cluster: OnOff >, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x00, seqno: 0x00, ZCLCommandId: 0x06 >, < ConfigureReporting || < AttributeReportingConfiguration || direction: 0x00, attr_id: 0x0000, DataType: Boolean, minimum_reporting_interval: 0x0000, minimum_reporting_interval: 0x012C > > > >
2021-09-15T10:31:47.257891442+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> sending Zigbee message: < ZigbeeMessageTx || Uint16: 0x0000, < AddressHeader || src_addr: 0x0000, src_endpoint: 0x01, dest_addr: 0x00DB, dest_endpoint: 0x02, profile: 0x0000, cluster: 0x0021 >, < ZDOMessageBody || < ZDOHeader || seqno: 0x00 >, < BindRequest || src_address: EC1BBDFFFEAED9B9, src_endpoint: 0x01, cluster: OnOff, dest_addr_mode: 0x03, dest_address: 286D97000204B680, dest_endpoint: 0x01 > > >
2021-09-15T10:31:47.279568109+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> sending Zigbee message: < ZigbeeMessageTx || Uint16: 0x0000, < AddressHeader || src_addr: 0x0000, src_endpoint: 0x01, dest_addr: 0x00DB, dest_endpoint: 0x02, profile: 0x0104, cluster: OnOff >, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x00, seqno: 0x00, ZCLCommandId: 0x06 >, < ConfigureReporting || < AttributeReportingConfiguration || direction: 0x00, attr_id: 0x0000, DataType: Boolean, minimum_reporting_interval: 0x0000, minimum_reporting_interval: 0x012C > > > >
2021-09-15T10:31:47.301488775+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> sending Zigbee message: < ZigbeeMessageTx || Uint16: 0x0000, < AddressHeader || src_addr: 0x0000, src_endpoint: 0x01, dest_addr: 0x00DB, dest_endpoint: 0x03, profile: 0x0000, cluster: 0x0021 >, < ZDOMessageBody || < ZDOHeader || seqno: 0x00 >, < BindRequest || src_address: EC1BBDFFFEAED9B9, src_endpoint: 0x01, cluster: OnOff, dest_addr_mode: 0x03, dest_address: 286D97000204B680, dest_endpoint: 0x01 > > >
2021-09-15T10:31:47.328362775+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> sending Zigbee message: < ZigbeeMessageTx || Uint16: 0x0000, < AddressHeader || src_addr: 0x0000, src_endpoint: 0x01, dest_addr: 0x00DB, dest_endpoint: 0x03, profile: 0x0104, cluster: OnOff >, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x00, seqno: 0x00, ZCLCommandId: 0x06 >, < ConfigureReporting || < AttributeReportingConfiguration || direction: 0x00, attr_id: 0x0000, DataType: Boolean, minimum_reporting_interval: 0x0000, minimum_reporting_interval: 0x012C > > > >
2021-09-15T10:31:47.410642776+00:00 DEBUG Zigbee Multi Switch  Lidl MultiPlug device thread event handled
2021-09-15T10:31:47.501988442+00:00 DEBUG Zigbee Multi Switch  Lidl MultiPlug device thread event handled

  • The 3 components respond as ConfigureReportingReponse || ZclStatus: SUCCESS>>> and emit event “off”
***** devices response ***********

2021-09-15T10:31:47.536992776+00:00 TRACE Zigbee Multi Switch  Received event with handler zigbee
2021-09-15T10:31:47.621316776+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0x00DB, src_endpoint: 0x01, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: OnOff >, lqi: 0xC0, rssi: -52, body_length: 0x0008, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x18, seqno: 0x52, ZCLCommandId: 0x01 >, < ReadAttributeReponse || < AttributeRecord || AttributeId: 0x0000, ZclStatus: SUCCESS, DataType: Boolean, OnOff: false > > > >
2021-09-15T10:31:47.762498109+00:00 TRACE Zigbee Multi Switch  Found ZigbeeMessageDispatcher handler in Zigbee_Multi_Switch
2021-09-15T10:31:47.888910109+00:00 INFO Zigbee Multi Switch  Executing ZclClusterAttributeValueHandler: cluster: OnOff, attribute: OnOff
2021-09-15T10:31:47.949163442+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> emitting event: {"component_id":"main","capability_id":"switch","state":{"value":"off"},"attribute_id":"switch"}
2021-09-15T10:31:48.260512776+00:00 DEBUG Zigbee Multi Switch  Lidl MultiPlug device thread event handled
2021-09-15T10:31:48.326244109+00:00 TRACE Zigbee Multi Switch  Received event with handler zigbee        
2021-09-15T10:31:48.356318443+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0x00DB, src_endpoint: 0x02, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: OnOff >, lqi: 0xC0, rssi: -52, body_length: 0x0008, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x18, seqno: 0x53, ZCLCommandId: 0x01 >, < ReadAttributeReponse || < AttributeRecord || AttributeId: 0x0000, ZclStatus: SUCCESS, DataType: Boolean, OnOff: false > > > >
2021-09-15T10:31:48.419551443+00:00 TRACE Zigbee Multi Switch  Found ZigbeeMessageDispatcher handler in Zigbee_Multi_Switch
2021-09-15T10:31:48.477431776+00:00 INFO Zigbee Multi Switch  Executing ZclClusterAttributeValueHandler: cluster: OnOff, attribute: OnOff
2021-09-15T10:31:48.498398776+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> emitting event: {"component_id":"switch2","capability_id":"switch","state":{"value":"off"},"attribute_id":"switch"}
2021-09-15T10:31:48.570318109+00:00 DEBUG Zigbee Multi Switch  Lidl MultiPlug device thread event handled
2021-09-15T10:31:48.589026109+00:00 TRACE Zigbee Multi Switch  Received event with handler zigbee
2021-09-15T10:31:48.609388109+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0x00DB, src_endpoint: 0x03, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: OnOff >, lqi: 0xC0, rssi: -52, body_length: 0x0008, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x18, seqno: 0x54, ZCLCommandId: 0x01 >, < ReadAttributeReponse || < AttributeRecord || AttributeId: 0x0000, ZclStatus: SUCCESS, DataType: Boolean, OnOff: false > > > 
>
2021-09-15T10:31:48.683783776+00:00 TRACE Zigbee Multi Switch  Found ZigbeeMessageDispatcher handler in Zigbee_Multi_Switch
2021-09-15T10:31:48.699154109+00:00 INFO Zigbee Multi Switch  Executing ZclClusterAttributeValueHandler: cluster: OnOff, attribute: OnOff
2021-09-15T10:31:48.713321109+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> emitting event: {"component_id":"switch3","capability_id":"switch","state":{"value":"off"},"attribute_id":"switch"}
2021-09-15T10:31:48.750909110+00:00 DEBUG Zigbee Multi Switch  Lidl MultiPlug device thread event handled
2021-09-15T10:31:48.758937443+00:00 TRACE Zigbee Multi Switch  Received event with handler zigbee
2021-09-15T10:31:48.768531776+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0x00DB, src_endpoint: 0x00, dest_addr: 0x0000, dest_endpoint: 0x00, profile: 0x0000, cluster: 0x8021 >, lqi: 0xC0, rssi: -52, body_length: 0x0002, < ZDOMessageBody || < ZDOHeader || seqno: 0x4A >, < BindRequestResponse || status: 0x00 > > >
2021-09-15T10:31:48.799564110+00:00 DEBUG Zigbee Multi Switch  Lidl MultiPlug device thread event handled
2021-09-15T10:31:48.813861110+00:00 TRACE Zigbee Multi Switch  Received event with handler zigbee
2021-09-15T10:31:48.844891776+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0x00DB, src_endpoint: 0x01, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: OnOff >, lqi: 0xC0, rssi: -52, body_length: 0x0004, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x18, seqno: 0x55, ZCLCommandId: 0x07 >, < ConfigureReportingReponse || ZclStatus: SUCCESS > > >
2021-09-15T10:31:48.873594776+00:00 DEBUG Zigbee Multi Switch  Lidl MultiPlug device thread event handled
2021-09-15T10:31:48.879943110+00:00 TRACE Zigbee Multi Switch  Received event with handler zigbee
2021-09-15T10:31:48.896269110+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0x00DB, src_endpoint: 0x00, dest_addr: 0x0000, dest_endpoint: 0x00, profile: 0x0000, cluster: 0x8021 >, lqi: 0xC0, rssi: -52, body_length: 0x0002, < ZDOMessageBody || < ZDOHeader || seqno: 0x4B >, < BindRequestResponse || status: 0x00 > > >
2021-09-15T10:31:48.924352776+00:00 DEBUG Zigbee Multi Switch  Lidl MultiPlug device thread event handled
2021-09-15T10:31:48.930160110+00:00 TRACE Zigbee Multi Switch  Received event with handler zigbee
2021-09-15T10:31:48.960146110+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0x00DB, src_endpoint: 0x02, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: OnOff >, lqi: 0xC0, rssi: -52, body_length: 0x0004, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x18, seqno: 0x56, ZCLCommandId: 0x07 >, < ConfigureReportingReponse || ZclStatus: SUCCESS > > >
2021-09-15T10:31:48.976503776+00:00 DEBUG Zigbee Multi Switch  Lidl MultiPlug device thread event handled
2021-09-15T10:31:48.982416110+00:00 TRACE Zigbee Multi Switch  Received event with handler zigbee
2021-09-15T10:31:48.990866776+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0x00DB, src_endpoint: 0x00, dest_addr: 0x0000, dest_endpoint: 0x00, profile: 0x0000, cluster: 0x8021 >, lqi: 0xC0, rssi: -52, body_length: 0x0002, < ZDOMessageBody || < ZDOHeader || seqno: 0x4C >, < BindRequestResponse || status: 0x00 > > >
2021-09-15T10:31:49.009021776+00:00 DEBUG Zigbee Multi Switch  Lidl MultiPlug device thread event handled
2021-09-15T10:31:49.015726110+00:00 TRACE Zigbee Multi Switch  Received event with handler zigbee
2021-09-15T10:31:49.024145110+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0x00DB, src_endpoint: 0x03, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: OnOff >, lqi: 0xC0, rssi: -52, body_length: 0x0004, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x18, seqno: 0x57, ZCLCommandId: 0x07 >, < ConfigureReportingReponse || ZclStatus: SUCCESS > > >
2021-09-15T10:31:49.041858110+00:00 DEBUG Zigbee Multi Switch  Lidl MultiPlug device thread event handled
2021-09-15T10:31:49.048334443+00:00 TRACE Zigbee Multi Switch  Received event with handler device_lifecycle
2021-09-15T10:31:49.071655776+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> received lifecycle event: infoChanged
2021-09-15T10:31:49.081005776+00:00 TRACE Zigbee Multi Switch  Found DeviceLifecycleDispatcher handler in Zigbee_Multi_Switch
2021-09-15T10:31:49.086969776+00:00 TRACE Zigbee Multi Switch  <ZigbeeDevice: 10db2658-dd39-44ce-8ae4-2997e4312430 [0x00DB] (Lidl MultiPlug)> received unhandled lifecycle event: infoChanged
2021-09-15T10:31:49.097885443+00:00 DEBUG Zigbee Multi Switch  Lidl MultiPlug device thread event handled
2021-09-15T10:32:16.915652790+00:00 TRACE Zigbee Multi Switch  Received event with handler zigbee health poll
  • But only the main switch (1) sends the status changes messages according to the configuration sent.

  • I believe that this is the whole problem: The configuration has not been done correctly, since originallycode, without functions “on, off Handler”, driver execute the commands, but only the main switch respond to the state changes and reports configurated .

When you send a refrechs command, all 3 switches answer and update the status

I put the logs in case you see something that clarifies what is wrong.

I see something strange in the cluster 0x0021, cluster OnOff configuration, but I don’t have the knowledge to analyze if it is correct:

  • In the configuration messages sent, at the ZDOMessageBody || < ZDOHeader the endpoint is always 0x01, although in addressHeader it puts enpoint 0x02 and 0x03.
    It could be because it is always endpoint 1 that receives and transmits

Thanks

What library do you load for utils and st_utils, st.utils?

Thanks

How do you assign the endpoints to the components?
main → 1
switch1 → 2
switch2 → 3.?

@Mariano_Colmenarejo This is my custom library, because I plan to reuse it for different switches of different vendors.
However, it is very easy to implement

utils.log_debug

is basically checks the preferences of the device and prints the message using log, if debug prints are enabled

utils.component_name_to_ep

converts component name to ep number as described in ZigbeeDevice Class — SmartThings Edge Device Drivers documentation
Similar to that:

local function component_to_endpoint(device, component_id)
  if component_id == "main" then
    return device.fingerprinted_endpoint_id
  else
    local ep_num = component_id:match("switch(%d)")
    return ep_num and tonumber(ep_num) or device.fingerprinted_endpoint_id
  end
end

Since different devices have different number of channels (gangs), I have a code in each sub driver that puts the number of channels into persistent storage of the device.

utils.get_switch_count(device)

merely retrieves whatever value stored in the persistent storage of that device

My schema is as follows:
“main” → EP 0
switch 1 → EP1
switch 2 → EP2

However, I do not use default handlers, as they are not helpful in general case. Tuya devices have their specific protocol on top of Zigbee and always send messages for EP==1. Therefore, my base driver sends commands as described above for any device, implementing Cluster 006, but might have different handling in each specific subdriver. Some Tuya devices support a single command for all channels (on or off).
The challenge is actually to dispatch responses from the device, not to send them. For each command Aqara responses with the new status, but not all devices would do it. Some devices will need to be queried for the new state, using read attribute for example.

Yes, so I have it done and assign:

  • main: 1
  • switch2: 2
  • switch3: 3

@erickv,

I have done the configuration manually instead of by default and in the logs, it looks the same and the result is identical.
Therefore the configuration seems correct and the fact that the components 2 and 3 do not emit the message of state change for OnOff attribute, could be a problem of the device.

I have captured the message received from the OnOff attribute of the main component, with “zigbee_handlers” in the device template and then be able to emit the events of the three components.

I have managed to send a command to read the OnOff attribute to the 3 components and they reply with the value of the current state of the attribute.

The problem is that I am not able to identify the “src_endpoint” from the “false: off” or “true: on” value of the message.

In the documentation there is no or I find almost nothing to handle the components of the device. I give pretty clumsy.

Please could you tell me how to capture the src_endpoint of the message? and then emit the events to the platform.

Thanks

@Mariano_Colmenarejo

The ZigbeeMessageRx is being parsed into a table and passed as the fourth argument into your attribute handler so you can interact with it and you’ll find the src_endpoint into the address_header nested table.

Ok, thanks I got it.

2021-09-17T18:33:25.632968317+00:00 PRINT Zigbee Multi Switch  src_endpoint , value:    1       false

2021-09-17T18:33:25.708062317+00:00 PRINT Zigbee Multi Switch  src_endpoint , value:    2       false

2021-09-17T18:33:25.782696650+00:00 PRINT Zigbee Multi Switch  src_endpoint , value:    3       false

I had been testing it with zb_rx.AddressHeader.src_endpoint.value, which is how it reads in the message instead of zb_rx.address_header.src_endpoint.value.

It would be good to have documentation where to find these things or the source code of the libraries.

I’m going to see if I finish the driver and it works or not.
Thanks again

1 Like

@erickv,

The 3 socket strip is working well now, it detects the general button press and updates the status of the 3 components.
There is only one case in which if switch 1 is off and the other 2 are on, when you press the button, no attribute change message is generated on switch 1 and therefore the status of 2 and 3 is not updated until arrives the configured report every 5 minutes maximum.

To automate whether using a 2, 3 or 4 component profile, I needed to count the components in the profile with component_count (), but I am not able to do it.
Sorry I’m very clumsy. :woozy_face:

Thanks

At this point, you have bound and configured the attribute into the driver, right? I mean, to actually get the Zigbee Message on every press and not until the report demands it.

I’ve been digging a bit and I think you can try the following, which is quite straight forward:

  • Bind the OnOff request
local function do_configure(driver, device)
  local device_mgmt = require 'st.zigbee.device_management'

  device:refresh()
  device:send(device_mgmt.build_bind_request(
    device,
    OnOff.ID,
    driver.environment_info.hub_zigbee_eui))

  -- configure
  device:configure()
end
  • Configure the report for the switch capability:
-- switch (OnOff) report config
local onoff_cluster_config = {
  cluster=OnOff.ID,
  attribute=OnOff.attributes.OnOff.ID,
  minimum_interval=0,
  maximum_interval=300,
  data_type=data_types.Boolean,
  monitored=true
}

-- subdriver template
local controller_subdriver = {
  NAME = 'controller',
  cluster_configuration = {
    [caps.switch.ID] = onoff_cluster_config
  },
  can_handle = is_supported,
  ...

(in my case, I’m using a SubDriver to keep my code organized… you don’t necessarily have to follow this pattern)


You mean that you’re having a bad time parsing components into endpoints and vice versa?

What a great catch!

This seems to be elegant :sunglasses:, but the long liners make me feel really uncomfortable, even if I try to indent them = P

1 Like

Thanks @erickv

The long line can be easily avoided.
We can obtain a reference to command table once and reuse it during assignment

local OnOfCmd = OnOff.server.commands
local cmd = (command.command  == "off") and OnOffCmd.Off(device) or  OnOffCmd.On(device)

or we can declare a cmd and assign it in if statement

@Mariano_Colmenarejo

I think most devices will report once the state has been changed.
If this doesn’t work for I would try to look into the code that handles zigbee messages, perhaps adding debug prints.

If you are sure your zigbee handlers are fine, perhaps issuing read attribute command in the platform handler, right after sending on/off command would help.
If this doesn’t help, then read attribute command can be issued on timer with 1 or 2 sec delay (this is theoretical, I have no idea how to do it in Lua)

Please note, your decision to have id==1 for the main when sending the commands has nothing to do with how device reports the state. I would guess, the device still reports attribute change for channel 1 under end point 1, etc.
So, your end point to component function should take that into account.

Yes, that is what I have done to try to solve that only the main switch (1) sends state change messages.
When you send a refresh () or a read command, all 3 switches respond.

By pressing the on-off button on the strip, the message that switch 1 sends due to the status change is captured with the zigbee Handler and a read attribute command is sent to 2 and 3.
These respond to the read command and are updated by sending the command with the received status and the event is emitted to the platform, so that the device and the status on the platform are not de-synchronized.

The only problem is that when switch 1 is off and you turn off the 3 switches with the button on the power strip, switch 1 does not send a status change message and the off status of switches 2 and 3 is not updated in app until the following message from the configured report of switch 1, maximum 5 minutes.
It is not a big problem since that use case is very rare to occur, but I would like to know why this happens, jajaja…

Yes, the attribute is bound and configured either with the default configuration or by manually calling a do_Configure function. The result is identical.

----- Configure device -------
local function do_Configure (self, device)
  device:send(device_management.build_bind_request(device, zcl_clusters.OnOff.ID, self.environment_info.hub_zigbee_eui):to_endpoint (1))
  device:send(zcl_clusters.OnOff.attributes.OnOff:configure_reporting(device, 0, 300):to_endpoint (1))
  device:send(device_management.build_bind_request(device, zcl_clusters.OnOff.ID, self.environment_info.hub_zigbee_eui):to_endpoint (2))
  device:send(zcl_clusters.OnOff.attributes.OnOff:configure_reporting(device, 0, 300):to_endpoint (2))
  device:send(device_management.build_bind_request(device, zcl_clusters.OnOff.ID, self.environment_info.hub_zigbee_eui):to_endpoint (3))
  device:send(zcl_clusters.OnOff.attributes.OnOff:configure_reporting(device, 0, 300):to_endpoint (3))

It really is the same as i had done, but I have made a subdriver with the code you submitted and it does the exact same thing. Only switch 1(main) send configured report:

2021-09-18T14:02:41.844781397+00:00 TRACE Zigbee Multi Switch  Received event with handler zigbee
2021-09-18T14:02:41.854732730+00:00 INFO Zigbee Multi Switch  <ZigbeeDevice: 2b79a03c-b83f-431b-9248-45172d572d1d [0x5819] (Lidl MultiPlug)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0x5819, src_endpoint: 0x01, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: OnOff >, lqi: 0x98, rssi: -62, body_length: 0x0007, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x18, seqno: 0x40, ZCLCommandId: 0x0A >, < ReportAttribute || < AttributeRecord || AttributeId: 0x0000, DataType: Boolean, OnOff: false > > > >

To compare I have installed the strip with the groovy DTH and the three switches send through switch 1 the status message according to the configuration, not only switch 1 as happens with the edge driver.
I put the IDE’s live logging capture where you can see the response of the 3 endpoints and raw data, which you can’t see in the logcat, just the decoded message.

fa20df46-1c42-485b-901b-6512a7daee03 13:22:34: debug checkAllSwtichValue null : off
fa20df46-1c42-485b-901b-6512a7daee03 13:22:34: debug parse - sendEvent parent 01
fa20df46-1c42-485b-901b-6512a7daee03 13:22:34: debug eventMap [name:switch, value:off] | eventDescMap [raw:0104 0006 01 01 0000 00 9605 00 00 0000 0A 01 00001000, profileId:0104, clusterId:0006, sourceEndpoint:01, destinationEndpoint:01, options:0000, messageType:00, dni:9605, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:0A, direction:01, attrId:0000, encoding:10, value:00, isValidForDataType:true, data:[00, 00, 10, 00], clusterInt:6, attrInt:0, commandInt:10]
fa20df46-1c42-485b-901b-6512a7daee03 13:22:34: trace parse()
fa20df46-1c42-485b-901b-6512a7daee03 13:22:34: debug checkAllSwtichValue null : off
fa20df46-1c42-485b-901b-6512a7daee03 13:22:34: debug parse - sendEvent child 03
fa20df46-1c42-485b-901b-6512a7daee03 13:22:34: debug eventMap [name:switch, value:off] | eventDescMap [raw:0104 0006 03 01 0000 00 9605 00 00 0000 0A 01 00001000, profileId:0104, clusterId:0006, sourceEndpoint:03, destinationEndpoint:01, options:0000, messageType:00, dni:9605, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:0A, direction:01, attrId:0000, encoding:10, value:00, isValidForDataType:true, data:[00, 00, 10, 00], clusterInt:6, attrInt:0, commandInt:10]
fa20df46-1c42-485b-901b-6512a7daee03 13:22:34: trace parse()
fa20df46-1c42-485b-901b-6512a7daee03 13:22:34: trace parse()
fa20df46-1c42-485b-901b-6512a7daee03 13:22:34: debug checkAllSwtichValue null : off
fa20df46-1c42-485b-901b-6512a7daee03 13:22:34: debug parse - sendEvent child 02
fa20df46-1c42-485b-901b-6512a7daee03 13:22:34: debug eventMap [name:switch, value:off] | eventDescMap [raw:0104 0006 02 01 0000 00 9605 00 00 0000 0A 01 00001000, profileId:0104, clusterId:0006, sourceEndpoint:02, destinationEndpoint:01, options:0000, messageType:00, dni:9605, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:0A, direction:01, attrId:0000, encoding:10, value:00, isValidForDataType:true, data:[00, 00, 10, 00], clusterInt:6, attrInt:0, commandInt:10]

In order to use the driver with 2, 3, 4 socket strips, I want to know how many components has the installed device, using component_count (), which I saw in the documentation and use a loop
for enpoint = 1, components do … configuration or send commands to all components
Thanks

Hey, @Mariano_Colmenarejo

This is something unusual since you’re configuring every endpoint… So, to recap:

  • If the “master” endpoint (component switch1) is Off
  • And “slave” endpoints (componentes switch2 and switch3) are On
  • No ZigbeeMessageRx is received if you turn on/off the main endpoint, right?

Does this happen in the opposite scenario*(switch1 is On, and others Off)*?

This occurs only when have these conditions and physical button on the power strip is pressed to turn off all the switdh at the same time.
This happens because the main switch is already OFF and there is no change of state and because switches 2 and 3 do not send periodic reports and they only respond to the refresh command or attribute read commands.

With this scenario, when switch 1 is turned off there is a change of state and it sends a zigbee message. I capture it with zigbee handler and emit the ON state of the other 2 switches

Hi @nayelyz ,

This issue reported at the beginning of the edge beta phase with multi-component switches remains the same.

On a triple device:

  • The timer that you program in one component is applied to all 3 components.
  • The automations that are made with the quick control can only be programmed in one component and always are executed in component 3

Thanks

Hi, thank you for bringing this up. I tracked the bug report about this, what it’s clear is that this issue is not edge-related because it happens for other multi-component devices, that’s why I moved the post back here.
Once I get more info, I’ll let you know.

1 Like