Skip to content

Commit 3356767

Browse files
Improve error handling
1 parent 01f3b19 commit 3356767

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

custom_components/battery_notes/config_flow.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ async def async_step_user(
111111
device_id = user_input[CONF_DEVICE_ID]
112112

113113
if DOMAIN in self.hass.data:
114-
coordinator = self.hass.data[DOMAIN][DATA_UPDATE_COORDINATOR]
115-
await coordinator.async_refresh()
114+
if DATA_UPDATE_COORDINATOR in self.hass.data[DOMAIN]:
115+
coordinator = self.hass.data[DOMAIN][DATA_UPDATE_COORDINATOR]
116+
await coordinator.async_refresh()
116117

117118
device_registry = dr.async_get(self.hass)
118119
device_entry = device_registry.async_get(device_id)
@@ -140,9 +141,10 @@ async def async_step_user(
140141
schema = DEVICE_SCHEMA
141142
# If show_all_devices = is specified and true, don't filter
142143
if DOMAIN in self.hass.data:
143-
domain_config = self.hass.data[DOMAIN][DOMAIN_CONFIG]
144-
if domain_config.get(CONF_SHOW_ALL_DEVICES, False):
145-
schema = DEVICE_SCHEMA_ALL
144+
if DOMAIN_CONFIG in self.hass.data[DOMAIN]:
145+
domain_config = self.hass.data[DOMAIN][DOMAIN_CONFIG]
146+
if domain_config.get(CONF_SHOW_ALL_DEVICES, False):
147+
schema = DEVICE_SCHEMA_ALL
146148

147149
return self.async_show_form(
148150
step_id="user",

custom_components/battery_notes/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"integration_type": "device",
1010
"iot_class": "calculated",
1111
"issue_tracker": "https://github.com/andrew-codechimp/ha-battery-notes/issues",
12-
"version": "1.3.1"
12+
"version": "1.3.2"
1313
}

0 commit comments

Comments
 (0)