mirror of
https://github.com/flobz/psa_car_controller.git
synced 2026-08-22 17:36:15 +00:00
fix
This commit is contained in:
+3
-3
@@ -38,7 +38,7 @@ class ChargeControl:
|
||||
return self._stop_hour
|
||||
|
||||
def control_charge_with_ack(self, charge: bool):
|
||||
self.psacc.charge_now(self.vin, charge)
|
||||
self.psacc.remote_client.charge_now(self.vin, charge)
|
||||
self.retry_count += 1
|
||||
sleep(ChargeControl.MQTT_TIMEOUT)
|
||||
vehicle_status = self.psacc.get_vehicle_info(self.vin)
|
||||
@@ -47,7 +47,7 @@ class ChargeControl:
|
||||
logger.warning("Car state isn't compatible with charging %s", status)
|
||||
if (status == INPROGRESS) != charge:
|
||||
logger.warning("retry to control the charge of %s", self.vin)
|
||||
self.psacc.charge_now(self.vin, charge)
|
||||
self.psacc.remote_client.charge_now(self.vin, charge)
|
||||
self.retry_count += 1
|
||||
return False
|
||||
self.retry_count = 0
|
||||
@@ -62,7 +62,7 @@ class ChargeControl:
|
||||
wakeup_timeout = self.wakeup_timeout
|
||||
if (datetime.utcnow().replace(tzinfo=pytz.UTC) - last_update).total_seconds() > 60 * wakeup_timeout:
|
||||
try:
|
||||
self.psacc.wakeup(self.vin)
|
||||
self.psacc.remote_client.wakeup(self.vin)
|
||||
except RateLimitException:
|
||||
logger.exception("force_update:")
|
||||
|
||||
|
||||
+6
-4
@@ -159,25 +159,27 @@ def get_style():
|
||||
|
||||
@app.route('/charge_now/<string:vin>/<int:charge>')
|
||||
def charge_now(vin, charge):
|
||||
return jsonify(CONFIG.myp.charge_now(vin, charge != 0))
|
||||
return jsonify(CONFIG.myp.remote_client.charge_now(vin, charge != 0))
|
||||
|
||||
|
||||
@app.route('/charge_hour')
|
||||
def change_charge_hour():
|
||||
return jsonify(CONFIG.myp.change_charge_hour(request.args['vin'], request.args['hour'], request.args['minute']))
|
||||
return jsonify(CONFIG.myp.remote_client.change_charge_hour(request.args['vin'],
|
||||
request.args['hour'],
|
||||
request.args['minute']))
|
||||
|
||||
|
||||
@app.route('/wakeup/<string:vin>')
|
||||
def wakeup(vin):
|
||||
try:
|
||||
return jsonify(CONFIG.myp.wakeup(vin))
|
||||
return jsonify(CONFIG.myp.remote_client.wakeup(vin))
|
||||
except RateLimitException:
|
||||
return jsonify({"error": "Wakeup rate limit exceeded"})
|
||||
|
||||
|
||||
@app.route('/preconditioning/<string:vin>/<int:activate>')
|
||||
def preconditioning(vin, activate):
|
||||
return jsonify(CONFIG.myp.preconditioning(vin, activate))
|
||||
return jsonify(CONFIG.myp.remote_client.preconditioning(vin, activate))
|
||||
|
||||
|
||||
@app.route('/position/<string:vin>')
|
||||
|
||||
Reference in New Issue
Block a user