Add config option to set timeout for wiffi devices (#35694)
* add config option to set timeout for wiffi devices Wiffi devices allow to configure the update period (= full_loop_minutes). The integration shall respect the configured update period and therefore need a configuration for the timeout, too. * Move timeout from config flow to option flow * add test for option flow
This commit is contained in:
parent
d02bb70f0c
commit
51eebb3906
8 changed files with 112 additions and 19 deletions
|
@ -21,7 +21,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
entities = []
|
||||
|
||||
if metric.is_bool:
|
||||
entities.append(BoolEntity(device, metric))
|
||||
entities.append(BoolEntity(device, metric, config_entry.options))
|
||||
|
||||
async_add_entities(entities)
|
||||
|
||||
|
@ -31,9 +31,9 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
class BoolEntity(WiffiEntity, BinarySensorEntity):
|
||||
"""Entity for wiffi metrics which have a boolean value."""
|
||||
|
||||
def __init__(self, device, metric):
|
||||
def __init__(self, device, metric, options):
|
||||
"""Initialize the entity."""
|
||||
super().__init__(device, metric)
|
||||
super().__init__(device, metric, options)
|
||||
self._value = metric.value
|
||||
self.reset_expiration_date()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue