I am in the process of preparing an upgrade of my electrical installation from single phase to 3-phase supply. I currently have an Aotec energy meter in use, and will have to replace it with the 3-phase model. I would like to do so without losing the historical data I have accumulated. How do I do that?
As a matter of fact the situation is slightly more complex than described above. In fact I have two single-phase energy meters in use at the moment: one that measures grid energy and another that measures solar energy. I have created a dummy energy meter as well, and a LUA script calculates energy consumption as the difference between the two measured values. Since the solar inverter is and will remain single-phase, I will also continue using that energy meter.
So I guess that I have two goals:
1. replace the grid energy meter such that the historical readings of the single-phase meter become associated with the 3-phase meter;
2. modify the LUA script such that the energy consumption is calculated from the new 3-phase grid energy meter reading less the existing single-phase solar energy meter.
Any hints would be gratefully received.
Energy meter replacement with retention of historical data
Moderators: leecollings, remb0
-
- Posts: 23
- Joined: Saturday 16 January 2021 16:07
- Target OS: Linux
- Domoticz version:
- Contact:
-
- Posts: 160
- Joined: Wednesday 02 October 2019 7:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands
- Contact:
Re: Energy meter replacement with retention of historical data
I think the only solution is to modify the db manually.
A good tool to do so is: SQLiteStudio
You need to copy your data from the old meter to a new table, then modify the hardware id's in the new table, then insert into existing table.
Take some copies of your database and use a domoticz test application on your desktop or test rpi, and apply on that setup.
A good tool to do so is: SQLiteStudio
You need to copy your data from the old meter to a new table, then modify the hardware id's in the new table, then insert into existing table.
Take some copies of your database and use a domoticz test application on your desktop or test rpi, and apply on that setup.
rpi4 - zigbee2mqtt - roborock - espeasy - rfxcom - homewizard p1 - otgw - homebridge - surveillance station - egardia - goodwe - open weather map - wol - BBQ detection - rsync backup
-
- Posts: 497
- Joined: Friday 22 May 2015 12:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.11083
- Location: Asten NB Nederland
- Contact:
Re: Energy meter replacement with retention of historical data
so a small howto:
in Domoticz go to settings tab backup/restore
- backup your dbase
- open it in sqlite
- open the older dbase also in sqlite
- export the desired table of the latest dbase to csv
- copy the new data from the older database
- paste them in the csv
- save it
- delete the table in the latest dbase
- import the csv file in the latest dbase
- restore the newest dbase in domoticz
Maybe a point of attention:
Don't delete the header data
Sometimes the csv file has a format for the date as 03-02-2020
Most time the dateformat in the dbase is as 2020-03-02
So change the format in the csv accordanly to the format in your database.
finished!
succes!!
Jan
in Domoticz go to settings tab backup/restore
- backup your dbase
- open it in sqlite
- open the older dbase also in sqlite
- export the desired table of the latest dbase to csv
- copy the new data from the older database
- paste them in the csv
- save it
- delete the table in the latest dbase
- import the csv file in the latest dbase
- restore the newest dbase in domoticz
Maybe a point of attention:
Don't delete the header data
Sometimes the csv file has a format for the date as 03-02-2020
Most time the dateformat in the dbase is as 2020-03-02
So change the format in the csv accordanly to the format in your database.
finished!

succes!!
Jan
Your mind is like a parachute,
It only works when it is opened!
RPI4 several Fibaro, KaKu, Neocoolcam switches, Z-Wave, Zigbee2Mqtt, Ikea bulbs and remote, Zigbee temp nodes
It only works when it is opened!
RPI4 several Fibaro, KaKu, Neocoolcam switches, Z-Wave, Zigbee2Mqtt, Ikea bulbs and remote, Zigbee temp nodes
-
- Posts: 1
- Joined: Monday 24 March 2025 17:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Energy meter replacement with retention of historical data
The data for the new meter will have a new, lower value of the 'Counter' field: It will normally start at 0 with a new meter. The (electricity) meter supplies both actual power (Watt) and energy (kWh). How is this handled? I tried it and the month where the Counter drops to a lower value is missing from the yearly graph. All other months, including the ones with the old, higher Counter values are shown correctly.
I understand that for showing daily and weekly energy consumption the Values (Watt) are used (per 5-minute intervals and summed). For the monthly data the Counter values (kWh) are used (by subtraction)?
I understand that for showing daily and weekly energy consumption the Values (Watt) are used (per 5-minute intervals and summed). For the monthly data the Counter values (kWh) are used (by subtraction)?
Who is online
Users browsing this forum: No registered users and 1 guest