Clear future history Topic is solved

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
xayide
Posts: 9
Joined: Monday 30 June 2014 13:41
Target OS: Linux
Domoticz version:
Contact:

Clear future history

Post by xayide »

I have had an accident where the date was wrong by a few years and domoticz logged history in the future so to speak. This renders all graphs to simple flatline. How can I remove all history logs for all devices from current time (+ 1minute) and forwards?

I have a few hundred devices so it will be timeconsuming to do this manually and preferable a SQL would help. I found an API that could do this on a per device manner, but it's very time consuming.
User avatar
erem
Posts: 230
Joined: Tuesday 27 March 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Amsterdam/netherlands
Contact:

Re: Clear future history

Post by erem »

install sqlitebrowser (https://sqlitebrowser.org)

Code: Select all

sudo apt-get install sqlitebrowser
stop domoticz
backup database
open database with sqlitebrowser
from the execute sql tab:

delete the future records from the *_calendar tables
with this statement for each *_calendar table that has future dates

Code: Select all

delete from <tablename>_Calendar
where date > '2021-08-31'
example

Code: Select all

delete from MultiMeter_Calendar
where date > '2021-08-31'
don't forget to write changes
start domoticz
Regards,

Rob
xayide
Posts: 9
Joined: Monday 30 June 2014 13:41
Target OS: Linux
Domoticz version:
Contact:

Re: Clear future history

Post by xayide »

Wow thank you. So it is an ordinary sqlite-db. I was thinking along the lines of using the webapi but felt on the number devices…

/json.htm?type=command&param=deletedaterange&idx=IDX&fromdate=FROMDATE&todate=TODATE
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest