[ST Edge] Change Driver Tool in the ST App

For those of us who are not professional developers and we like this platform and community for giving us the opportunity to create and modify controllers to customize or use new devices, I think could be useful to expose my comments about how I have seen Lifecycle Event Handlers work by default and how they are described in the documentation, to understand how they work with the edge drivers in comparison with the methods used in the well-known DTH groovy.

DeviceLifecycleDispatcher: default_handlers:
init:
added:
doConfigure:
driverSwitched:
infoChanged:
removed: (In the documentation it calls it “deleted”)

It is quite well defined that each one does in the driver documentation:
https://developer-preview.smartthings.com/edge-device-drivers/driver.html#lifecycle-event-handlers

The execution flow that I have seen for the usuals procedures with the devices and comparison with DTH, if there is one:

  • New installation of a device:
    EDGE: init → added → doConfigure → infoChanged
    DTH: installed → configure → parse

  • Uninstalling the device:
    EDGE: removed (in documentation says “deleted”)

  • Change of EDGE driver for another one for a device in app:
    EDGE: init → added → driverSwitched → infoChanged
    DTH change in IDE: configure → parse

For zigbee devices, it might be useful to also run doConfigure, since when you change the driver it may be necessary to reconfigure the device, as is done in IDE when changing one DTH for another.

Another solution could be to put a button in the details or settings menu of the device, option to “run configuration” as there was in the classic app a tile "Configure"

When you slide your finger on the details of the device, you see in the logcat how “refresh” is executed. The configuration could be executed in the same way with a tile or menu option.

  • Device name change:
    EDGE: infoChanged ( I see the name changed en API and IDE immediately, but in the logcat the execution of infoCanged was about 2 hours later and it updated the name of the devicer)

  • Device preferences change values (temperatureOffset for example):
    EDGE: infoChanged
    DTH: updated

Finally there are the lifecycle_message_handler and ZigbeeMessageDispatcher: default_handlers

  • That they would do the work of the “parse” method. Handle the received events, process them and send the messages to the devices and events to the platform.

The fact that all this is already written by default in the libraries, makes the construction of simple drivers is much easier. with less than 50 lines of code you have made an edge driver.

What I still do not see clear is how to modify these default values, which may be necessary to customize the operation of some zigbee devices.