geeekpi / upsplus

UPS Plus is a new generation of UPS power management module. It is an improved version of the original UPS prototype. It has been fixed the bug that UPS could not charge and automatically power off during work time. It can not only perform good battery power management, but also provide stable voltage output and RTC functions. At the same time,it support for FCP, AFC, SFCP fast charge protocol, support BC1.2 charging protocol, support battery terminal current/voltage monitoring and support two-way monitoring of charge and discharge. It can provide programmable PVD function. Power Voltage Detector (PVD) can be used to detect if batteries voltage is below or above configured voltage. Once this function has been enabled, it will monitoring your batteries voltage, and you can control whether or not shut down Raspberry Pi via simple bash script or python script. This function will protect your batteries from damage caused by excessive discharge. It can provide Adjustable data sampling Rate. This function allows you to adjust the data sampling rate so that you can get more detailed battery information and also it will consume some power. The data sampling information can communicate with the upper computer device through the I2C protocol. UPS Plus supports the OTA firmware upgrade function. Once there is a new firmware update, it is very convenient for you to upgrade firmware for UPS Plus. The firmware upgrade can be completed only by connecting to the Internet,and execute a python script. Support battery temperature monitoring and power-down memory function. UPS Plus can be set to automatically start the Raspberry Pi after the external power comes on. The programmable shutdown and forced restart function will provide you with a remote power-off restart management method. That means you don’t need to go Unplug the power cable or press the power button to cut off the power again. You can set the program to disconnect the power supply after a few seconds after the Raspberry Pi is shut down properly. And you can also reconnect the power supply after a forced power failure to achieve a remote power-off and restart operation. Once it was setting up, you don't need to press power button to boot up your device which is very suitable for smart home application scenarios.
https://wiki.52pi.com/index.php?title=UPS_Plus_SKU:_EP-0136
MIT License
73 stars 25 forks source link

OTA script not working , no response from gateway(URL) #81

Closed evertide closed 2 years ago

evertide commented 2 years ago

The OTA update script is not working and is giving JSON errors. I suspect that this is due to the fact the URL https://api.52pi.com/update is not working ( 502 bad gateway error). (https://api.52pi.com is not working either).

error code I am getting python3 OTA_firmware_upgrade.py Traceback (most recent call last): File "OTA_firmware_upgrade.py", line 32, in r = json.loads(r.text) File "/usr/lib/python3.7/json/init.py", line 348, in loads return _default_decoder.decode(s) File "/usr/lib/python3.7/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The UPS worked fine prior to the update attempt and setting in thru method 2 (i2cset -y 1 0x17 50 127 b) in upgrade mode.

Is there a i2cset command on 0x18 to switch back to normal mode or is there an alternative URL for the upgrade?

tobylaw commented 2 years ago

Just to confirm that I too am seeing this same error when trying to upgrade my firmware.

evertide commented 2 years ago

There is a slight change this morning. The website api.52pi.com is up again but the /update still gives an error.

-- Oops! An Error Occurred The server returned a "405 Method Not Allowed". Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.

It would be great to have the OTA script changed to just restore it to normal operations ( i2c address 17) or have the manual provide the i2cset command. ( Or both script and manual )

ArjenR49 commented 2 years ago

IoT reporting in a control script also currently results in an error (copied from HA): <html> <head><title>502 Bad Gateway</title></head> <body> <center><h1>502 Bad Gateway</h1></center> <hr><center>nginx/1.18.0</center> </body> </html>

ArjenR49 commented 2 years ago

IoT server appears to be up again. IoT reporting from Home Assistant is working on my UPSplus now.

tobylaw commented 2 years ago

Thanks ArjenR49 for the heads up, yes it is back up and is now version 10. I just download the scripts from github again and no mention of version 10 in the docs. It worries me a little that there is no offline update option for the failed update with the site being down left my UPSplus in a non functioning state. We are planning on using these in a number of our products and not being able to reliably installed updates could be a real headache, especially if there is no way of rolling back.

ArjenR49 commented 2 years ago

Version 10 blocks i2c bus access from the pi at regular intervals. Depending on the sampling interval setting.

That doesn't prevent operation of frtz14's control script in my experience. I have not used Geeekpi's control script for s long time now.

Arjen (On The Road)

Op zo 3 okt. 2021 14:59 schreef tobylaw @.***>:

Thanks ArjenR49 for the heads up, yes it is back up and is now version 10. I just download the scripts from github again and no mention of version 10 in the docs. It worries me a little that there is no offline update option for the failed update with the site being down left my UPSplus in a non functioning state. We are planning on using these in a number of our products and not being able to reliably installed updates could be a real headache, especially if there is no way of rolling back.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/geeekpi/upsplus/issues/81#issuecomment-932946416, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANCBKNV2WTF4JOAA7AJN4LTUFBOUNANCNFSM5FCNP33Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

evertide commented 2 years ago

I can confirm the upgrade worked hence the upgrade servers is back up and running. I still think it would be good to have a bailout option in the software changing it back to operation ( (17) mode. But that would be more of a feature request.