Let's man-in-the-middle the traffic
January 01, 2017
Finally got the SunPower PV monitor hooked up. Now, onto the hacking!
First up, I needed to "force" the PV monitor to talk over it's powerline module. I had it forget my wireless network by plugging into the PV monitor's setup port and stepping through the setup until I got to the network connectivity settings.
Now, I needed to buy a switch that would let me mirror a port so I could "man-in-the-middle" the traffic from the powerline module to the SunPower portal. I bought this one. I then mirrored the traffic from the port the powerline module was plugged into TO the port my BeagleBone Black was plugged into. That told the switch to mirror all the traffic the powerline was sending to the BeagleBone Black.
I had a BeagleBone Black lying around, so I decided to use that to sniff the traffic. You could easily do this with a Raspberry Pi instead, but something running some form of Linux is advisable. Install tcpdump and libpcap so that you can do some sanity checking on the data coming across the line. You don't want to see all the traffic, so you need to filter by either the source IP (of the PV monitor) or the destination (of the SunPower portal site). Here's an example of both ways:
First up, I needed to "force" the PV monitor to talk over it's powerline module. I had it forget my wireless network by plugging into the PV monitor's setup port and stepping through the setup until I got to the network connectivity settings.
Now, I needed to buy a switch that would let me mirror a port so I could "man-in-the-middle" the traffic from the powerline module to the SunPower portal. I bought this one. I then mirrored the traffic from the port the powerline module was plugged into TO the port my BeagleBone Black was plugged into. That told the switch to mirror all the traffic the powerline was sending to the BeagleBone Black.
I had a BeagleBone Black lying around, so I decided to use that to sniff the traffic. You could easily do this with a Raspberry Pi instead, but something running some form of Linux is advisable. Install tcpdump and libpcap so that you can do some sanity checking on the data coming across the line. You don't want to see all the traffic, so you need to filter by either the source IP (of the PV monitor) or the destination (of the SunPower portal site). Here's an example of both ways:
# IP of PV Monitor
tcpdump -w /mnt/mydrive/sp-pkts2.pcap -U -i eth0 'ip && tcp && src 10.0.1.139'
# collector.sunpowermonitor.com
tcpdump -w /mnt/mydrive/sp-pkts2.pcap -U -i eth0 'ip && tcp && dst net 204.194.111.66'
Doing a "tail -f" of the log files specified with the "-w" command should show some traffic coming across the line. Every 5 minutes the SunPower PV monitor will report the power generated and consumed. I captured the traffic for 10 or 15 minutes and then loaded the packet capture file into WireShark to make it easy to find the data I was interested in.