Help! Device gone in Domoticz, how to restore that device's historic data from old backup?

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!

Moderators: leecollings, remb0

Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
User avatar
andrehj
Posts: 47
Joined: Sunday 06 January 2019 14:26
Target OS: -
Domoticz version:
Contact:

Help! Device gone in Domoticz, how to restore that device's historic data from old backup?

Post by andrehj »

Somehow a device with a lot of historic data is no longer present in Domoticz (also in Setup → Devices) :( . Don't understand how that happened, I must have deleted it accidentally... :oops:

From the output of scripts I can see that it's missing since the 8th of June.
I have a domoticz_backup.db from June 2nd.

Is it possible to retrieve the device data (table) from that old backup and somehow insert it into my current database? Is there a how-to which explains how to do that? From my scripts I know the correct Device Idx.

From other devices and scripts I can estimate the values of the missing days. It would be nice if I could insert these into the table as well. But how do I accomplish that?

Thanks in advance for any help,

Andrehj
Last edited by andrehj on Friday 04 July 2025 10:47, edited 1 time in total.
User avatar
waltervl
Posts: 5855
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Help! Device gone in Domoticz, how to restore that device's historic data from old backup?

Post by waltervl »

See the database merge tool mentioned in this topic: viewtopic.php?p=312243#p312243
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
Varazir
Posts: 432
Joined: Friday 20 February 2015 22:23
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Help! Device gone in Domoticz, how to restore that device's historic data from old backup?

Post by Varazir »

waltervl wrote: Thursday 03 July 2025 15:55 See the database merge tool mentioned in this topic: viewtopic.php?p=312243#p312243
I can't download the file

https://releases.domoticz.com/releases/ ... BMerger.7z
Raspberry PI 2 with RaZberry Controller 2016 ZWave+ and CC2531(zigbee)
Several IKEA devices/z-wave devices
User avatar
jvdz
Posts: 2330
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Help! Device gone in Domoticz, how to restore that device's historic data from old backup?

Post by jvdz »

New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
Varazir
Posts: 432
Joined: Friday 20 February 2015 22:23
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Help! Device gone in Domoticz, how to restore that device's historic data from old backup?

Post by Varazir »

jvdz wrote: Thursday 03 July 2025 20:09 Try: https://releases.domoticz.com/release/t ... BMerger.7z
Thanks it worked, It looked strange at first but didn't try to remove the extra.
Raspberry PI 2 with RaZberry Controller 2016 ZWave+ and CC2531(zigbee)
Several IKEA devices/z-wave devices
User avatar
andrehj
Posts: 47
Joined: Sunday 06 January 2019 14:26
Target OS: -
Domoticz version:
Contact:

Re: Help! Device gone in Domoticz, how to restore that device's historic data from old backup?

Post by andrehj »

waltervl wrote: Thursday 03 July 2025 15:55 See the database merge tool mentioned in this topic: viewtopic.php?p=312243#p312243
Thanks for the help!

However, as far as I understand, that tool can only merge some specific tables, or all tables. I just need to gather my historic data from one specific Idx, and integrate that into the current database.
I don't understand how I can do that with this tool.

Do I have to simply run
DomoticzDBMerger.exe --inputdb=olddatabase.db --outputdb=currentdatabase.db --merge-all
and hope that it works?

Or can I use the command
--transfer-old=idx --transfer-new=idx
to copy one idx from the old db to the current db? And than by keeping the idx the same it should just copy that index?
DomoticzDBMerger.exe --inputdb=olddatabase.db --outputdb=currentdatabase.db --transfer-old=137 --transfer-new=137

And will the latter work if a device with the new index is not yet present in the output database? Or do I have to create it first and let the merger simply fill that data?

So many questions...

Too bad there is no more elaborate help for this tool.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest