Page 1 of 1
Replace a device and conserve history
Posted: Sunday 22 April 2018 21:05
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.
Re: Replace a device and conserve history
Posted: Sunday 22 April 2018 21:51
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.
Re: Replace a device and conserve history
Posted: Sunday 22 April 2018 22:45
by Unrender
I tried but it makes wrong data -> consumption of more than 300.000 kWh for a day
And after doing that, at the next send of data, it show again 0 kWh in the first graph.
Re: Replace a device and conserve history
Posted: Monday 23 April 2018 15:19
by Unrender
Nobody has the same problem ?
Re: Replace a device and conserve history
Posted: Monday 23 April 2018 16:00
by waaren
What is the hardware, type and subtype of this device ?
Re: Replace a device and conserve history
Posted: Monday 23 April 2018 18:53
by Unrender
It's an OWL Micro+ CM180 (used with RFLink).
Type General and Subtype kWh.
Re: Replace a device and conserve history
Posted: Monday 23 April 2018 23:36
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...
Re: Replace a device and conserve history
Posted: Wednesday 25 April 2018 17:56
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
