Page 1 of 1

Upgrading to Extended framework while keeping/converting units

Posted: Monday 25 July 2022 20:43
by JanJaap
Hey,

Last year the extended framework is introduced which introduces a lot of freedom to link units to devices which gives me much more power in interfacing with the external stuff.

Now I've got some plugins on the legacy framework which I want to move to the extended framework. A lot of users would prefer to keep their data, so not delete all devices and start from scratch. So is there a way to move the existing device[1]+unit[1] combinations to a device[1]+unit[n] combination or other? I know the pattern of how I wanna do this, I can trigger this logic by detecting the upgrade via trying to read config values,- I just want to know if it is possible before putting the effort in.

Re: Upgrading to Extended framework while keeping/converting units

Posted: Thursday 04 August 2022 1:41
by Dnpwwo
@JanJaap,

Both frameworks work off the same Domoticz database tables so I assume by migrate to the extended framework you are talking about changing the DeviceID and Unit numbers of existing devices?

You could do it in the plugin by connecting to the database yourself using the Python SQLite3 module and making the updates yourself but the plugin would then need to be restarted to reload the Devices dictionary.

Could you create a python script to do it?

Re: Upgrading to Extended framework while keeping/converting units

Posted: Saturday 11 November 2023 20:02
by JanJaap
Bit late update, but what I did was manually edit the DeviceStatus table in domoticz.db. Changed the old (generated) DevcieID to the one I know is going to be assigned by the new plugin. Did not bother to make a python script out of it.