Skip to content

Commit

Permalink
only create trunk status binary_sensor if bonnet_status capability is…
Browse files Browse the repository at this point in the history
… reported by car
  • Loading branch information
CM000n committed Jan 8, 2024
1 parent c6e5110 commit d0b2d31
Showing 1 changed file with 14 additions and 23 deletions.
37 changes: 14 additions & 23 deletions custom_components/toyota/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,37 +282,28 @@ async def async_setup_entry(
vehicle._vehicle_info.extended_capabilities.rear_passenger_door_window_status,
REAR_PASSENGER_DOOR_WINDOW_STATUS_ENTITY_DESCRIPTION,
),
# TODO: Find correct matching capabilities in _vehicle_info
(
vehicle._vehicle_info.extended_capabilities.bonnet_status,
TRUNK_DOOR_LOCK_ENTITY_DESCRIPTION,
),
# TODO: Find correct matching capabilities in _vehicle_info
(
vehicle._vehicle_info.extended_capabilities.bonnet_status,
TRUNK_DOOR_OPEN_ENTITY_DESCRIPTION,
),
]

for capability, description in capabilities_descriptions:
if capability:
binary_sensors.append(
ToyotaBinarySensor(
coordinator=coordinator,
entry_id=entry.entry_id,
vehicle_index=index,
description=description,
)
)

# TODO: Find matching capabilities in _vehicle_info
binary_sensors.append(
binary_sensors.extend(
ToyotaBinarySensor(
coordinator=coordinator,
entry_id=entry.entry_id,
vehicle_index=index,
description=TRUNK_DOOR_LOCK_ENTITY_DESCRIPTION,
description=description,
)
for capability, description in capabilities_descriptions
if capability
)
binary_sensors.append(
ToyotaBinarySensor(
coordinator=coordinator,
entry_id=entry.entry_id,
vehicle_index=index,
description=TRUNK_DOOR_OPEN_ENTITY_DESCRIPTION,
)
)

async_add_devices(binary_sensors, True)


Expand Down

0 comments on commit d0b2d31

Please sign in to comment.