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.
Clear future history Topic is solved
Moderators: leecollings, remb0
- 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
install sqlitebrowser (https://sqlitebrowser.org)
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
example
don't forget to write changes
start domoticz
Code: Select all
sudo apt-get install sqlitebrowser
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'
Code: Select all
delete from MultiMeter_Calendar
where date > '2021-08-31'
start domoticz
Regards,
Rob
Rob
Re: Clear future history
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¶m=deletedaterange&idx=IDX&fromdate=FROMDATE&todate=TODATE
/json.htm?type=command¶m=deletedaterange&idx=IDX&fromdate=FROMDATE&todate=TODATE
Who is online
Users browsing this forum: No registered users and 0 guests