Page 1 of 2

How to do reduce log interval

Posted: Sunday 24 January 2016 17:11
by ricard
Hi,

I would like to reduce the log interval from 5 minutes to 1 minute.

Which file of the source code do I need to modify and re-build?

Thank you

Re: How to do reduce log interval

Posted: Sunday 24 January 2016 21:49
by nayr
what?

There is no log interval.. if you dont have activity there is nothing to log.. or are you wanting higher resolution on the graphs?

Re: How to do reduce log interval

Posted: Sunday 24 January 2016 22:12
by ricard
Yes, I would like to have higher resolution on the graphs/data logged.

Re: How to do reduce log interval

Posted: Sunday 24 January 2016 22:13
by Egregius
I think it would be better to have a setting per switch.
I would definitely don't wanna have records of all temps and setpoints every minute. That would be over a million records a month.

Re: How to do reduce log interval

Posted: Sunday 24 January 2016 22:21
by ricard
My intention is to modify the code so that the interval is 1 minute instead of 5 minutes, and only log/record the value if the deviation is more than 10%.

Re: How to do reduce log interval

Posted: Monday 25 January 2016 7:32
by Egregius
I guess the graphs can't handle gaps in the timings. What else could be the reason for storing the same value every 5 minutes?
I only keep temperature data of the last 12 hours and that's 3400 records.
I like to keep the database as small as possible, seems to be much faster and stable that way. Every night I remove records of temperature, meter, percentage devices I don't care about.

Re: How to do reduce log interval

Posted: Monday 25 January 2016 21:57
by ricard
Dear Egregius,
"The man who says it can't be done... shouldn't interrupt the man who is trying to do it"

I would like to reduce the log interval from 5 minutes to 1 minute.
I am happy to work with the source code, and I would appreciate if somebody can tell me which are the file/s that I will need to modify.
Thank you

Re: How to do reduce log interval

Posted: Monday 25 January 2016 23:17
by Egregius
Sorry for giving my opinion in a discussion board.

Re: How to do reduce log interval

Posted: Monday 25 January 2016 23:50
by ricard
I couldn't find an appropriate subforum, so I wrote my question in here.

I am trying to make a Historian and I would appreciate any constructive ideas/opinions.

Re: How to do reduce log interval

Posted: Monday 25 January 2016 23:55
by nayr
the only way to learn the code base is to start digging into it, it would take longer to try to explain it than it would be to just implement it.. Ive been hacking at it for a while and still dont have a solid grasp of where everything is done at.. its alot of lines to look through.

the code is all yours, let us know what you come up with.. sorry I cant help you, Ive been avoiding mucking with the datasets directly until I better understand the consequences of my actions.

Re: How to do reduce log interval

Posted: Tuesday 26 January 2016 0:03
by ricard
I think it I can change it in the SQLHelper.cpp file.

But as you said, there is a lot of code to dig.

It would be great if someone could point to the right place.

Re: How to do reduce log interval

Posted: Sunday 07 February 2016 12:25
by ricard
Just in case someone is interested (which I think there will be more than one)

I have successfully changed the log interval from 5 minutes to 1 minute by changing the iShortLogInterval in the SQLServer.cpp

And then rebuilding/re-making the code

Re: How to do reduce log interval

Posted: Sunday 07 February 2016 13:07
by gizmocuz
you have to remove 2 lines in the SQLServer.cpp and then you can change it in the database (actually the html code is also there but hidden)

Code: Select all

	if (!GetPreferencesVar("ShortLogInterval", nValue))
	{
		nValue = 5;
		UpdatePreferencesVar("ShortLogInterval", nValue);
	}
then underneed remove these two lines

Code: Select all

	if (nValue < 1)
		nValue = 5;
i probably must have some good reason not to expose this yet ?

Re: How to do reduce log interval

Posted: Sunday 07 February 2016 14:19
by ricard
Hi gizmocuz

Thank you for the additional information.

Re: How to do reduce log interval

Posted: Sunday 07 February 2016 14:22
by bizziebis
I think with the right explanation next to the option a person should have the possibility to change the value from settings. Or are there any caveats when changing to a smaller interval?
I can imagine a fast growing database and a less responsive interface due to large json requests.

Re: How to do reduce log interval

Posted: Sunday 07 February 2016 14:27
by Egregius
Everyone has a specific reason for settings like this. I would't lower it, instead rise to 10 or 15 :p
Speed is more important than a graph for me.
But, as said before: the best option would be to set it for every sensor seperately.

Re: How to do reduce log interval

Posted: Sunday 07 February 2016 14:29
by gizmocuz
there has been another approach offered on this forum, if value is different then the last value in the log, add the value
could be worth investigating by someone

Re: How to do reduce log interval

Posted: Sunday 07 February 2016 15:02
by Egregius
That would even be a better solution :)
If it doesn't break the graphs that is.
In my situation I have a record every 5 minute in each room for a thermometer, a setpoint and a radiator valve. Especially for the setpoints it's very repitive data in the tables.

Re: How to do reduce log interval

Posted: Tuesday 08 March 2016 14:15
by delchrys
gizmocuz wrote:you have to remove 2 lines in the SQLServer.cpp and then you can change it in the database (actually the html code is also there but hidden)

Code: Select all

	if (!GetPreferencesVar("ShortLogInterval", nValue))
	{
		nValue = 5;
		UpdatePreferencesVar("ShortLogInterval", nValue);
	}
then underneed remove these two lines

Code: Select all

	if (nValue < 1)
		nValue = 5;
i probably must have some good reason not to expose this yet ?
Which file do we need to edit to change logging to 1 minute, is it SQLHelper.cpp or SQLServer.cpp??
I tried it in SQLHelper.cpp and rebuild it with
gcc -c SQLHelper.cpp
And then again the:
make -j 4
But when i reboot the pi and/or reboot domoticz, i still have 5 min intervals.
Am i doing something wrong???

Re: How to do reduce log interval

Posted: Tuesday 08 March 2016 17:17
by gizmocuz
Did you also made a change in the database as mentioned ?