Skip to content

Commit

Permalink
Fix missing switches again
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre0512 committed May 8, 2023
1 parent a56d3e5 commit 6828f3e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion custom_components/hon/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/Andre0512/hon/issues",
"requirements": ["pyhOn==0.10.6"],
"version": "0.7.3-beta.1"
"version": "0.7.3-beta.2"
}
22 changes: 12 additions & 10 deletions custom_components/hon/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
)
Expand Down

0 comments on commit 6828f3e

Please sign in to comment.