Upgrading to Extended framework while keeping/converting units

Python and python framework

Moderator: leecollings

Post Reply
JanJaap
Posts: 215
Joined: Thursday 12 October 2017 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Dev
Location: the Netherlands
Contact:

Upgrading to Extended framework while keeping/converting units

Post 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.
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Upgrading to Extended framework while keeping/converting units

Post 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?
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
JanJaap
Posts: 215
Joined: Thursday 12 October 2017 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Dev
Location: the Netherlands
Contact:

Re: Upgrading to Extended framework while keeping/converting units

Post 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.
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest