Skip to content

Commit

Permalink
Merge pull request #214 from TimPearce/dev/2_door_coupe
Browse files Browse the repository at this point in the history
Fix doors and windows for 2 door coupe
  • Loading branch information
arjenvrh authored Feb 1, 2024
2 parents 08eca0d + 3b154e3 commit 5bf588d
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions custom_components/audiconnect/audi_connect_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,15 +721,15 @@ async def update_vehicle_tripdata(self, kind: str):
except ClientResponseError as resp_exception:
self.log_exception_once(
resp_exception,
"Unable to obtain the vehicle {kind} tripdata of {vin}".format(
kind=kind, vin=self._vehicle.vin
"Unable to obtain the vehicle {kind} tripdata of {vin} - {vehicle}".format(
kind=kind, vin=self._vehicle.vin, vehicle=self._vehicle
),
)
except Exception as exception:
self.log_exception_once(
exception,
"Unable to obtain the vehicle {kind} tripdata of {vin}".format(
kind=kind, vin=self._vehicle.vin
"Unable to obtain the vehicle {kind} tripdata of {vin} - {vehicle}".format(
kind=kind, vin=self._vehicle.vin, vehicle=self._vehicle
),
)

Expand Down Expand Up @@ -938,8 +938,8 @@ def position_supported(self):
def any_window_open_supported(self):
"""Return true if window state is supported"""
checkLeftFront = self._vehicle.fields.get("STATE_LEFT_FRONT_WINDOW")
checkLeftRear = self._vehicle.fields.get("STATE_LEFT_REAR_WINDOW")
checkRightFront = self._vehicle.fields.get("STATE_RIGHT_FRONT_WINDOW")
checkLeftRear = self._vehicle.fields.get("STATE_LEFT_REAR_WINDOW")
checkRightRear = self._vehicle.fields.get("STATE_RIGHT_REAR_WINDOW")
if checkLeftFront and checkLeftRear and checkRightFront and checkRightRear:
return True
Expand All @@ -948,14 +948,14 @@ def any_window_open_supported(self):
def any_window_open(self):
if self.any_window_open_supported:
checkLeftFront = self._vehicle.fields.get("STATE_LEFT_FRONT_WINDOW")
checkLeftRear = self._vehicle.fields.get("STATE_LEFT_REAR_WINDOW")
checkRightFront = self._vehicle.fields.get("STATE_RIGHT_FRONT_WINDOW")
checkLeftRear = self._vehicle.fields.get("STATE_LEFT_REAR_WINDOW")
checkRightRear = self._vehicle.fields.get("STATE_RIGHT_REAR_WINDOW")
return not (
checkLeftFront == "3"
and checkLeftRear == "3"
and checkRightFront == "3"
and checkRightRear == "3"
and (checkLeftRear == "3" or checkLeftRear == "0")
and (checkRightRear == "3" or checkRightRear == "0")
)

@property
Expand All @@ -977,7 +977,7 @@ def right_front_window_open(self):
return self._vehicle.fields.get("STATE_RIGHT_FRONT_WINDOW") != "3"
@property
def left_rear_window_open_supported(self):
return self._vehicle.fields.get("STATE_LEFT_REAR_WINDOW")
return self._vehicle.fields.get("STATE_LEFT_REAR_WINDOW") and self._vehicle.fields.get("STATE_LEFT_REAR_WINDOW") != "0"

@property
def left_rear_window_open(self):
Expand All @@ -986,7 +986,7 @@ def left_rear_window_open(self):

@property
def right_rear_window_open_supported(self):
return self._vehicle.fields.get("STATE_RIGHT_REAR_WINDOW")
return self._vehicle.fields.get("STATE_RIGHT_REAR_WINDOW") and self._vehicle.fields.get("STATE_RIGHT_REAR_WINDOW") != "0"

@property
def right_rear_window_open(self):
Expand All @@ -996,8 +996,8 @@ def right_rear_window_open(self):
@property
def any_door_unlocked_supported(self):
checkLeftFront = self._vehicle.fields.get("LOCK_STATE_LEFT_FRONT_DOOR")
checkLeftRear = self._vehicle.fields.get("LOCK_STATE_LEFT_REAR_DOOR")
checkRightFront = self._vehicle.fields.get("LOCK_STATE_RIGHT_FRONT_DOOR")
checkLeftRear = self._vehicle.fields.get("LOCK_STATE_LEFT_REAR_DOOR")
checkRightRear = self._vehicle.fields.get("LOCK_STATE_RIGHT_REAR_DOOR")
if checkLeftFront and checkLeftRear and checkRightFront and checkRightRear:
return True
Expand All @@ -1006,37 +1006,37 @@ def any_door_unlocked_supported(self):
def any_door_unlocked(self):
if self.any_door_unlocked_supported:
checkLeftFront = self._vehicle.fields.get("LOCK_STATE_LEFT_FRONT_DOOR")
checkLeftRear = self._vehicle.fields.get("LOCK_STATE_LEFT_REAR_DOOR")
checkRightFront = self._vehicle.fields.get("LOCK_STATE_RIGHT_FRONT_DOOR")
checkLeftRear = self._vehicle.fields.get("LOCK_STATE_LEFT_REAR_DOOR")
checkRightRear = self._vehicle.fields.get("LOCK_STATE_RIGHT_REAR_DOOR")
return not (
checkLeftFront == "2"
and checkLeftRear == "2"
and checkRightFront == "2"
and checkRightRear == "2"
and (checkLeftRear == "2" or checkLeftRear == "0")
and (checkRightRear == "2" or checkRightRear == "0")
)

@property
def any_door_open_supported(self):
checkLeftFront = self._vehicle.fields.get("OPEN_STATE_LEFT_FRONT_DOOR")
checkLeftRear = self._vehicle.fields.get("OPEN_STATE_LEFT_REAR_DOOR")
checkRightFront = self._vehicle.fields.get("OPEN_STATE_RIGHT_FRONT_DOOR")
checkLeftRear = self._vehicle.fields.get("OPEN_STATE_LEFT_REAR_DOOR")
checkRightRear = self._vehicle.fields.get("OPEN_STATE_RIGHT_REAR_DOOR")
if checkLeftFront and checkLeftRear and checkRightFront and checkRightRear:
if checkLeftFront and checkRightFront and checkLeftRear and checkRightRear:
return True

@property
def any_door_open(self):
if self.any_door_open_supported:
checkLeftFront = self._vehicle.fields.get("OPEN_STATE_LEFT_FRONT_DOOR")
checkLeftRear = self._vehicle.fields.get("OPEN_STATE_LEFT_REAR_DOOR")
checkRightFront = self._vehicle.fields.get("OPEN_STATE_RIGHT_FRONT_DOOR")
checkLeftRear = self._vehicle.fields.get("OPEN_STATE_LEFT_REAR_DOOR")
checkRightRear = self._vehicle.fields.get("OPEN_STATE_RIGHT_REAR_DOOR")
return not (
checkLeftFront == "3"
and checkLeftRear == "3"
and checkRightFront == "3"
and checkRightRear == "3"
and (checkLeftRear == "3" or checkLeftRear == "0")
and (checkRightRear == "3" or checkRightRear == "0")
)

@property
Expand All @@ -1058,7 +1058,7 @@ def right_front_door_open(self):
return self._vehicle.fields.get("OPEN_STATE_RIGHT_FRONT_DOOR") != "3"
@property
def left_rear_door_open_supported(self):
return self._vehicle.fields.get("OPEN_STATE_LEFT_REAR_DOOR")
return self._vehicle.fields.get("OPEN_STATE_LEFT_REAR_DOOR") and self._vehicle.fields.get("OPEN_STATE_LEFT_REAR_DOOR") != "0"

@property
def left_rear_door_open(self):
Expand All @@ -1067,7 +1067,7 @@ def left_rear_door_open(self):

@property
def right_rear_door_open_supported(self):
return self._vehicle.fields.get("OPEN_STATE_RIGHT_REAR_DOOR")
return self._vehicle.fields.get("OPEN_STATE_RIGHT_REAR_DOOR") and self._vehicle.fields.get("OPEN_STATE_RIGHT_REAR_DOOR") != "0"

@property
def right_rear_door_open(self):
Expand Down

0 comments on commit 5bf588d

Please sign in to comment.