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

Permit some config_entry options to be unset without throwing #61

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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: 4 additions & 2 deletions custom_components/cync_lights/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ async def async_setup_entry(
hub = hass.data[DOMAIN][config_entry.entry_id]

new_devices = []
config_rooms = "rooms" in config_entry.options and config_entry.options["rooms"] or {}
config_subgroups = "subgroups" in config_entry.options and config_entry.options["subgroups"] or {}
for room in hub.cync_rooms:
if not hub.cync_rooms[room]._update_callback and (room in config_entry.options["rooms"] or room in config_entry.options["subgroups"]):
if not hub.cync_rooms[room]._update_callback and (room in config_rooms or room in config_subgroups):
new_devices.append(CyncRoomEntity(hub.cync_rooms[room]))

for switch_id in hub.cync_switches:
Expand Down Expand Up @@ -250,4 +252,4 @@ async def async_turn_on(self, **kwargs: Any) -> None:

async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn off the light."""
await self.cync_switch.turn_off()
await self.cync_switch.turn_off()