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:
1 parent
d02bb70f0c
commit
51eebb3906
8 files changed
+112
-19
No files matched your search
@@ -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()
|
||||
|
||||
|
||||
Reference in new issue
Block a user