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

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

Was this ever resolved? Is multi-component devices working on the edge platform? I have multiple devices I bought specifically for the capabilities it came with that used child devices on the groovy platform.

1 Like

The concept of “child devices” no longer exists on Edge. For devices that have multiple components like LED strips, you can do the following:

  1. Create a device profile with multiple components and map them with the corresponding endpoints (if necessary) as described in this doc (Zigbee)
    • In this option, only the main component is exposed to some third-party integrations like Alexa.
  2. Create separate devices in the same driver using try_create_device (Only for LAN drivers). Despite all being created with the same driver, they won’t be related as parent/child.
    • Here you can use persistent storage to keep control of the devices created
    • Also, be careful of creating several devices at once, you might have to avoid the device’s thread using cosock.spawn (please, take a look at this post)
1 Like

@nayelyz ,

I think I’ve seen somewhere a limitation that try_create_device can be used only for LAN drivers. Has this limitation beed removed and it now can be used from Zigbee drivers?
Thanks

3 Likes

Yes, that’s included in the doc link I shared above:
image
I already included it in the text, sorry for the confusion.

1 Like

Secondary switch gangs are not available in routines (and there is no Child), but they appear in Smart Lighting as switch “2/3”. Than with a “virtual Child switch” third-party voice integration could control these devices again.

If no Child Device can be created, than could I use a Virtual Device (switch) to control a secondary switch in a 2 or 3 gangs switch (Zigbee)?

I use @Mariano_Colmenarejo virtual mirror switches for this purpose.

What do you mean by “secondary”? Do you mean that in the routines, only the main switch appears?
I have a multi-component device and I see the switch capability appears for each component

Or, do you mean in a third-party app?

As a side note, please remember that the Smart Lighting app is part of the legacy platform. The team mentioned the automation there will be migrated (only the active ones) but be careful creating new.

I’ve seen that’s the solution applied from many users. Thanks, @Paul_Oliver, for suggesting a solution! :smiley:

Applied by some power users, sure. But way too complicated for most people who just buy a typical inexpensive two gang light switch and expect it to work out of the box with SmartThings. :thinking:

While we’re talking about it…there will be Matter-compatible multi gang light switches soon. I hope those will be “plug and play” with the new SmartThings architecture because they will be on other Matter-compatible platforms.

1 Like

They should work directly on SmartThings, the multi-component devices are fully supported there, we can create Routines for those devices. I understood the issue is with third-party apps, like Alexa (that’s already been reported).

I checked the Smart Lighting app, and yeah, it doesn’t allow you to select actions for each component and it only performs the action in “main”.
I’ll confirm with the team they’re considering the cases of multi-component devices in the new version of the app.

If I’m missing something, please provide more details :smiley:

1 Like

Smartlighting can select actions in all components, but you don’t know which device this component belongs to since the names are identical in all

Update: sorry can select but does not work for components, only for main

2 Likes

This is exactly what I tried to explain. Thanks @Mariano_Colmenarejo !
With that extra situation… only available in Smart Lighting, not in Routines. Why?

It should be ok in Routines, please share a screen capture of the device’s detailed view and how it looks in the Routines tool.

I have an Edge driver that creates a device with three components, each with a momentary capability. In ActionTiles, which has a Groovy based connector SmartApp, the components are presented in the device selection lists as if they are separate devices and momentary tiles can be created using them. They just don’t work.

So… there is not much to show in Routines. I have only a single switch with the Main´s name.
And for Smart Lighting I have the same image that @Mariano_Colmenarejo did post.

This device “Banheiro Banheiro” os a 2 ganha switch with @Mariano_Colmenarejo mukti-awirch edge driver.

However, in Routines I have only the Main available to select.