nebgor / sma-bluetooth

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

Occasional "Date Error" #83

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'm occasionally (about 3 times error vs. 1 times good) getting the following 
problem:

2012-06-01 05:46:15 Unit Serial          = 3821139 none                
2012-06-01 05:46:15 NO DATA for 1f 82 = 8001 NO UNITS                  
2012-06-01 05:46:15 NO DATA for 20 82 = 9067 NO UNITS                  
2001-01-01 01:00:09 NO DATA for 21 82 = 601 NO UNITS                   
2001-01-01 01:00:09 NO DATA for 21 82 = 636 NO UNITS                   
2012-06-01 16:03:37 Total Power          = 1998 Watts                  
2012-06-01 16:03:35 Max Phase 1          = 12000 Watts                 
2012-06-01 16:03:35 Max Phase 2          = 12000 Watts                 
2012-06-01 16:03:35 Max Pahse 3          = 12000 Watts                 
2012-06-01 16:03:35 Unknown              = 0 Unknown                   
2012-06-01 16:03:35 Unknown              = 0 Unknown                   
2012-06-01 16:03:35 NO DATA for 80 41 = 0 NO UNITS                     
2012-06-01 16:03:37 Output Phase 1       = 660 Watts                   
2012-06-01 16:03:37 Output Phase 2       = 666 Watts                   
2012-06-01 16:03:37 Output Phase 3       = 672 Watts                   
2012-06-01 16:03:37 Line Voltage Phase 1Volts = 232 Volts               
2012-06-01 16:03:37 Line Voltage Phase 2Volts = 234 Volts               
2012-06-01 16:03:37 Line Voltage Phase 3Volts = 234 Volts               
2012-06-01 16:03:37 Line Current Phase 1Amps = 3 Amps                   
2012-06-01 16:03:37 Line Current Phase 2Amps = 3 Amps                   
2012-06-01 16:03:37 Line Current Phase 3Amps = 3 Amps                   
2012-06-01 16:03:37 Grid Frequency       = 50 Hertz                     

22/8/1970 15:58:08  total=18446180161683456.000 Kwh current=0 Watts togo=0 i=11 
crc=1
1/1/1970 01:04:15  total=0.000 Kwh current=-221354173485073563648 Watts togo=0 
i=23 crc=1Date Error! prev=20185088 current=255                                 

Attached is the log of

./smatool  -d -v -from "2012-06-01 14:00:00" -to "2012-06-01 15:00:00" --test

ran once getting the error, and once getting the correct results.

Original issue reported on code.google.com by ste...@gmx.de on 1 Jun 2012 at 3:51

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,
with a comment from Stefan Verkoyen i made a UGLY HACK to smatool.c. For now my 
system runs fine without the Date Error.

You can find my code in my smatool clone janus44444-sma-bluetooth

I have added all inverter codes i have found so far, too. Next thing is a test 
where i will remove some lines from sma.in.new to make smatool running a little 
bit faster without asking so much for bluetooth signal strenght.

Janus

Original comment by janus44...@gmail.com on 10 Jun 2012 at 12:25

GoogleCodeExporter commented 8 years ago
I've been seeing this too - so I took a look at the code - there is a bug in 
ConvertStreamtoTime().

      if( stream[i] != 0xff ) //check if all ffs which is a null value
        nullvalue = 0;
      (*value) = (*value) + stream[i]*pow(256,i);

This clears nullvalue if the char is not 0xff. But it sets (*value) even if the 
char *IS* 0xff.

I suspect the correct code should be:

      if( stream[i] != 0xff ) { //check if all ffs which is a null value
        nullvalue = 0;
      (*value) = (*value) + stream[i]*pow(256,i);
      }

Original comment by coli...@gmail.com on 3 Nov 2012 at 2:11

GoogleCodeExporter commented 8 years ago
regarding comment #2:

did you test that fix for yourself? Does not seem to fix anything for me.

as far as i understand the code, the original version seems more correct.
(we want the value to be copied unless *all* entries in stream are set to 0xff, 
so it is done like that: always copy and if all were 0xff, set to zero again in 
the end).

Original comment by ste...@gmx.de on 13 Nov 2012 at 4:31

GoogleCodeExporter commented 8 years ago
janus444444 clone seems to work fine so far - maybe you can give some insight 
as to get this right upstream, janus?

Original comment by ste...@gmx.de on 13 Nov 2012 at 4:56