Migrating domoticz.db data

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
jacobh
Posts: 21
Joined: Wednesday 04 November 2020 10:12
Target OS: -
Domoticz version:
Contact:

Migrating domoticz.db data

Post by jacobh »

I recently replaced my P1 Smartmeter connection to measure and display power and gas consumption in Domoticz from wired to wireless.
Domoticz created new devices (with new deviceid's) in the GUI which show the desired power and gas measurements.
All working and nice, but ... I would like to keep the historic data captured with the old wired devices under the new devices.
I have about 4 years of historic data for gas and power and would like to see this data under the new devices.
To clarify, the old situation:
p1_old.jpg
p1_old.jpg (99.83 KiB) Viewed 1693 times
the new situation:
p1_new.jpg
p1_new.jpg (96.59 KiB) Viewed 1693 times
Can anyone enlight me how to get this done without corrupting the domoticz.db, for instance by manipulating the domoticz.db with sqlite ?
Or, if this has been explained earlier on this forum (I did tried searching for it): could you point me to the relevant discussion please?
User avatar
FireWizard
Posts: 1868
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Migrating domoticz.db data

Post by FireWizard »

Hi,

From the Wiki:

Replace device

Some devices change their unique ID when a new battery is installed and will get a new idx ID in Domoticz. Also when migration from one hardware gateway to another (eg OpenZwave to Zwave-JS-UI) you could need to replace devices.

To replace the old sensor data (history logging) to the new device act as follow:

First, add (or is added by new gateway) the new device to the system, and call it for example ‘New UV Meter’.
Next press the Edit button on the Old device, select replace and select the new Device. (In this case the devices called ‘New UV Meter’).
Next press OK. Result:
The old and new device will be merged and get the name and IDX of the old device. This will prevent changes in scripts that use this device.
The new device will be deleted. (behavior since Stable 2022.1)
If there is a hardware gateway difference between Old and New device (eg when switching from OZW to Zwave JS UI MQTT) the merged device (with old name and idx) will get the hardware gateway of the new device.

Regards
jacobh
Posts: 21
Joined: Wednesday 04 November 2020 10:12
Target OS: -
Domoticz version:
Contact:

Re: Migrating domoticz.db data

Post by jacobh »

Thank you so much FireWizard. Works like a charm, didn't know this feature. All historic data is visible now under the old id's and the new devices are gone (but not the data it already collected). I'm happy! :D
hartwich
Posts: 2
Joined: Sunday 15 July 2018 16:39
Target OS: -
Domoticz version:
Contact:

Re: Migrating domoticz db data

Post by hartwich »

I would like to replace my P1 wired connection to wireless too. Could you tell me what hardware you are using? There are several options (homewizard P1; smartgateways, JMD). Your solution is exactly what I want to achieve. It would help me to select the best option.
jacobh
Posts: 21
Joined: Wednesday 04 November 2020 10:12
Target OS: -
Domoticz version:
Contact:

Re: Migrating domoticz db data

Post by jacobh »

hartwich wrote: Sunday 14 January 2024 12:30 I would like to replace my P1 wired connection to wireless too. Could you tell me what hardware you are using? There are several options (homewizard P1; smartgateways, JMD). Your solution is exactly what I want to achieve. It would help me to select the best option.
Typical huh? You help someone and post a question after helping him and he never responds. :roll:

Very sorry about that. I bought my wireless device at https://smartgateways.nl/. Not sure if it works for you too, as this is a Dutch company and I think they mainly focus on Dutch customers. But all specs are there and their support is very good indeed.
Hope that helps!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest