bravohe / sma-bluetooth

Automatically exported from code.google.com/p/sma-bluetooth
0 stars 0 forks source link

Patch for /smatool.c - Handle the missing midnight stamp (00:00:00) issue #91

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Not all inverters (like the SMA 2100TL) are generating a midnight time stamp. 
Most likely because these inverters are going to sleep once the sun sets.

This patch determines the start of day value, which is used for pvoutput, by 
looking at the 1st entry of the day.

The maximum number of history days is adjusted to 13 days, this safely below 
the 14 day history limit imposed by pvoutput; seems to be related to timezone 
issues.

Original issue reported on code.google.com by ysbrand....@gmail.com on 9 Aug 2012 at 7:03

Attachments:

GoogleCodeExporter commented 9 years ago
Hi ysbrand,

I was very interested to find this patch as I am using a SB2500 which doesn't 
record any values when there is not enough light. I cam up with a very similar 
solution using a sub-query. I tested both methods and yours was much faster so 
I used your patch.

There is a similar problem with the repost code which relies on a record at 
"23:55:00" each day. I tested various queries and found that this one produces 
the same result as when there are "23:55:00" records.

sprintf(SQLQUERY,"SELECT DATE(DateTime) as ts_date, ROUND((MAX(EtotalToday) - 
MIN(EtotalToday))*1000) FROM DayData GROUP BY ts_date ORDER BY ts_date DESC" );

This is very simple and runs quickly so I don't think it can be optimized any 
better but wanted to know what you thought because I think your SQL skills are 
better than mine.

Cheers

Original comment by brunofa...@gmail.com on 19 Dec 2012 at 10:02

GoogleCodeExporter commented 9 years ago
Can you tell me how to perform this patch?

Original comment by hoi...@gmail.com on 25 Jul 2013 at 9:58

GoogleCodeExporter commented 9 years ago
The patch file is created with the unix command "diff" and can be applied
with the unix command "patch".

If you are familiar with unix then use "man" to find out how to use diff
and patch. If all you want to do is apply the patch file you just need to
know how to use the "patch" command.

Hope that helps.

Original comment by brunofa...@gmail.com on 25 Jul 2013 at 10:41