mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-13 07:14:04 +02:00
do not show options if managed via YAML
This commit is contained in:
parent
28389ebebe
commit
2c0ab9d929
3 changed files with 6 additions and 4 deletions
|
|
@ -76,6 +76,9 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||
|
||||
async def async_step_init(self, user_input=None):
|
||||
"""Handle options flow."""
|
||||
conf = self.config_entry
|
||||
if conf.source == config_entries.SOURCE_IMPORT:
|
||||
return self.async_show_form(step_id="init", data_schema={})
|
||||
errors = {}
|
||||
if user_input is not None:
|
||||
validate_options(user_input, errors)
|
||||
|
|
@ -87,10 +90,9 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||
lights_tuple = (*validation_tuples[0][:-1], all_lights)
|
||||
validation_tuples[0] = lights_tuple
|
||||
|
||||
options = self.config_entry.options
|
||||
options_schema = vol.Schema(
|
||||
{
|
||||
vol.Optional(key, default=options.get(key, default)): validation
|
||||
vol.Optional(key, default=conf.options.get(key, default)): validation
|
||||
for key, default, validation in validation_tuples
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
"step": {
|
||||
"init": {
|
||||
"title": "Adaptive Lighting options",
|
||||
"description": "All settings for a Adaptive Lighting component. The option names correspond with the YAML settings.",
|
||||
"description": "All settings for a Adaptive Lighting component. The option names correspond with the YAML settings. No options are shown if you have this entry defined in YAML.",
|
||||
"data": {
|
||||
"lights_brightness": "lights_brightness",
|
||||
"lights_mired": "lights_mired",
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
"step": {
|
||||
"init": {
|
||||
"title": "Adaptive Lighting options",
|
||||
"description": "All settings for a Adaptive Lighting component. The option names correspond with the YAML settings.",
|
||||
"description": "All settings for a Adaptive Lighting component. The option names correspond with the YAML settings. No options are shown if you have this entry defined in YAML.",
|
||||
"data": {
|
||||
"lights_brightness": "lights_brightness",
|
||||
"lights_mired": "lights_mired",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue