Replace a device and conserve history

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
Unrender
Posts: 5
Joined: Sunday 22 April 2018 20:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Replace a device and conserve history

Post by Unrender »

Hi,

I reset a OWL Micro+180 because it didn't send anymore data to domoticz.
So, I have to restore the backup of the database, add the new device, and replace with the old one to have the entire history of the device.

But I have a problem. One data ("Utilisation de l'énergie") in the 7 days graph is stuck at zero and I don't know why.
If I look in the database, the new values are below than the older one. I think the problem comes here.
But if I change theses values, the problem will occurs again.

Have you an idea please ?

Thanks a lot.
Attachments
Capture d’écran 2018-04-22 à 10.46.33 copie.jpg
Capture d’écran 2018-04-22 à 10.46.33 copie.jpg (165.46 KiB) Viewed 1641 times
Capture d’écran 2018-04-22 à 16.16.47.png
Capture d’écran 2018-04-22 à 16.16.47.png (290.03 KiB) Viewed 1642 times
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Replace a device and conserve history

Post by waaren »

Unrender wrote: Sunday 22 April 2018 21:05 ...

One data ("Utilisation de l'énergie") in the 7 days graph is stuck at zero and I don't know why.
If I look in the database, the new values are below than the older one. I think the problem comes here.
But if I change theses values, the problem will occurs again.
...
Recent data for this type of data is stored in the Meter table. Older data is summarized and moved to Meter_Calender.
So if you want manipulate the values of this device in the database you have to do that in both tables.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Unrender
Posts: 5
Joined: Sunday 22 April 2018 20:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Replace a device and conserve history

Post by Unrender »

I tried but it makes wrong data -> consumption of more than 300.000 kWh for a day :lol:
And after doing that, at the next send of data, it show again 0 kWh in the first graph.
Unrender
Posts: 5
Joined: Sunday 22 April 2018 20:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Replace a device and conserve history

Post by Unrender »

Nobody has the same problem ?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Replace a device and conserve history

Post by waaren »

What is the hardware, type and subtype of this device ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Unrender
Posts: 5
Joined: Sunday 22 April 2018 20:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Replace a device and conserve history

Post by Unrender »

It's an OWL Micro+ CM180 (used with RFLink).
Type General and Subtype kWh.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Replace a device and conserve history

Post by waaren »

Unrender wrote: Monday 23 April 2018 18:53 It's an OWL Micro+ CM180 (used with RFLink).
Type General and Subtype kWh.
If I look at what the domoticz flow is with a similar sensor-device I use:

sensor updates DeviceStatus table (sValue field) with "usage;counter" -- independent of what is already in the database
DeviceStatus.sValue is copied to Meter table counter -> Value and computed usage -> Usage -- every 5 minutes
Meter.Value -> Meter_Calendar.Counter and computed Meter.Usage -> Meter_Calendar.Value -- once a day

So whatever you change in the database will not change what comes from the sensor-device. If you cannot access the memory of the sensor-device and change the counter there you are kind of stuck.

The only possible other work-around I can think of is creating a database trigger that modifies the values coming from the DeviceStatus table to the Meter table. My SQL knowledge is far to rusty to create such a trigger without messing up your data even further but there must be enough database guru's around on this forum...
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Unrender
Posts: 5
Joined: Sunday 22 April 2018 20:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Replace a device and conserve history

Post by Unrender »

Hum OK.
It gets to hard for me :)
Never mind for the history.

I prefere start all over again.
I think it's better.

Thank you for your answers guy ;)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest