From e9ba7002727794c2bf0dec1254604eef5b887459 Mon Sep 17 00:00:00 2001 From: Andrew Jackson Date: Thu, 14 Dec 2023 09:37:24 +0000 Subject: [PATCH] Tidy up config --- README.md | 1 - custom_components/battery_notes/__init__.py | 18 ++++++++++++++++++ custom_components/battery_notes/manifest.json | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7bd23c5c3..4f0c045c8 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,6 @@ Restart Home Assistant Add the following entry to your ```configuration.yaml``` ``` battery_notes: - enable_autodiscovery: true ``` Restart Home Assistant a final time In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Battery Notes" diff --git a/custom_components/battery_notes/__init__.py b/custom_components/battery_notes/__init__.py index 5d4aa2c08..e42fdec17 100644 --- a/custom_components/battery_notes/__init__.py +++ b/custom_components/battery_notes/__init__.py @@ -7,6 +7,9 @@ import logging +import homeassistant.helpers.config_validation as cv +import voluptuous as vol + from awesomeversion.awesomeversion import AwesomeVersion from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback @@ -21,12 +24,27 @@ DOMAIN_CONFIG, PLATFORMS, CONF_ENABLE_AUTODISCOVERY, + CONF_LIBRARY, ) MIN_HA_VERSION = "2023.7" _LOGGER = logging.getLogger(__name__) +CONFIG_SCHEMA = vol.Schema( + { + DOMAIN: vol.All( + vol.Schema( + { + vol.Optional(CONF_ENABLE_AUTODISCOVERY, default=True): cv.boolean, + vol.Optional(CONF_LIBRARY, default="library.json"): cv.string, + }, + ), + ), + }, + extra=vol.ALLOW_EXTRA, +) + async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Integration setup.""" diff --git a/custom_components/battery_notes/manifest.json b/custom_components/battery_notes/manifest.json index 8251b1c7f..7640df655 100644 --- a/custom_components/battery_notes/manifest.json +++ b/custom_components/battery_notes/manifest.json @@ -9,5 +9,5 @@ "integration_type": "device", "iot_class": "calculated", "issue_tracker": "https://github.com/andrew-codechimp/ha-battery-notes/issues", - "version": "1.1.1" + "version": "1.1.2" } \ No newline at end of file