Sharing code between device handlers

Hello, is it possible to share code between device handlers so that I don’t have to copy and maitain multiple copies?
Eg have classes that can be imported somehow?

1 Like

Nope… But @pstuart was working on a way to do this by building an external (ie, desktop) based IDE that has a code pre-processor which substitutes in code segments at upload time.

Not sure the status of this project (which offers many other great features).

This project is on hold until an official API for accessing the IDE is made available, if / when.

The CLI (command line interface for offline SmartApp / DTH packaging and uploading… Demoed at SDC last month) is going limited Beta soon, I think… Is that the same thing?

If so, that’s a reason for cautious optimism.

The cli will allow any offline editor. Time will tell.

1 Like

Is there any update on this? I have a few ZigBee devices (motion, contact, button, plugs) that report the same information (eg: temperature, battery, etc.) and it’s annoying having to copy the very same code in each DTH. Let alone maintaining it.

Wait for the new API. Complete overhaul, and hints are that it will be much more developer friendly… code reuse mechanisms wouldn’t be surprising.