jgyates / genmon

Generac (and other models) Generator Monitoring using a Raspberry Pi and WiFi
GNU General Public License v2.0
385 stars 79 forks source link

Best Approach For New Installation #941

Closed ssmoss closed 1 year ago

ssmoss commented 1 year ago

I wanted to start by saying thank you for making this software. It really should replace the MobileLink offering as it is a thousand times better.

I am going to be getting a 22kW Air Cool Generac unit and I am trying to figure out the best way to get genmon up and running. My understanding is that my unit is going to have the wireless module installed which will block the connector port needed by genmon.

After looking over the wiki it seems that the awesome folk(s) at PintSize.Me created a solution to the problem which is this spliter and I really like the improvements in V1.1 though I do have a question about the disclaimer:

The splitter and RJ45 injector/ejector we currently are shipping (v1.1) physically divides the data pins so that one side is RS485 and the other is RS232 to ensure that only 1 RS232 device is connected; however, we do not know what the behavior of combo MobileLink interfaces that try to use both would be when connected to the RS485 only side.

I am assuming the V1.1 has been tested and works so is this saying something could change in the future which could pose an issue? I believe after 2018 of the Guardian Series air-cooled come with it pre-installed.

It seemed that powering the Pi from the controller connector via the GPIO connector is a very clean solution in conjunction with using one of HATs / pHATs from PintSize.Me. It also seemed like it had the added benefit of surge protection from something like a lightning strike as the controller fuse would protect against something like that (unless I am understanding something incorrectly). Then I came upon this this disclaimer:

