diff --git a/README.md b/README.md index e6502f9..3092a7d 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ monitor_docker: | rename | dictionary (Optional) | Dictionary of containers to rename. Default no renaming. | | sensorname | string (Optional) | Sensor string to format the name used in Home Assistant. Defaults to `{name} {sensor}`, where `{name}` is the container name and `{sensor}` is e.g. Memory, Status, Network speed Up | | switchname | string (optional) | Switch string to format the name used in Home Assistant. Defaults to `{name}`, where `{name}` is the container name. | -| switch | boolean (Optional) | Enable/Disable the switch entity for all containers. Default is enabled. | +| switchenabled | boolean (Optional) | Enable/Disable the switch entity for all containers. Default is enabled. | | Monitored Conditions | Description | Unit | | --------------------------------- | ------------------------------- | ----- | diff --git a/custom_components/monitor_docker/__init__.py b/custom_components/monitor_docker/__init__.py index 842ea08..a43b962 100644 --- a/custom_components/monitor_docker/__init__.py +++ b/custom_components/monitor_docker/__init__.py @@ -24,7 +24,7 @@ CONF_CONTAINERS, CONF_RENAME, CONF_SENSORNAME, - CONF_SWITCH, + CONF_SWITCHENABLED, CONF_SWITCHNAME, CONFIG, CONTAINER_INFO_ALLINONE, @@ -53,7 +53,7 @@ vol.Optional(CONF_CONTAINERS, default=[]): cv.ensure_list, vol.Optional(CONF_RENAME, default={}): dict, vol.Optional(CONF_SENSORNAME, default=DEFAULT_SENSORNAME): cv.string, - vol.Optional(CONF_SWITCH, default=True): cv.boolean, + vol.Optional(CONF_SWITCHENABLED, default=True): cv.boolean, vol.Optional(CONF_SWITCHNAME, default=DEFAULT_SWITCHNAME): cv.string, vol.Optional(CONF_CERTPATH, default=""): cv.string, } diff --git a/custom_components/monitor_docker/const.py b/custom_components/monitor_docker/const.py index dd7b5da..8249ce3 100644 --- a/custom_components/monitor_docker/const.py +++ b/custom_components/monitor_docker/const.py @@ -9,7 +9,7 @@ CONF_CONTAINERS = "containers" CONF_RENAME = "rename" CONF_SENSORNAME = "sensorname" -CONF_SWITCH = "switch" +CONF_SWITCHENABLED = "switchenabled" CONF_SWITCHNAME = "switchname" DEFAULT_NAME = "Docker" diff --git a/custom_components/monitor_docker/sensor.py b/custom_components/monitor_docker/sensor.py index 0212d99..97a5ec7 100644 --- a/custom_components/monitor_docker/sensor.py +++ b/custom_components/monitor_docker/sensor.py @@ -48,6 +48,8 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= config = hass.data[DOMAIN][name][CONFIG] prefix = config[CONF_NAME] + _LOGGER.debug("Setting up sensor(s)") + sensors = [] sensors = [ DockerSensor(api, prefix, variable) diff --git a/custom_components/monitor_docker/switch.py b/custom_components/monitor_docker/switch.py index 429c87a..a9795cf 100644 --- a/custom_components/monitor_docker/switch.py +++ b/custom_components/monitor_docker/switch.py @@ -13,7 +13,7 @@ CONFIG, CONF_CONTAINERS, CONF_RENAME, - CONF_SWITCH, + CONF_SWITCHENABLED, CONF_SWITCHNAME, CONTAINER, CONTAINER_INFO_STATE, @@ -34,9 +34,12 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= prefix = config[CONF_NAME] # Don't create any switch if disabled - if not config[CONF_SWITCH]: + if not config[CONF_SWITCHENABLED]: + _LOGGER.debug("Switch(es) are disabled") return True + _LOGGER.debug("Setting up switch(es)") + switches = [] # We support add/re-add of a container diff --git a/info.md b/info.md index 0766a4f..46894d3 100644 --- a/info.md +++ b/info.md @@ -32,6 +32,11 @@ services: ### Configuration +{% if installed %} +### Breaking Changes +Replaced option **switch** with **switchenabled**, because it gave some users an error +{% endif %} + To use the `monitor_docker` in your installation, add the following to your `configuration.yaml` file: ```yaml @@ -82,7 +87,7 @@ monitor_docker: | rename | dictionary (Optional) | Dictionary of containers to rename. Default no renaming. | | sensorname | string (Optional) | Sensor string to format the name used in Home Assistant. Defaults to `{name} {sensor}`, where `{name}` is the container name and `{sensor}` is e.g. Memory, Status, Network speed Up | | switchname | string (optional) | Switch string to format the name used in Home Assistant. Defaults to `{name}`, where `{name}` is the container name. | -| switch | boolean (Optional) | Enable/Disable the switch entity for all containers. Default is enabled. | +| switchenabled | boolean (Optional) | Enable/Disable the switch entity for all containers. Default is enabled. | | Monitored Conditions | Description | Unit | | --------------------------------- | ------------------------------- | ----- |