Skip to content

Commit

Permalink
Minor fixes for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
mcbirse committed Dec 22, 2023
1 parent 8a0d002 commit 6b5baad
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions pypowerwall/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def connect(self):

def get_battery(self):
"""
Get site power data from Tesla Cloud\
Get site battery data from Tesla Cloud
"response": {
"resource_type": "battery",
Expand Down Expand Up @@ -380,7 +380,7 @@ def poll(self, api):
# percentage_charged is scaled to keep 5% buffer at bottom
soe = (percentage_charged + (5 / 0.95)) * 0.95
data = {
"percentage": soe,
"percentage": soe
}

elif api == '/api/meters/aggregates':
Expand All @@ -399,7 +399,6 @@ def poll(self, api):
solar_inverters = 1
else:
solar_inverters = 0

data = {
"site": {
"last_communication_time": timestamp,
Expand Down Expand Up @@ -484,13 +483,12 @@ def poll(self, api):
elif api == '/api/operation':
config = self.get_site_config()
default_real_mode = lookup(config, ("response", "default_real_mode"))
backup_reserve_percent = lookup(config, ("response", "backup_reserve_percent"))
if backup_reserve_percent is not None:
backup_reserve_percent = (backup_reserve_percent + (5 / 0.95)) * 0.95

backup_reserve_percent = lookup(config, ("response", "backup_reserve_percent")) or 0
# backup_reserve_percent is scaled to keep 5% buffer at bottom
backup = (backup_reserve_percent + (5 / 0.95)) * 0.95
data = {
"real_mode": default_real_mode,
"backup_reserve_percent": backup_reserve_percent
"backup_reserve_percent": backup
}
elif api == '/api/system_status':
power = self.get_site_power()
Expand Down

0 comments on commit 6b5baad

Please sign in to comment.