NOTE: Some people have reported undervoltage errors on the Pi 3 (not the Pi Zero) when powering through the controller connector. While this has not been reported to prevent the application from running it may not be an ideal way to power the Pi. See [this](https://github.com/jgyates/genmon/issues/106) issue for more details.

With this I assume I could just a Pi Zero as I suspect that is more than sufficient until I saw this disclaimer:

Pi Zero, Zero W, 1, and 2 are not recommended.  Please use a Pi Zero 2, 3A+, 3B, 3B+, or 4B.

So at this point I was a little at a loss how to continue with the plan to use GPIO to power the Pi until I stumbled upon this on the Making A Cable page. It seems that Evolution 2.0 (which I believe my generator will have) now has a 12v connection along with the 5v from Evolution 1. I downloaded the instructions for the HATs / pHATs I see the following:

Onboard power converter to drop the 12v available at the generator to the 5v needed to power the Pi and HAT. There is also a rectifier after the barrel plug to prevent reversed connections.

Based on this it seems like one can use the power from the generator's controller to power Pi + HAT and using Pi 3 / 4 should work without issue? I assume since the controller needs to remain powered during an outage that powering from the controller would keep genmon running during outage / load transfer?

Is it recommend to use a fan to provide cooling? It doesn't get super hot or super cold in my area if that makes any difference.

Will placing the Pi inside an enclosure inside the generator's housing cause an issue with the wireless single? Is it recommended to get an external antenna or if the access point is within 20 feet it shouldn't be an issue?

Is a fully turn key solution available for purchase that just requires plugging it in, basically something that would just require me to unplug the wireless unit, plug-in the turn-key unit, and connect the wireless module to it?

jgyates commented 1 year ago

@ssmoss

Neither of these are new.

the USB port is for firmware upgrades. It does not support any other function. This is standard on Evolution 1.0 and 2.0 controllers.

The wireless module was introduced with Evolution 2.0. Genmon does not sue this connection a the firmware limits what is transmitted over the wireless module based on a subscription.

the short answer is, no. These two things do not provide any means of communicating to genmon.

ssmoss commented 1 year ago

@jgyates @skipfire Have either you ran into this using a USB adapter? I saw this section but the module wasn't stock so I got this which required compiling some drivers.

I initially had it going though a unpowered four port USB hub that worked fine in testing inside my house but seemed to get very unhappy once the generator turned on. I then plugged the adapter directed in it also seemed unhappy. Could this have been a vibrational issue? Power? (I am powering from the battery not via the Molex)

[ 1230.468383] usb usb1-port1: disabled by hub (EMI?), re-enabling...
[ 1230.468420] usb 1-1: USB disconnect, device number 2
[ 1230.533001] rtl8821cu 1-1:1.0: Runtime PM usage count underflow!
[ 1230.680364] Indeed it is in host mode hprt0 = 00001501
[ 1230.872320] usb 1-1: new high-speed USB device number 3 using dwc_otg
[ 1230.872506] Indeed it is in host mode hprt0 = 00001101
[ 1231.060408] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1231.060457] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1231.060481] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1231.268353] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1231.268404] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1231.268425] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1231.480322] usb 1-1: device not accepting address 3, error -71
[ 1231.480498] Indeed it is in host mode hprt0 = 00001501
[ 1231.672287] usb 1-1: new high-speed USB device number 4 using dwc_otg
[ 1231.672435] Indeed it is in host mode hprt0 = 00001101
[ 1231.880932] usb 1-1: New USB device found, idVendor=0bda, idProduct=c811, bcdDevice= 2.00
[ 1231.880962] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1231.880973] usb 1-1: Product: 802.11ac NIC
[ 1231.880982] usb 1-1: Manufacturer: Realtek
[ 1231.880991] usb 1-1: SerialNumber: 123456
[ 1234.436631] usb usb1-port1: disabled by hub (EMI?), re-enabling...
[ 1234.436690] usb 1-1: USB disconnect, device number 4
[ 1234.580565] Indeed it is in host mode hprt0 = 00001501
[ 1234.768491] usb 1-1: new high-speed USB device number 5 using dwc_otg
[ 1234.768730] Indeed it is in host mode hprt0 = 00001101
[ 1234.977327] usb 1-1: New USB device found, idVendor=0bda, idProduct=c811, bcdDevice= 2.00
[ 1234.977368] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1234.977387] usb 1-1: Product: 802.11ac NIC
[ 1234.977403] usb 1-1: Manufacturer: Realtek
[ 1234.977419] usb 1-1: SerialNumber: 123456
[ 1236.377397] usb usb1-port1: disabled by hub (EMI?), re-enabling...
[ 1236.377444] usb 1-1: USB disconnect, device number 5
[ 1236.524493] Indeed it is in host mode hprt0 = 00001501
[ 1236.712415] usb 1-1: new high-speed USB device number 6 using dwc_otg
[ 1236.712561] Indeed it is in host mode hprt0 = 00001101
[ 1236.928675] usb 1-1: device descriptor read/all, error -71
[ 1236.928813] Indeed it is in host mode hprt0 = 00001101
[ 1237.116441] usb 1-1: new high-speed USB device number 7 using dwc_otg
[ 1237.116601] Indeed it is in host mode hprt0 = 00001101
[ 1237.325041] usb 1-1: New USB device found, idVendor=0bda, idProduct=c811, bcdDevice= 2.00
[ 1237.325069] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1237.325080] usb 1-1: Product: 802.11ac NIC
[ 1237.325089] usb 1-1: Manufacturer: Realtek
[ 1237.325098] usb 1-1: SerialNumber: 123456
[ 1238.602122] usb usb1-port1: disabled by hub (EMI?), re-enabling...
[ 1238.602155] usb 1-1: USB disconnect, device number 7
[ 1238.744530] Indeed it is in host mode hprt0 = 00001501
[ 1238.932484] usb 1-1: new high-speed USB device number 8 using dwc_otg
[ 1238.932642] Indeed it is in host mode hprt0 = 00001101
[ 1239.141066] usb 1-1: New USB device found, idVendor=0bda, idProduct=c811, bcdDevice= 2.00
[ 1239.141095] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1239.141106] usb 1-1: Product: 802.11ac NIC
[ 1239.141115] usb 1-1: Manufacturer: Realtek
[ 1239.141124] usb 1-1: SerialNumber: 123456
[ 1240.350437] usb usb1-port1: disabled by hub (EMI?), re-enabling...
[ 1240.350472] usb 1-1: USB disconnect, device number 8
[ 1240.492646] Indeed it is in host mode hprt0 = 00001501
[ 1240.624834] Indeed it is in host mode hprt0 = 00001501
[ 1240.952523] usb 1-1: new high-speed USB device number 9 using dwc_otg
[ 1240.952849] Indeed it is in host mode hprt0 = 00001101
[ 1241.140511] usb 1-1: device descriptor read/64, error -71
[ 1241.248654] Indeed it is in host mode hprt0 = 00001101
[ 1241.456550] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1241.456587] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1241.456605] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1241.457356] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1241.457387] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1241.457413] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1241.457800] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1241.457825] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1241.457847] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1241.458256] usb 1-1: device descriptor read/all, error -71
[ 1241.458358] Indeed it is in host mode hprt0 = 00001501
[ 1241.584583] Indeed it is in host mode hprt0 = 00001501
[ 1241.912545] usb 1-1: new high-speed USB device number 10 using dwc_otg
[ 1241.912693] Indeed it is in host mode hprt0 = 00001101
[ 1242.121091] usb 1-1: New USB device found, idVendor=0bda, idProduct=c811, bcdDevice= 2.00
[ 1242.121119] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1242.121130] usb 1-1: Product: 802.11ac NIC
[ 1242.121139] usb 1-1: Manufacturer: Realtek
[ 1242.121148] usb 1-1: SerialNumber: 123456
[ 1243.284742] usb usb1-port1: disabled by hub (EMI?), re-enabling...
[ 1243.284773] usb 1-1: USB disconnect, device number 10
[ 1243.428639] Indeed it is in host mode hprt0 = 00001501
[ 1243.620682] usb 1-1: new high-speed USB device number 11 using dwc_otg
[ 1243.621094] Indeed it is in host mode hprt0 = 00001101
[ 1243.808590] usb 1-1: device descriptor read/64, error -71
[ 1243.916718] Indeed it is in host mode hprt0 = 00001101
[ 1244.044642] Indeed it is in host mode hprt0 = 00001501
[ 1244.393448] usb 1-1: New USB device found, idVendor=0bda, idProduct=c811, bcdDevice= 2.00
[ 1244.393477] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1244.393488] usb 1-1: Product: 802.11ac NIC
[ 1244.393497] usb 1-1: Manufacturer: Realtek
[ 1244.393506] usb 1-1: SerialNumber: 123456
[ 1245.589320] usb usb1-port1: disabled by hub (EMI?), re-enabling...
[ 1245.589353] usb 1-1: USB disconnect, device number 11
[ 1245.732710] Indeed it is in host mode hprt0 = 00001501
[ 1245.920634] usb 1-1: new high-speed USB device number 12 using dwc_otg
[ 1245.920801] Indeed it is in host mode hprt0 = 00001101
[ 1246.129227] usb 1-1: New USB device found, idVendor=0bda, idProduct=c811, bcdDevice= 2.00
[ 1246.129255] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1246.129266] usb 1-1: Product: 802.11ac NIC
[ 1246.129275] usb 1-1: Manufacturer: Realtek
[ 1246.129284] usb 1-1: SerialNumber: 123456
[ 1247.314134] usb usb1-port1: disabled by hub (EMI?), re-enabling...
[ 1247.314166] usb 1-1: USB disconnect, device number 12
[ 1247.456758] Indeed it is in host mode hprt0 = 00001501
[ 1247.644674] usb 1-1: new high-speed USB device number 13 using dwc_otg
[ 1247.644828] Indeed it is in host mode hprt0 = 00001101
[ 1247.853341] usb 1-1: New USB device found, idVendor=0bda, idProduct=c811, bcdDevice= 2.00
[ 1247.853381] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1247.853392] usb 1-1: Product: 802.11ac NIC
[ 1247.853401] usb 1-1: Manufacturer: Realtek
[ 1247.853410] usb 1-1: SerialNumber: 123456
[ 1249.023536] usb usb1-port1: disabled by hub (EMI?), re-enabling...
[ 1249.023570] usb 1-1: USB disconnect, device number 13
[ 1249.164778] Indeed it is in host mode hprt0 = 00001501
[ 1249.352775] usb 1-1: new high-speed USB device number 14 using dwc_otg
[ 1249.352934] Indeed it is in host mode hprt0 = 00001101
[ 1249.560993] usb 1-1: device descriptor read/all, error -71
[ 1249.561118] Indeed it is in host mode hprt0 = 00001101
[ 1249.748716] usb 1-1: new high-speed USB device number 15 using dwc_otg
[ 1249.748865] Indeed it is in host mode hprt0 = 00001101
[ 1249.936771] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1249.936809] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1249.936827] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1250.144836] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1250.144886] NYET/NAK/ACK/other in non-error case, 0x00000002
[ 1250.144914] NYET/NAK/ACK/other in non-error case, 0x00000002

