how to transfert 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
multinet
Posts: 97
Joined: Friday 05 December 2014 22:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

how to transfert data

Post by multinet »

Hello

I accidentally delete a device and I lost all my history (wind device)

I just face up the delete today

So, recreate my device and I want to know if it is possible to transfert all date from my backup from this wind device to the new I created today (and I don't want to reuse all my backup because I will lost all data for 2 weeks for all other devices)

Is it possible via sql ?

Thanks
PI 2 - Domoticz 2021.1
RFXCOM - RFXtrx433 USB 433.92MHz Transceiver (5 DIO 54755 + 2 DIO 54756 + 3 DIO 54798)
Z-Wave.Me ZME_UZB1 USB Stick (6 FGSD002 + 2 FGRM222 + 1 FGS223 + 1 FGMS001-ZW5 + 1 FGRGBWM441 + 1 FGBS001 + 2 FGFS101)
6 sondes DS18B20
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: how to transfert data

Post by waaren »

This should be possible but I have not tested it yet.

!! make sure you have a backup of your current domoticz.db !!

sudo sqlite3 "your backup with old data domoticz".db
.output myWind_Calendar
.dump Wind_Calendar
.q

edit myWind_Calendar
only keep INSERT INTO lines for your device. First number after "(" is device number. Delete other lines.

example line: INSERT INTO "Wind_Calendar" VALUES(3,208.77,51,123,106,170,'2017-10-21');

change old device number into new device number
save edited file

stop domoticz
sudo sqlite3 domoticz.db < myWind_Calendar
start domoticz
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest