Skip to content

Commit

Permalink
Add old presets format deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
ollo69 authored and swingerman committed Nov 16, 2022
1 parent 82d9e9e commit 9b3e37e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions custom_components/dual_smart_thermostat/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,18 @@ async def async_setup_platform(
and ATTR_TARGET_TEMP_HIGH in values
and values[ATTR_TARGET_TEMP_LOW] < values[ATTR_TARGET_TEMP_HIGH]
}
# Try to load presets in old format if new format not available in config
if not presets_dict:
presets = {k: config[v] for k, v in CONF_PRESETS_OLD.items() if v in config}

# Try to load presets in old format and use if new format not available in config
old_presets = {k: config[v] for k, v in CONF_PRESETS_OLD.items() if v in config}
if old_presets:
_LOGGER.warning(
"Found deprecated presets settings in configuration. "
"Please remove and replace with new presets settings format. "
"Read documentation in integration repository for more details"
)
if not presets_dict:
presets = old_presets

precision = config.get(CONF_PRECISION)
target_temperature_step = config.get(CONF_TEMP_STEP)
unit = hass.config.units.temperature_unit
Expand Down

0 comments on commit 9b3e37e

Please sign in to comment.