Announcement

Collapse
No announcement yet.

Mirroring/intercepting SunPower Monitoring Traffic?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #76
    Originally posted by ehampshire View Post

    I had a question about your regular expressions. I'm terrible at regex, it confuses me. I did have to modify your regex to look for 2017 in the timestamp, but I'm wondering if there's a better way to write the regex so it doesn't have to be modified yearly.

    ...
    It looks like each of my panels are reporting on the 130 lines, so I can break those out into my own DB / web portal. I'm having a hard time deciphering the rest of the lines, though. I believe the 1st number (ie. "18.5466" in the first 130 line) is the Watts, the 2nd number (ie. "0.0417") is the kWh, but those are mostly guesses.

    ...
    I get lost after that as to what the rest of the values are.
    Not trying to be a troll here, but the first question is elementary. Not sure how you've gone this far without knowing about variables and date grabbing functions. It is even discussed at the top of page 5.


    As for your second, the answer was provided by Rob above in his code itself:

    if ($msg == 140) { # this is a net metering message, and $value is net metering value in (IIRC) W averaged over the 5-minute interval
    # consumption = (corresponding production) + net
    }
    else { # this is a production message, and $value is a production valuein (IIRC) W averaged over the 5-minute interval
    }


    the hardest part is in what he wrote next

    >>> (One of) the (many) trick(s) involved herein is how you deal with calculating consumption from net and production... They do not necessarily arrive in the same packet (although they often do) nor does production (130) always arrive before net (140).

    and the following paragraph about handling the kwh value provided in the dump about net, production, and corresponding production row dump.

    good luck, there is a lot of critical technical discussion in the last couple pages I order to make this script your own.
    Last edited by cebury; 01-08-2017, 02:16 AM.

    Comment


    • #77
      Not trying to be a troll here, but the first question is elementary. Not sure how you've gone this far without knowing about variables and date grabbing functions. It is even discussed at the top of page 5.
      I understand variables and dealing with dates. I do program for my job, after all, but not in Perl. Always hated Perl, OO Perl is torture. Also, don't like regular expressions, which I stated. Never been good at them. I realize they can be super powerful, but I just don't get them. I've since switched the regex to not parse things for me. I'm writing the entire line to a log file and going to deal with the processing of the lines in a language I'm better at (Python or Java) and don't have to google for every little thing.

      good luck, there is a lot of critical technical discussion in the last couple pages I order to make this script your own.
      I very much AM doing just that. Thought I would ask for some help here and additional insight. This thread is the top google hit and the most informative for anyone looking for more detail than they can get in the existing SunPower portal. The general consensus of this thread is "read the thread and digest" (which I've done numerous times) and then mostly "figure it out for yourself". I don't understand the resistance to helping make it easier for others to follow in your tracks. Is it a legal fear?


      Also, the main point of my post was asking if anyone had figured out what all those other columns are. I understand you guys are processing what is sent up to SunPower and getting more detailed info for the net and production values, but is there any use for the rest of the data?

      Comment


      • #78
        i am parsing 130 with the following code (kind of a mess, and i don't know what all the fields mean)
        # message 130 seems to have missing fields when the sun
        # goes down, hence the complexity of this match
        # expression. it was created from a daytime and evening
        # message 130 using regrxr.com.

        my ($sm_time, $sm_tot_kwh, $peak_pwr, $dummy1,
        $dummy2, $dummy3, $dc_volts, $dummy4,
        $dummy5, $dummy6, $inv_temp_c, $dummy7, $sm_freq) =

        $_ =~ m/130\s+(\d+)\s+\d+\s+SMA-SB-5000TL-US-22\s+(\d+\.\d+)\s((\d+.\d+)|\d)\s+((\d+\.\d+)|\d)\ s((\d+\.\d+)|\d)\s((\d+\.\d+)|\d)\s((\d+\.\d+)|\d+ )\s((\d+\.\d+)|\d)\s\d/;

        if ((not defined $sm_time) or (not defined $peak_pwr) or
        (not defined $sm_tot_kwh) or (not defined $dc_volts) or
        (not defined $inv_temp_c)) {
        # OK, give up...
        $bad_parse = 1;
        }
        that's obviously tied to my particular inverter's model number so you'd have to change that based on what you see in your message 130.


        Comment


        • #79
          Thanks, astroboy! That's actually pretty useful as you've figured out more fields than I certainly have. How did you know some what some of the values were, like the Temperature and DC Volts? Also, can you explain what $sm_freq and $peak_pwr is? An example line from your tcpdump would be helpful too (ie. the full line like below).

          For instance, here's one of mine that just went by:

          130 20170114185000 414051637006544 AC_Module_Type_C 20.9279 0.0491 244.7866 0.4237 0.0515 58.1278 0.8935 20.375 59.997 0
          I know we have different inverters (looks like you have a Sunnyboy string inverter, I have micro inverters, so I get 24 of these 130 lines to match the number of panels I have). If I assume that the 3rd to the last is the temp (like yours), that would be 20C = 68F. Doesn't seem that likely as it's only 32F out there, unless the panels heat up a lot compared to ambient temperature (the sun is behind clouds, so again, doubtful).

          Comment


          • #80
            Originally posted by ehampshire View Post
            Thanks, astroboy! That's actually pretty useful as you've figured out more fields than I certainly have. How did you know some what some of the values were, like the Temperature and DC Volts? Also, can you explain what $sm_freq and $peak_pwr is? An example line from your tcpdump would be helpful too (ie. the full line like below).

            For instance, here's one of mine that just went by:



            I know we have different inverters (looks like you have a Sunnyboy string inverter, I have micro inverters, so I get 24 of these 130 lines to match the number of panels I have). If I assume that the 3rd to the last is the temp (like yours), that would be 20C = 68F. Doesn't seem that likely as it's only 32F out there, unless the panels heat up a lot compared to ambient temperature (the sun is behind clouds, so again, doubtful).
            to figure these things out i went to the "old" sunpower monitoring site which can show everything the inverter reports, and painstakingly matched them up. all the "dummy" values are things that i just could not figure out, or seemed not worth tracking. i had a lot of trouble with it until i realized that there were fields missing when the sun had gone down yet the monitor was still producing 130s. a while after sunset, it stops sending 130s and only sends 100s. regrxr.com is really useful to test your match string, there's no way i could have come up with that string without it.

            in my case the temperature is the inverter heatsink temperature, so 68F is probably a normal temperature for the heatsink at 32F ambient. i assume that they want to monitor this because once it reaches 80C+ it's probably time to shut down the inverter or at least drop the power output to avoid damage to the power transistors in the inverter. do your 130s show some variation in those temperatures? i would expect that since each inverter has its own heatsink...

            sm_freq is apparently the inverter's AC waveform frequency. peak_pwr is the peak output power seen during the 5 minutes that the 130 sample covers. rather than trying to convert this to an energy, and since the monitor outputs the cumulative generated energy since commissioning and PVOutput accepts a cumulative energy value, i stopped trying to compute the interval energy and just report the cumulative power to PVO.

            i'll find a 130 line later today, i need to step out soon.





            Comment


            • #81
              this is how i think my 130 message breaks down:
              YYYYMMDDHHMMSS (UTC) inverter serial # inverter name just a tab total lifetime nrg (kwh) peak AC power just a tab ?? - sometimes just a tab avg dc voltage avg dc current inverter heatsink, degC frequency ? reactive power
              130 20170115201000 XXXXXXXXXX SMA-SB-5000TL-US-22 9485.6914 2.713 1.3638 283.8639 4.8077 34.335 59.98 290

              Comment

              Working...
              X