Plugin UPS I2c 18650 RTC BATTERY Pi 1B/2B/3B/4B retour d'états

Recevoir le retour d’états de l’UPS I2c 18650 de nouvelle génération =>

https://wiki.52pi.com/index.php/UPS_Plus_SKU:_EP-0136?spm=a2g0s.imconversation.0.0.3d073e5fvSXXc9

### USB Plus V5.0 Register Mapping Chart

* 0x17 - Operation Mode

|Address|Function|Range|Unit|
| --- | --- | --- | --- |
|0x01 - 0x02|Voltage of UPS's MCU|2400 - 3600|mV|
|0x03 - 0x04|Voltage of Pogopin's Bottom|0 - 5500|mV|
|0x05 - 0x06|Voltage of Batteries' Terminal|0 - 4500|mV|
|0x07 - 0x08|Voltage of USB-C Charging Port|0 - 13500|mV|
|0x09 - 0x0A|Voltage of MicroUSB Charging Port|0 - 13500|mV|
|0x0B - 0x0C|Batteries Temperature|-20 - 65|℃|
|0x0D - 0x0E|Full Voltage|0 - 4500|mV|
|0x0F - 0x10|Empty Voltage|0 - 4500|mV|
|0x11 - 0x12|Protection Voltage|0 - 4500|mV|
|0x13 - 0x14|Battery Remaining|0 - 100|%|
|0x15 - 0x16|Sample Period|1 - 1440|Min|
|0x17|Power Status/Operation Mode|0/1|Bool|
|0x18|Shutdown Countdown|0/1 - 255|Bool/Sec|
|0x19|Back-To-AC Auto Power up|0/1|Bool|
|0x1A|Restart Countdown|0/1 - 255|Bool/Sec|
|0x1B|Reset to Factory Defaults|0/1|Bool|
|0x1C - 0x1F|Cumulative Running Time|0 - 2147483647|Sec|
|0x20 - 0x23|Accumulated Charging Time|0 - 2147483647|Sec|
|0x24 - 0x27|Running Time|0 - 2147483647|Sec|
|0x28 - 0x29|Version|1|Fixed|
|0x2A - 0xEF|[Reserved]|NA|NA|
|0xF0 - 0xFB|Serial Number|Device UID|Fixed|
|0xFC - 0xFF|Factory Testing|NA|NA|

![upse|371x400](upload://2jFl2Koys8ja3jFGvmxIZZm7TZe.jpeg)

From pi@raspberrypi Thu Apr 08 16:30:01 2021
------Current information of the detected Raspberry Pi------
------------------------------------------------------------
Raspberry Pi Supply Voltage: 0.000 V
Raspberry Pi Current Current Consumption: 2077.208 V
Raspberry Pi Current Power Consumption: 2044.071 V
-------------------Batteries information-------------------
Voltage of Batteries: 4.208 V
Battery Current (Charging) Rate: 90.000 mA
Current Battery Power Supplement: 385.366 mW
Successfully set the protection voltage to: 3700 mV
------------------------------------------------------------
Currently charging via Type C Port.

From pi@raspberrypi Thu Apr 08 16:30:58 2021
Return-path: <pi@raspberrypi>
Envelope-to: pi@raspberrypi
Delivery-date: Thu, 08 Apr 2021 16:30:58 +0200
Received: from pi by raspberrypi with local (Exim 4.92)
	(envelope-from <pi@raspberrypi>)
	id 1lUVgQ-0002cz-DK
	for pi@raspberrypi; Thu, 08 Apr 2021 16:30:58 +0200
From: root@raspberrypi (Cron Daemon)
To: pi@raspberrypi
Subject: Cron <pi@raspberrypi> /usr/bin/python3 /home/pi/bin/upsPlus_iot.py
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/pi>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=pi>
Message-Id: <E1lUVgQ-0002cz-DK@raspberrypi>
Date: Thu, 08 Apr 2021 16:30:58 +0200

{'PiVccVolt': 0.0, 'PiIddAmps': 1508.8309503784692, 'BatVccVolt': 4.208, 'BatIddAmps': 146.09756097560975, 'McuVccVolt': 3314, 'BatPinCVolt': 4219, 'ChargeTypeCVolt': 5108, 'ChargeMicroVolt': 0, 'BatTemperature': 41, 'BatFullVolt': 4279, 'BatEmptyVolt': 3700, 'BatProtectVolt': 3700, 'SampleTime': 2, 'AutoPowerOn': 0, 'OnlineTime': 237409, 'FullTime': 243590, 'OneshotTime': 15263, 'Version': 3, 'UID0': '000F0008', 'UID1': '42415711', 'UID2': '20323236'}
{"code":0,"reason":"Feed!","id":36133}

upse

compatible avec

Raspberry Pi A YES
Raspberry Pi A+ YES
Raspberry Pi B YES
Raspberry Pi B+ YES
Raspberry Pi 2B YES
Raspberry Pi 3B YES
Raspberry Pi 3B+ YES
Raspberry Pi 4B YES
Raspberry Pi Zero NO
Raspberry Pi Zero W NO