Closed icemarkom closed 3 years ago
I think a much easier change is to change SCAN_INTERVAL to an integer seconds (instead of timedelta(seconds=10)) and modify the config get line to something like
scan_interval = timedelta(seconds=fan.get(CONF_SCAN_INTERVAL, SCAN_INTERVAL))
I think this will break the default case. I believe the right way is to schematize the config so it gives the right value e.g (from https://github.com/home-assistant/core/blob/747a78be57c4e7412c7a867007ebf28c98c974dc/homeassistant/components/device_tracker/traccar.py#L43) PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_SCAN_INTERVAL, default=SCAN_INTERVAL): cv.time_period, })
I think this will break the default case. I believe the right way is to schematize the config so it gives the right value e.g (from https://github.com/home-assistant/core/blob/747a78be57c4e7412c7a867007ebf28c98c974dc/homeassistant/components/device_tracker/traccar.py#L43)
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_SCAN_INTERVAL, default=SCAN_INTERVAL): cv.time_period, })
I think a much easier change is to change SCAN_INTERVAL to an integer seconds (instead of timedelta(seconds=10)) and modify the config get line to something like
scan_interval = timedelta(seconds=fan.get(CONF_SCAN_INTERVAL, SCAN_INTERVAL))