(EDGE Driver-Mc) Zigbee switch MC, Zigbee switch power MC, Zigbee multi switch and child MC

I put the switch-Level in it. 1-dim works normally
And I changed the two-switch-level and child-switch-level, and you will find that the icon is normally displayed as a light,and child devices are also displayed as lights, not switches
metadata:
deviceType: Light
ocfDeviceType: oic.d.light
deviceTypeId: Light

and in the upper right corner setting, Create Single to Device Light2 need to be modified

No problem, In your driver You can change all of You need.

Each user can choose the icon need in device edit icon change function.


When I change the default to Yes and add the device again, no independent single device is automatically created. I don’t know whether it is my operation problem or other reasons. The multi switch is the same problem
Have you ever tested?

Of course, the code is made that way on purpose.

Only the Child device is created in the infoChanged lifecycle, which calls the do_preferences function.

If you want to change it, you have to duplicate the code that calls the function child_devices.create_new_device(driver, device, "switch2",profile_type) or create a function with the code and call it in the added or init and infoChange lifecycles, so that keep working also when you do it from preferences

Thank you. Although I don’t understand what you mean. But I will try to understand and try to modify and test.
Again, thank you very much for your help!

These are the lifecycles that are defined and executed manually on this driver.

lifecycle_handlers = {
    init = device_init,
    driverSwitched = driver_Switched,
    infoChanged = do_preferences,
    doConfigure = do_configure,
    added = do_added,
    removed = do_removed
  },

The life cycles handlers are generated by the default libraries and execute default functions or functions, in this case, customized.

Here is the documentation link
https://developer.smartthings.com/docs/edge-device-drivers/driver.html#lifecycle-event-handlers

When you install a device these life cycles are generated and in this order and you can use them to call custom functions or those of the default libraries will be executed:

  • init
  • added
  • doConfigure

When you change drivers these life cycles are generated:

  • init
  • added
  • driverSwitched

When you change a preference this life cycles is generated

  • infoChanged

When you unistall a device from driver this life cycles is generated

  • removed

So if you want the child device to be created when you install the device you have to call the code that creates the Child device in the function that runs in the init, added or doConfigure lifecycle

child_devices.create_new_device(driver, device, “light2”,profile_type)
Do you mean to add the above function in 2-dim?
Still don’t understand how to add a corresponding number of child devices in multi switch?

My opinion is that the way it is done is fine for me.

I am not able to explain it better, if it is not enough leave it as it is.

Carefully read the documentation and the comments I gave you about the driver code.

Locate the code that creates the child device, and the variables it passes, in the do_preferences function.

You have to duplicate and adapt that code in the function device_init to create child device in the installation process

You can try with a copy of the driver to avoid touching what already works.

Deleted post

Thank you. Good, then keep it as it is :smiley:

Thank you!

Hi, Mariano
infomation Tuya color light

application: 09
endpointld: 01
manufacturer: 3A Smart Home
model: FEB56-ZCW2CLX1.0
zigbeeNodeType: ROUTER
Raw Description: 01 0104 010D 01 09 0000 0003 0004 0005 0006 0008 0300 FC01 FC02 01 0019


c

mutiltap plug
2021-04-09 10;59;15

  • application: 43
  • endpointId: 01
  • manufacturer: _TZ3000_o005nuxx
  • model: TS011F
  • onOff: catchall
  • zigbeeNodeType: ROUTER
    Raw Description 01 0104 010A 01 07 0000 0003 0004 0005 0006 E000 E001 02 0019 000A

Hi Mariano,

I noticed some strange behaviour wherein for every 2 min approx., the lamp switches off and switches on in a second. Is this something you can help fix?

hi i had a yagusmart light doing that too this worked for me

Thanks for your reply Martin but my case is different because it turns off and turns back on in less than a second so I need to wait for Mariano to reply.

If the sequence @montyfert says doesn’t work for you, you can try uninstalling and reinstalling the device, this seems to have worked for @montyfert with similar issue

Hi @sfsjs20

I need see how many endpoints does the device have 4 or 5 and if they are ordered.

You can install the Zigbee Thing Mc driver and have it pair with it.

Works perfectly, thanks both.

1 Like

I have one question. i have sonoff power meter plug, and installed driver zigbee switch power mc. It works ok, just energy consumption i think is little off. I had 1 hour consumption with power around 20W, and my energy consumption for that is 2.0 kwh. Is this really ok? Thanks