Skip to content

Commit

Permalink
fix radius not working on config flow (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
firstof9 authored Sep 7, 2021
1 parent dfa6e45 commit 4e29eb5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions custom_components/openei/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def _get_default(key: str, fallback_default: Any = None) -> None:
vol.Required(
CONF_API_KEY, default=_get_default(CONF_API_KEY, "")
): cv.string,
vol.Optional(CONF_RADIUS, default=_get_default(CONF_RADIUS, "")): cv.float,
vol.Optional(CONF_RADIUS, default=_get_default(CONF_RADIUS, "")): cv.string,
},
)

Expand Down Expand Up @@ -243,8 +243,9 @@ async def _get_utility_list(hass, user_input) -> list | None:
lat = hass.config.latitude
lon = hass.config.longitude
api = user_input[CONF_API_KEY]
radius = user_input[CONF_RADIUS]

plans = openeihttp.Rates(api, lat, lon)
plans = openeihttp.Rates(api, lat, lon, radius=radius)
plans = await hass.async_add_executor_job(_lookup_plans, plans)
utilities = []

Expand Down
2 changes: 1 addition & 1 deletion custom_components/openei/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"config_flow": true,
"codeowners": ["@firstof9"],
"requirements": ["python-openei==0.1.6"],
"version": "0.0.5"
"version": "0.0.6"
}
6 changes: 4 additions & 2 deletions custom_components/openei/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"title": "OpenEI (Step 1)",
"description": "If you do not have an API Key yet you can get one here: https://openei.org/services/api/signup/",
"data": {
"api_key": "API Key"
"api_key": "API Key",
"radius": "Radius in miles (optional)"
}
},
"user_2": {
Expand Down Expand Up @@ -36,7 +37,8 @@
"title": "OpenEI (Step 1)",
"description": "If you do not have an API Key yet you can get one here: https://openei.org/services/api/signup/",
"data": {
"api_key": "API Key"
"api_key": "API Key",
"radius": "Radius in miles (optional)"
}
},
"user_2": {
Expand Down

0 comments on commit 4e29eb5

Please sign in to comment.