Skip to content

Commit

Permalink
Merge branch 'stopAskingToStartCharging' into framboos
Browse files Browse the repository at this point in the history
  • Loading branch information
RichieB2B committed Feb 4, 2024
2 parents 1625dae + 51d948c commit 93579b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/TWCManager/Policy/Policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ def enforcePolicy(self, policy, updateLatch=False):
limit = -1
self.master.queue_background_task({"cmd": "applyChargeLimit", "limit": limit})

# Clear stopAskingToStartCharging so we try charging each car at
# least once
for vehicle in self.master.getModuleByName(
"TeslaAPI"
).getCarApiVehicles():
vehicle.stopAskingToStartCharging = False

# Report current policy via Status modules
for module in self.master.getModulesByType("Status"):
module["ref"].setStatus(
Expand Down
3 changes: 3 additions & 0 deletions lib/TWCManager/Vehicle/TeslaAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@ def applyChargeLimit(self, limit, checkArrival=False, checkDeparture=False):
)
) or (not wasAtHome and checkArrival):
vehicle.stopTryingToApplyLimit = False
vehicle.stopAskingToStartCharging = False

if needToWake and self.car_api_available(applyLimit=True) is False:
logger.log(
Expand Down Expand Up @@ -905,9 +906,11 @@ def applyChargeLimit(self, limit, checkArrival=False, checkDeparture=False):

if not wasAtHome and vehicle.atHome:
logger.log(logging.INFO2, vehicle.name + " has arrived")
vehicle.stopAskingToStartCharging = False
outside = vehicle.chargeLimit
elif wasAtHome and not vehicle.atHome:
logger.log(logging.INFO2, vehicle.name + " has departed")
vehicle.stopAskingToStartCharging = False
forgetVehicle = True

if limit == -1 or not vehicle.atHome:
Expand Down

0 comments on commit 93579b9

Please sign in to comment.