Back-up historical sensor data and start with fresh install

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
iMartien
Posts: 4
Joined: Wednesday 11 February 2015 11:04
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Rotterdam
Contact:

Back-up historical sensor data and start with fresh install

Post by iMartien »

Hi All,

I would like to start with a freshly new Domoticz install on my Raspberry Pi (too much testing has been done, upgraded to beta's etc), and re-add all my devices by hand (mostly rfxcom 433mhz stuff).

but I don't want to lose all historical data, especially my historical Smart Meter P1 usage history and temperature and rain history.

What would be the best way to achieve this? I don't want to install and dump my complete old database into it, because it has to much old and unused devices etc (my idx count is like 500+)

Thanks in advance!
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Back-up historical sensor data and start with fresh install

Post by sincze »

Ha only 500. I had the same. Idea with 2000 idx due to testing. Just removed all unnecessary hardware/devices and system is still rock solid and fast. Maybe not the answer you were looking for but keep in mind all hope is not lost with 500+ idx.

Sent from my SM-G925F using Tapatalk

Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Back-up historical sensor data and start with fresh install

Post by Egregius »

Nothing wrong with high idx numbers. The database column is set to integer, witch means the limit is 2147483647.
Don't think you need to worry any time soon...

Anyway, to reply to your question.
Make a copy of your current database. Reinstall Domoticz with a clean database, add all your devices.
Use a SQL3lite explorer to open the copy of the database. Use a query to replace all old idx's in the tables LightingLog, MultiMeter, MultiMeter_Calendar, Percentage, Percentage_Calendar, Temperature, Temperature_Calendar, UV, UV_Calendar, Wind and Wind_Calendar with their corresponding new idx.
Remove any data you don't want to keep.
Export the data and import it in the new database.
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Back-up historical sensor data and start with fresh install

Post by sincze »

Seems like a lot of work. let's thank the 'integer' for saving me from a lot of manual work.

Sent from my SM-G925F using Tapatalk

Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest