We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ee7a95a commit d04b92eCopy full SHA for d04b92e
custom_components/battery_notes/library.py
@@ -27,10 +27,17 @@ class Library: # pylint: disable=too-few-public-methods
27
28
def __init__(self, hass: HomeAssistant) -> None:
29
"""Init."""
30
- json_path = os.path.join(
31
- BUILT_IN_DATA_DIRECTORY,
32
- hass.data[DOMAIN][DOMAIN_CONFIG].get(CONF_LIBRARY, "library.json"),
33
- )
+
+ if DOMAIN_CONFIG not in hass.data[DOMAIN]:
+ json_path = os.path.join(
+ BUILT_IN_DATA_DIRECTORY,
34
+ "library.json",
35
+ )
36
+ else:
37
38
39
+ hass.data[DOMAIN][DOMAIN_CONFIG].get(CONF_LIBRARY, "library.json"),
40
41
42
_LOGGER.debug("Using library file at %s", json_path)
43
0 commit comments