I was able to find one based on the same chipset from eBay which I will try next.

skipfire commented 1 year ago

Sorry @ssmoss, I've never used a USB network adapter (WiFi or Ethernet) with a Pi.

jgyates commented 1 year ago

I have not had this exact issue, but powering devices over USB can be an issue on the pi. There is a limit on what the pi can source in terms of current to the USB device and the pi's power supply must be up to the task as well. Unfortunately I don't know the exact limits and I assume the change with each pi version so google will likely provide better answers that I can. Keep in mind that adding a hub will add to the total USB power requirements. You may be better off using a USB-A extension instead of a hub as the hub takes power from the pi.

ssmoss commented 1 year ago

Makes sense I am going to ditch the hub going forward. I am thinking the one I got is a newer chipset (faster / more bands) so more power hungry. I will report back when the ones with the older chipset come in.

@skipfire I am not sure how hard it would be, but it could be cool for those of us that need an antenna to have a version of the Pi HAT with one of these older wireless chips on them.

skipfire commented 1 year ago

@ssmoss unfortunately all networking I have seen that goes through GPIO uses the same UART pins that GenMon uses. I was hoping that the Pi 5 would have introduced an option for an external antenna but no luck.

ssmoss commented 1 year ago

That external antenna is just too useful for them to add. Also kinda stinks if they did add it because the new Pi is sooo power hungry.

