adaptive-lighting/custom_components
Casey 7c565a5f5f Fix options-flow conditional reveal + empty lux-sensor save
Two config-flow bugs in the Ambient lux / Advanced sections:

- Conditional fields (target_lux, send_split_delay) only appeared on a
  fresh re-open of the dialog, never in the same session — violating the
  options-flow spec ('SHALL re-render ... in the same session'). Now, when
  a driver is enabled but its dependent field was hidden from the rendered
  schema, the form re-renders (carrying the user's edits) instead of saving.

- The options form could not be saved at all without selecting a lux
  sensor: vol.Optional(CONF_LUX_SENSOR, default='') fed '' into the
  illuminance EntitySelector, which rejects empty strings. Omit the
  default (vol.UNDEFINED) when no sensor is configured.

Extracted _has_pending_reveal() and _overlay_range_values() helpers to
keep async_step_init under the branch limit. Added 3 flow-level tests
exercising the real re-render path (prior tests only hit the schema
builder, which is how these slipped through). 141 tests pass.
2026-05-30 22:06:59 +02:00
..
adaptive_lighting Fix options-flow conditional reveal + empty lux-sensor save 2026-05-30 22:06:59 +02:00