Skip to content

Commit 01f3b19

Browse files
Improved error handling, added devices (#156)
1 parent b322584 commit 01f3b19

File tree

4 files changed

+22
-19
lines changed

4 files changed

+22
-19
lines changed

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,13 @@ Platform | Name | Description
3737
Or
3838
Search for `Battery Notes` in HACS and install it under the "Integrations" category.
3939

40-
41-
Restart Home Assistant
42-
4340
**Important**
4441

4542
Add the following entry to your `configuration.yaml`
4643
```
4744
battery_notes:
4845
```
49-
Restart Home Assistant a final time
46+
Restart Home Assistant
5047
In the HA UI go to Settings -> Integrations click "+" and search for "Battery Notes"
5148

5249
### Manual Installation

custom_components/battery_notes/config_flow.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ async def async_step_user(
110110

111111
device_id = user_input[CONF_DEVICE_ID]
112112

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

117117
device_registry = dr.async_get(self.hass)
118118
device_entry = device_registry.async_get(device_id)
@@ -137,12 +137,12 @@ async def async_step_user(
137137

138138
return await self.async_step_battery()
139139

140-
domain_config = self.hass.data[DOMAIN][DOMAIN_CONFIG]
141-
142140
schema = DEVICE_SCHEMA
143141
# If show_all_devices = is specified and true, don't filter
144-
if domain_config.get(CONF_SHOW_ALL_DEVICES, False):
145-
schema = DEVICE_SCHEMA_ALL
142+
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
146146

147147
return self.async_show_form(
148148
step_id="user",

custom_components/battery_notes/data/library.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,6 @@
313313
"model": "KR1",
314314
"battery_type": "CR2"
315315
},
316-
{
317-
"manufacturer": "Google",
318-
"model": "Topaz-2.7",
319-
"battery_type": "AA",
320-
"battery_quantity": 3
321-
},
322316
{
323317
"manufacturer": "Govee",
324318
"model": "H5101/H5102/H5177",
@@ -458,6 +452,12 @@
458452
"battery_type": "AA",
459453
"battery_quantity": 4
460454
},
455+
{
456+
"manufacturer": "Kwikset",
457+
"model": "Kevo",
458+
"battery_type": "AA",
459+
"battery_quantity": 4
460+
},
461461
{
462462
"manufacturer": "Kwikset",
463463
"model": "SMARTCODE_DEADBOLT_10T",
@@ -664,6 +664,12 @@
664664
"model": "Electra Washbasin Faucet",
665665
"battery_type": "2CR5"
666666
},
667+
{
668+
"manufacturer": "Orbit BHyve",
669+
"model": "HT25-0000",
670+
"battery_type": "AA",
671+
"battery_quantity": 2
672+
},
667673
{
668674
"manufacturer": "ORVIBO",
669675
"model": "e70f96b3773a4c9283c6862dbafb6a99",
@@ -1394,4 +1400,4 @@
13941400
"battery_quantity": 2
13951401
}
13961402
]
1397-
}
1403+
}

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.0"
12+
"version": "1.3.1"
1313
}

0 commit comments

Comments
 (0)