Would it be possible to use a "U-Shaped" USB connector and route that to the wireless chip on the HAT? I think I saw that done for some Pi 4 hats for using an external HDD. I guess you need a "hub" chip as well since it only has a single USB port?

skipfire commented 1 year ago

That kind of connector could certainly work to get USB up to the HAT and if it is only a the WiFi then a hub chip shouldn't be needed since there would only be one USB device on the HAT. Though the board is already a bit crowded so I'd probably end up just making a new board and if making a board that's just a USB device I'd probably just make it a dongle.

Do you need any GPIO other than UART? If so, a NanoPi may be something to look at as the WiFi enabled ones have whip antennas. I made a very small batch of test boards that fit them, but there is more lift to get the NanoPi going since they are not running Raspberry Pi OS. The Neo Plus2 was easier than the Air since it had ethernet that I could connect to configure the WiFi. https://www.amazon.com/gp/product/B0B971WS85/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1 https://www.amazon.com/gp/product/B0B2K8QB3F/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

ssmoss commented 1 year ago

For me at least the purpose of the device is to connect to the generator only and relay that to genmon. I am not tied to having genmon on that device either as my home network is battery backed as well as my home automation machine (which could host genmon).

Maybe the OpenGenSet board you have is a better way to do this as you have the external antenna already. I assume the only encryption on that is based on the security of the wireless network (WPA2)?

skipfire commented 1 year ago

You are correct that it does not have any encryption on its own, just whatever WiFi encryption you have. It does power over the 12v or 5v line from the Molex cable. I have GenMon running on an Ubuntu VM that hosts a few other services when I'm not running a Pi directly connected. It does of course run into the issue of Serial over TCP not being the greatest protocol ever built and lost packets sometimes result in some confusion in the system (always resolves itself) and potentially false outage notifications, but I adjusted a couple of the advanced delays and I get almost none now. Moving GenMon to the VM instead of running on the Pi with a serial bridge setup reduced a lot of my errors, I think the lower performance of the Pi added just enough lag that it contributed to the problems.

ssmoss commented 1 year ago

I saw that there is a SSH library for the ESP 32, is there any way that could be integrated into OpenGenSet? Load a key onto it and then use autossh from the VM to create a tunnel that the Serial over TCP passes though. With that the OpenGenSet would never expose anything save to the authorized hosts?

skipfire commented 1 year ago

I really have no clue, I didn't create any software for OpenGenSet, just consolidated hardware that worked with the existing instructions for setting up the bridge. I also have no clue if or how that may impact configuration.