diff --git a/README.md b/README.md index 9895054..df8a3f6 100644 --- a/README.md +++ b/README.md @@ -277,6 +277,18 @@ end: '{{ now() }}' You can automatically track new versions of this component and update it by [HACS][hacs]. +## Troubleshooting + +To enable debug logs use this configuration: +```yaml +# Example configuration.yaml entry +logger: + default: error + logs: + custom_components.average: debug +``` +... then restart HA. + ## Contributions are welcome! This is an active open-source project. We are always open to people who want to diff --git a/custom_components/average/sensor.py b/custom_components/average/sensor.py index 186f01e..74d54c8 100644 --- a/custom_components/average/sensor.py +++ b/custom_components/average/sensor.py @@ -302,7 +302,8 @@ def _update_period(self): # pylint: disable=r0912 except (TemplateError, TypeError) as ex: self.handle_template_exception(ex, "start") return - start = dt_util.parse_datetime(start_rendered) + if isinstance(start_rendered, str): + start = dt_util.parse_datetime(start_rendered) if start is None: try: start = dt_util.as_local( @@ -322,7 +323,8 @@ def _update_period(self): # pylint: disable=r0912 except (TemplateError, TypeError) as ex: self.handle_template_exception(ex, "end") return - end = dt_util.parse_datetime(end_rendered) + if isinstance(end_rendered, str): + end = dt_util.parse_datetime(end_rendered) if end is None: try: end = dt_util.as_local( diff --git a/requirements-dev.txt b/requirements-dev.txt index 1c61057..a2dc454 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,7 +2,7 @@ black==20.8b1 flake8~=3.8 mypy==0.790 -packaging~=20.7 +packaging~=20.8 pre-commit~=2.9 PyGithub==1.54 pylint~=2.6 diff --git a/requirements.txt b/requirements.txt index da2f084..7ed1447 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ voluptuous~=0.12 -homeassistant~=0.118 +homeassistant~=2021.1