Page 1 of 1

how to transfert data

Posted: Friday 30 March 2018 18:21
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

Re: how to transfert data

Posted: Saturday 31 March 2018 0:53
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