diff --git a/custom_components/monitor_docker/__init__.py b/custom_components/monitor_docker/__init__.py index 22f20ec..ae1aef0 100644 --- a/custom_components/monitor_docker/__init__.py +++ b/custom_components/monitor_docker/__init__.py @@ -115,7 +115,7 @@ def RunDocker(hass, entry): if entry[CONF_RETRY] == 0: raise else: - _LOGGER.error("%s", err) + _LOGGER.error("%s", str(err)) _LOGGER.error("Retry in %d seconds", entry[CONF_RETRY]) time.sleep(entry[CONF_RETRY]) diff --git a/custom_components/monitor_docker/helpers.py b/custom_components/monitor_docker/helpers.py index 5eee59c..3ca0fa3 100644 --- a/custom_components/monitor_docker/helpers.py +++ b/custom_components/monitor_docker/helpers.py @@ -115,7 +115,7 @@ def __init__(self, hass, config, startCount=0): url = url.replace("unix://", "unix:///") # When we reconnect with tcp, we should delay - docker is maybe not fully ready - if startCount > 0 and url.find("unix:") != 0: + if startCount > 0 and url is not None and url.find("unix:") != 0: time.sleep(5) # Do some debugging logging for TCP/TLS @@ -938,7 +938,8 @@ async def _run_container_stats(self): cache = raw["memory_stats"]["stats"]["inactive_file"] memory_stats["usage"] = toMB( - raw["memory_stats"]["usage"] - cache, self._config[CONF_PRECISION_MEMORY_MB] + raw["memory_stats"]["usage"] - cache, + self._config[CONF_PRECISION_MEMORY_MB], ) memory_stats["limit"] = toMB( raw["memory_stats"]["limit"], self._config[CONF_PRECISION_MEMORY_MB]