Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new alerts endpoint with dictionary/object response format #26

Merged
merged 1 commit into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -588,22 +588,34 @@ Example Output: [here](https://github.com/jasonacox/pypowerwall/blob/main/docs/v

* Alerts
* BackfeedLimited - Unknown
* BatteryBreakerOpen
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! Thanks for the additional alerts.

* BatteryComms - Communication issue with Battery
* BatteryFault - Powerwall Failure
* DeviceShutdownRequested
* ExcessiveVoltageDrop
* FWUpdateFailed - Firmware Upgrade Failed
* FWUpdateSucceeded - Firmware Upgrade Succeeded
* GridCodesWrite - Unknown
* GridFaultContactorTrip
* HighCPU - Occurs when too many API calls are made against the gateway especially with bad credentials
* IslandingControllerMIA
* PanelMaxCurrentLimited
* PodCommissionTimeError - Unknown but happened when some of the Powerwalls failed during a firmware upgrade and was disabled (see [discussion](https://github.com/jasonacox/Powerwall-Dashboard/discussions/47))
* PodCommissionTime - Unknown
* PVInverterComms - Communication issue with Solar Inverter
* RealPowerAvailableLimited - Unknown but seems to happen when Powerwall reaches 100% full
* ScheduledIslandContactorOpen - Manually Disconnected from Grid
* SelfConsumptionReservedLimit - Battery reached reserve limit during self-consumption mode and switches to grid
* SiteMaxPowerLimited - Unknown
* SiteMeterComms - Communication issue with Site Meter
* SiteMinPowerLimited - Unknown
* SolarChargeOnlyLimited - Occurs when battery is below reserve limit and solar exclusively used to charge battery back up to limit
* SolarMeterComms - Communication issue with Solar Meter
* SolarRGMMeterComms - Communication issue with Solar Revenue Grade Meter
* SystemConnectedToGrid
* SystemShutdown
* UnscheduledIslandContactorOpen
* WaitForUserNoInvertersReady - Occurs during grid outage when battery shuts down more than once due to load or error. Requires user intervention to restart.

#### TETHC - Tesla Energy Total Home Controller

Expand Down Expand Up @@ -658,7 +670,9 @@ Example Output: [here](https://github.com/jasonacox/pypowerwall/blob/main/docs/v

* Alerts
* PINV_a010_can_gtwMIA - Indicate that gateway/sync is MIA (seen during firmware upgrade reboot)
* PINV_a016_basicAcCheckUnderVoltage
* PINV_a039_can_thcMIA - Seems to indicate that Home Controller is MIA (seen during firmware upgrade reboot)
* PINV_a041_sensedGridDisturbance
* PINV_a067_overvoltageNeutralChassis - Unknown

#### TESYNC - Tesla Energy Synchronizer
Expand All @@ -671,6 +685,10 @@ Example Output: [here](https://github.com/jasonacox/pypowerwall/blob/main/docs/v

* Alerts
* SYNC_a001_SW_App_Boot - Unknown
* SYNC_a005_vfCheckUnderVoltage
* SYNC_a020_LoadsDropped
* SYNC_a030_Sitemaster_MIA
* SYNC_a036_LoadsDroppedLong
* SYNC_a038_DoOpenArguments - Unknown
* SYNC_a044_IslanderDisconnectWithin2s
* SYNC_a046_DoCloseArguments
Expand Down Expand Up @@ -702,13 +720,14 @@ Example Output: [here](https://github.com/jasonacox/pypowerwall/blob/main/docs/v
* This includes the Tesla PV Rapid Shutdown MCI (“mid-circuit interrupter") devices which ensure that if one photovoltaic cell stops working, the others continue working.

* Alerts
* PVS_a018_MciString[A-D] - This indicates a solar string (A, B, C or D) that is not connected.
* PVS_a0[17-20]_MciString[A-D] - This indicates a solar string (A, B, C or D) that is not connected.
* PVS_a021_RapidShutdown
* PVS_a026_Mci1PvVoltage
* PVS_a027_Mci2PvVoltage
* PVS_a031_Mci3PvVoltage
* PVS_a032_Mci4PvVoltage
* PVS_a039_SelfTestRelayFault
* PVS_a050_RelayCoilIrrationalWarning

#### NEURIO - Wireless Revenue Grade Solar Meter

Expand Down
1 change: 1 addition & 0 deletions proxy/HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ There are several shortcut API URLs that aggregate or otherwise process Powerwal
* /pod - Battery States and Power Data
* /version - Powerwall Firmware Version (string and integer representation)
* /alerts - Summary of Powerwall Alerts from Device Vitals
* /alerts/pw - Summary of Powerwall Alerts in dictionary/object format
* / - Display Powerwall Flow Animation

## Powerwall Proxy Allowed API Calls
Expand Down
3 changes: 3 additions & 0 deletions proxy/RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## pyPowerwall Proxy Release Notes

### Proxy t24 (16 Jan 2023)

* Added new alerts endpoint ('/alerts/pw') for retrieving the data in dictionary/object format (helps with telegraf usage).

### Proxy t23 (8 Jan 2023)

Expand Down
10 changes: 9 additions & 1 deletion proxy/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import ssl
from transform import get_static, inject_js

BUILD = "t23"
BUILD = "t24"
ALLOWLIST = [
'/api/status', '/api/site_info/site_name', '/api/meters/site',
'/api/meters/solar', '/api/sitemaster', '/api/powerwalls',
Expand Down Expand Up @@ -185,6 +185,14 @@ def do_GET(self):
elif self.path == '/alerts':
# Alerts
message = pw.alerts(jsonformat=True)
elif self.path == '/alerts/pw':
# Alerts in dictionary/object format
pwalerts = {}
idx = 1
alerts = pw.alerts()
for alert in alerts:
pwalerts[alert] = 1
message = json.dumps(pwalerts)
elif self.path == '/freq':
# Frequency, Current, Voltage and Grid Status
fcv = {}
Expand Down