Skip to content

Commit

Permalink
Attempt to fix scan_interal KeyError
Browse files Browse the repository at this point in the history
  • Loading branch information
cloneofghosts committed Aug 17, 2024
1 parent 1af0a02 commit da40194
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion custom_components/pirateweather/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
pw_entity_rounding = _get_config_value(entry, PW_ROUND)
pw_scan_Int = _get_config_value(entry, CONF_SCAN_INTERVAL)

if not pw_scan_Int:
pw_scan_Int = 1200

if pw_scan_Int < 60:
pw_scan_Int = 60

# Extract list of int from forecast days/ hours string if present
# _LOGGER.warning('forecast_days_type: ' + str(type(forecast_days)))

Expand Down Expand Up @@ -164,7 +170,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:


def _get_config_value(config_entry: ConfigEntry, key: str) -> Any:
if config_entry.options:
if config_entry.options and key in config_entry.options:
return config_entry.options[key]
return config_entry.data[key]

Expand Down
4 changes: 2 additions & 2 deletions custom_components/pirateweather/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"requirements": [
"python-forecastio==1.4.0"
],
"version": "1.5.6"
}
"version": "1.5.7b1"
}

0 comments on commit da40194

Please sign in to comment.