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

Remove Duplicate Entries for Doors and Trunk Lock #219

Closed
Closed
Show file tree
Hide file tree
Changes from all 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
6 changes: 0 additions & 6 deletions volkswagencarnet/vw_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -1000,9 +1000,6 @@ def create_instruments():
attr="parking_light", name="Parking light", device_class=VWDeviceClass.LIGHT, icon="mdi:car-parking-lights"
),
BinarySensor(attr="door_locked", name="Doors locked", device_class=VWDeviceClass.LOCK, reverse_state=True),
BinarySensor(
attr="door_locked_sensor", name="Doors locked", device_class=VWDeviceClass.LOCK, reverse_state=True
),
BinarySensor(
attr="door_closed_left_front",
name="Door closed left front",
Expand Down Expand Up @@ -1032,9 +1029,6 @@ def create_instruments():
icon="mdi:car-door",
),
BinarySensor(attr="trunk_locked", name="Trunk locked", device_class=VWDeviceClass.LOCK, reverse_state=True),
BinarySensor(
attr="trunk_locked_sensor", name="Trunk locked", device_class=VWDeviceClass.LOCK, reverse_state=True
),
BinarySensor(attr="trunk_closed", name="Trunk closed", device_class=VWDeviceClass.DOOR, reverse_state=True),
BinarySensor(attr="hood_closed", name="Hood closed", device_class=VWDeviceClass.DOOR, reverse_state=True),
BinarySensor(
Expand Down
51 changes: 0 additions & 51 deletions volkswagencarnet/vw_vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1675,11 +1675,6 @@ def is_roof_cover_closed_supported(self) -> bool:
return False

# Locks
@property
def door_locked_sensor(self) -> bool:
"""Return same state as lock entity, since they are mutually exclusive."""
return self.door_locked

@property
def door_locked(self) -> bool:
"""
Expand All @@ -1694,11 +1689,6 @@ def door_locked_last_updated(self) -> datetime:
"""Return door lock last updated."""
return find_path(self.attrs, "access.accessStatus.value.carCapturedTimestamp")

@property
def door_locked_sensor_last_updated(self) -> datetime:
"""Return door lock last updated."""
return find_path(self.attrs, "access.accessStatus.value.carCapturedTimestamp")

@property
def is_door_locked_supported(self) -> bool:
"""
Expand All @@ -1708,15 +1698,6 @@ def is_door_locked_supported(self) -> bool:
"""
return is_valid_path(self.attrs, "access.accessStatus.value.doorLockStatus")

@property
def is_door_locked_sensor_supported(self) -> bool:
"""
Return true if supported.

:return:
"""
return is_valid_path(self.attrs, "access.accessStatus.value.doorLockStatus")

@property
def trunk_locked(self) -> bool:
"""
Expand Down Expand Up @@ -1749,38 +1730,6 @@ def is_trunk_locked_supported(self) -> bool:
return True
return False

@property
def trunk_locked_sensor(self) -> bool:
"""
Return trunk locked state.

:return:
"""
doors = find_path(self.attrs, "access.accessStatus.value.doors")
for door in doors:
if door["name"] == "trunk":
return "locked" in door["status"]
return False

@property
def trunk_locked_sensor_last_updated(self) -> datetime:
"""Return attribute last updated timestamp."""
return find_path(self.attrs, "access.accessStatus.value.carCapturedTimestamp")

@property
def is_trunk_locked_sensor_supported(self) -> bool:
"""
Return true if supported.

:return:
"""
if is_valid_path(self.attrs, "access.accessStatus.value.doors"):
doors = find_path(self.attrs, "access.accessStatus.value.doors")
for door in doors:
if door["name"] == "trunk" and "unsupported" not in door["status"]:
return True
return False

# Doors, hood and trunk
@property
def hood_closed(self) -> bool:
Expand Down