mirror of
https://github.com/Andre0512/hon.git
synced 2025-05-14 15:14:22 -04:00
Fix missing switches again
This commit is contained in:
parent
a56d3e5f88
commit
6828f3e9a8
2 changed files with 13 additions and 11 deletions
|
@ -323,16 +323,18 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
|
|||
|
||||
if descriptions := SWITCHES.get(device.appliance_type):
|
||||
for description in descriptions:
|
||||
if (
|
||||
description.entity_category == EntityCategory.CONFIG
|
||||
and description.key not in device.available_settings
|
||||
or not any(
|
||||
device.get(description.key) is not None
|
||||
or description.turn_on_key in list(device.commands)
|
||||
or description.turn_off_key in list(device.commands)
|
||||
)
|
||||
):
|
||||
continue
|
||||
if description.entity_category == EntityCategory.CONFIG:
|
||||
if description.key not in device.available_settings:
|
||||
continue
|
||||
else:
|
||||
if not any(
|
||||
[
|
||||
device.get(description.key) is not None,
|
||||
description.turn_on_key in list(device.commands),
|
||||
description.turn_off_key in list(device.commands),
|
||||
]
|
||||
):
|
||||
continue
|
||||
appliances.extend(
|
||||
[HonSwitchEntity(hass, coordinator, entry, device, description)]
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue