mirror of
https://github.com/home-assistant/core.git
synced 2025-08-14 01:55:18 +02:00
Fix options update
This commit is contained in:
@@ -119,10 +119,10 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
||||
"""Set up a configuration entry for Jewish calendar."""
|
||||
language = config_entry.data.get(CONF_LANGUAGE, DEFAULT_LANGUAGE)
|
||||
diaspora = config_entry.data.get(CONF_DIASPORA, DEFAULT_DIASPORA)
|
||||
candle_lighting_offset = config_entry.data.get(
|
||||
candle_lighting_offset = config_entry.options.get(
|
||||
CONF_CANDLE_LIGHT_MINUTES, DEFAULT_CANDLE_LIGHT
|
||||
)
|
||||
havdalah_offset = config_entry.data.get(
|
||||
havdalah_offset = config_entry.options.get(
|
||||
CONF_HAVDALAH_OFFSET_MINUTES, DEFAULT_HAVDALAH_OFFSET_MINUTES
|
||||
)
|
||||
|
||||
@@ -156,7 +156,8 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
||||
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
||||
|
||||
async def update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||
await hass.config_entries.async_reload(entry.entry_id)
|
||||
# Trigger update of states for all platforms
|
||||
await hass.config_entries.async_reload(config_entry.entry_id)
|
||||
|
||||
config_entry.async_on_unload(config_entry.add_update_listener(update_listener))
|
||||
return True
|
||||
|
@@ -179,4 +179,4 @@ async def test_options_updates_sensors(
|
||||
new_sensor_value = dt_util.parse_datetime(new_sensor_value)
|
||||
|
||||
# Verify that the new sensor value is one minute later
|
||||
assert new_sensor_value - initial_sensor_value == timedelta(minutes=1)
|
||||
assert abs(new_sensor_value - initial_sensor_value) == timedelta(minutes=1)
|
||||
|
Reference in New Issue
Block a user