Skip to content

Commit

Permalink
Fix bug in REST mode only
Browse files Browse the repository at this point in the history
Basic typo's in the set functions didn't work correctly in REST mode only
- Battery % was set over and over again
- Reserve wasn't set
  • Loading branch information
springfall2008 authored Jun 2, 2023
1 parent 579625f commit 3582f05
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions predbat.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ def adjust_battery_target(self, soc):
current_soc = self.base.sim_soc
else:
if self.rest_data:
current_soc = float(self.rest_data['Power']['Power']['SOC'])
current_soc = float(self.rest_data['Control']['Target_SOC'])
else:
current_soc = self.base.get_arg('charge_limit', index=self.id, default=100.0)

if current_soc != soc:
self.base.log("Inverter {} Current SOC is {} % and new target is {} %".format(self.id, current_soc, soc))
self.base.log("Inverter {} Current charge Limit is {} % and new target is {} %".format(self.id, current_soc, soc))
entity_soc = self.base.get_entity(self.base.get_arg('charge_limit', indirect=False, index=self.id))
if entity_soc:
if SIMULATE:
Expand Down Expand Up @@ -477,7 +477,7 @@ def rest_setReserve(self, target):
Configure reserve % via REST
"""
url = self.rest_api + '/setBatteryReserve'
data = {"dischargeToPercent": target}
data = {"reservePercent": target}
r = requests.post(url, json=data)
time.sleep(5)
r = requests.post(url, json=data)
Expand Down

0 comments on commit 3582f05

Please sign in to comment.