From 7a4440c78c8eb4792fc305287f30236a4dcfe2ca Mon Sep 17 00:00:00 2001 From: DivingUp <75316727+DivingUp@users.noreply.github.com> Date: Sun, 3 Mar 2024 21:59:01 +0100 Subject: [PATCH] Update audi_models.py --- custom_components/audiconnect/audi_models.py | 21 +++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/custom_components/audiconnect/audi_models.py b/custom_components/audiconnect/audi_models.py index 2a286b57..0570c013 100644 --- a/custom_components/audiconnect/audi_models.py +++ b/custom_components/audiconnect/audi_models.py @@ -154,11 +154,26 @@ def __init__(self, data): self.appendWindowState(data) self.appendDoorState(data) - - + #self.states.append({"name" : "engineTypeFirstEngine", "value" : data["fuelStatus"]["rangeStatus"]["value"]["primaryEngine"]["type"]}) + #self.states.append({"name" : "primaryEngineRange", "value" : data["fuelStatus"]["rangeStatus"]["value"]["primaryEngine"]["remainingRange_km"]}) + + if 'primaryEngine' in data["fuelStatus"]["rangeStatus"]["value"]: + self.states.append({"name" : "carType", "value" : data["fuelStatus"]["rangeStatus"]["value"]["carType"]}) + self.states.append({"name" : "engineTypeFirstEngine", "value" : data["fuelStatus"]["rangeStatus"]["value"]["primaryEngine"]["type"]}) + self.states.append({"name" : "primaryEngineRange", "value" : data["fuelStatus"]["rangeStatus"]["value"]["primaryEngine"]["remainingRange_km"]}) + self.states.append({"name" : "primaryEngineRangePercent", "value" : data["fuelStatus"]["rangeStatus"]["value"]["primaryEngine"]["currentSOC_pct"]}) + else: + print("No Primary Engine") - + + if 'secondaryEngine' in data["fuelStatus"]["rangeStatus"]["value"]: + self.states.append({"name" : "engineTypeSecondEngine", "value" : data["fuelStatus"]["rangeStatus"]["value"]["secondaryEngine"]["type"]}) + self.states.append({"name" : "secondaryEngineRange", "value" : data["fuelStatus"]["rangeStatus"]["value"]["secondaryEngine"]["remainingRange_km"]}) + self.states.append({"name" : "secondaryEngineRangePercent", "value" : data["fuelStatus"]["rangeStatus"]["value"]["secondaryEngine"]["currentSOC_pct"]}) + else: + print("No Secondary Engine") + if 'charging' in data: self.states.append({"name" : "actualChargeRate", "value" : data["charging"]["chargingStatus"]["value"]["chargeRate_kmph"]}) self.states.append({"name" : "chargingPower", "value" : data["charging"]["chargingStatus"]["value"]["chargePower_kW"]})