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

Fix missing light entities in options list #350

Merged
merged 1 commit into from
Oct 28, 2022
Merged
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: 5 additions & 1 deletion custom_components/adaptive_lighting/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
NONE_STR,
VALIDATION_TUPLES,
)
from .switch import _supported_features
from .switch import _supported_features, validate

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -82,6 +82,7 @@ def __init__(self, config_entry: config_entries.ConfigEntry):
async def async_step_init(self, user_input=None):
"""Handle options flow."""
conf = self.config_entry
data = validate(conf)
if conf.source == config_entries.SOURCE_IMPORT:
return self.async_show_form(step_id="init", data_schema=None)
errors = {}
Expand All @@ -95,6 +96,9 @@ async def async_step_init(self, user_input=None):
for light in self.hass.states.async_entity_ids("light")
if _supported_features(self.hass, light)
]
for configured_light in data[CONF_LIGHTS]:
if not configured_light in all_lights:
all_lights.append(configured_light)
to_replace = {CONF_LIGHTS: cv.multi_select(sorted(all_lights))}

options_schema = {}
Expand Down