|
36 | 36 | TextSelectorConfig, |
37 | 37 | TextSelectorType, |
38 | 38 | ) |
39 | | -from homeassistant.helpers.typing import VolDictType |
40 | 39 |
|
41 | 40 | from .const import CONF_ADVANCED_OPTIONS, CONF_KEEP_ALIVE, DOMAIN, LOGGER |
42 | 41 |
|
@@ -213,34 +212,30 @@ async def async_step_init( |
213 | 212 | ) |
214 | 213 | if not bms_class: |
215 | 214 | return self.async_abort(reason="not_supported") |
216 | | - if not bms_class.accept_secret and not self.show_advanced_options: |
217 | | - LOGGER.debug("No options for %s", bms_class.bms_id()) |
218 | | - return self.async_abort( |
219 | | - reason="device_has_no_options", |
220 | | - description_placeholders={"model": bms_class.bms_id()}, |
221 | | - ) |
222 | | - |
223 | | - schema_dict: VolDictType = { |
224 | | - vol.Optional(CONF_PASSWORD): TextSelector( |
225 | | - TextSelectorConfig( |
226 | | - type=TextSelectorType.PASSWORD, |
227 | | - read_only=not bms_class.accept_secret, |
228 | | - ) |
229 | | - ) |
230 | | - } |
231 | | - |
232 | | - if self.show_advanced_options: |
233 | | - schema_dict[vol.Optional(CONF_ADVANCED_OPTIONS)] = section( |
234 | | - vol.Schema( |
235 | | - {vol.Optional(CONF_KEEP_ALIVE, default=True): BooleanSelector()} |
236 | | - ), |
237 | | - {"collapsed": True}, |
238 | | - ) |
239 | 215 |
|
240 | 216 | return self.async_show_form( |
241 | 217 | step_id="init", |
242 | 218 | data_schema=self.add_suggested_values_to_schema( |
243 | | - vol.Schema(schema_dict), |
| 219 | + vol.Schema( |
| 220 | + { |
| 221 | + vol.Optional(CONF_PASSWORD): TextSelector( |
| 222 | + TextSelectorConfig( |
| 223 | + type=TextSelectorType.PASSWORD, |
| 224 | + read_only=not bms_class.accept_secret, |
| 225 | + ) |
| 226 | + ), |
| 227 | + vol.Optional(CONF_ADVANCED_OPTIONS): section( |
| 228 | + vol.Schema( |
| 229 | + { |
| 230 | + vol.Optional( |
| 231 | + CONF_KEEP_ALIVE, default=True |
| 232 | + ): BooleanSelector() |
| 233 | + } |
| 234 | + ), |
| 235 | + {"collapsed": True}, |
| 236 | + ), |
| 237 | + } |
| 238 | + ), |
244 | 239 | self.config_entry.options, |
245 | 240 | ), |
246 | 241 | ) |
0 commit comments