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

Fix stopAskingToStartCharging behaviour #589

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
14 changes: 0 additions & 14 deletions lib/TWCManager/TWCSlave.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,20 +543,6 @@ def send_master_heartbeat(self):
# Car is not charging and is not reporting an error state, so
# try starting charge via car api.
self.master.startCarsCharging()
elif self.reportedAmpsActual >= 1.0:
# At least one plugged in car is successfully charging. We don't
# know which car it is, so we must set
# vehicle.stopAskingToStartCharging = False on all vehicles such
# that if any vehicle is not charging without us calling
# car_api_charge(False), we'll try to start it charging again at
# least once. This probably isn't necessary but might prevent
# some unexpected case from never starting a charge. It also
# seems less confusing to see in the output that we always try
# to start API charging after the car stops taking a charge.
for vehicle in self.master.getModuleByName(
"TeslaAPI"
).getCarApiVehicles():
vehicle.stopAskingToStartCharging = False

self.master.getModulesByType("Interface")[0]["ref"].send(
bytearray(b"\xFB\xE0")
Expand Down
7 changes: 6 additions & 1 deletion lib/TWCManager/Vehicle/TeslaAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,12 +645,17 @@ def car_api_charge(self, charge):

if not vehicle.atHome:
# Vehicle is not at home, so don't change its charge state.
logger.info(
message = (
vehicle.name
+ " is not at home. Do not "
+ startOrStop
+ " charge."
)
# Stop asking to start charging when not at home.
if startOrStop == "start":
vehicle.stopAskingToStartCharging = True
message += " Stop asking to start charging."
logger.info(message)
continue

# If you send charge_start/stop less than 1 second after calling
Expand Down
Loading