Skip to content

Commit

Permalink
Improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-codechimp committed Dec 27, 2023
1 parent 01f3b19 commit 3356767
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions custom_components/battery_notes/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ async def async_step_user(
device_id = user_input[CONF_DEVICE_ID]

if DOMAIN in self.hass.data:
coordinator = self.hass.data[DOMAIN][DATA_UPDATE_COORDINATOR]
await coordinator.async_refresh()
if DATA_UPDATE_COORDINATOR in self.hass.data[DOMAIN]:
coordinator = self.hass.data[DOMAIN][DATA_UPDATE_COORDINATOR]
await coordinator.async_refresh()

device_registry = dr.async_get(self.hass)
device_entry = device_registry.async_get(device_id)
Expand Down Expand Up @@ -140,9 +141,10 @@ async def async_step_user(
schema = DEVICE_SCHEMA
# If show_all_devices = is specified and true, don't filter
if DOMAIN in self.hass.data:
domain_config = self.hass.data[DOMAIN][DOMAIN_CONFIG]
if domain_config.get(CONF_SHOW_ALL_DEVICES, False):
schema = DEVICE_SCHEMA_ALL
if DOMAIN_CONFIG in self.hass.data[DOMAIN]:
domain_config = self.hass.data[DOMAIN][DOMAIN_CONFIG]
if domain_config.get(CONF_SHOW_ALL_DEVICES, False):
schema = DEVICE_SCHEMA_ALL

return self.async_show_form(
step_id="user",
Expand Down
2 changes: 1 addition & 1 deletion custom_components/battery_notes/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"integration_type": "device",
"iot_class": "calculated",
"issue_tracker": "https://github.com/andrew-codechimp/ha-battery-notes/issues",
"version": "1.3.1"
"version": "1.3.2"
}

0 comments on commit 3356767

Please sign in to comment.