From db4822373dbcc507af8d6b3347f8dbbbad2eca9f Mon Sep 17 00:00:00 2001 From: Robin Cole Date: Wed, 12 Feb 2020 05:45:26 +0000 Subject: [PATCH 1/4] Add _LOGGER to init --- custom_components/huesensor/__init__.py | 4 ++++ custom_components/huesensor/binary_sensor.py | 7 ++++--- custom_components/huesensor/device_tracker.py | 3 ++- custom_components/huesensor/manifest.json | 2 +- custom_components/huesensor/remote.py | 12 +++--------- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/custom_components/huesensor/__init__.py b/custom_components/huesensor/__init__.py index eb53e8d..7e379fe 100644 --- a/custom_components/huesensor/__init__.py +++ b/custom_components/huesensor/__init__.py @@ -1,7 +1,11 @@ """The huesensors component.""" import asyncio +import logging + import async_timeout +_LOGGER = logging.getLogger(__name__) + def get_bridges(hass): from homeassistant.components import hue diff --git a/custom_components/huesensor/binary_sensor.py b/custom_components/huesensor/binary_sensor.py index 3fe34f3..e00eb27 100644 --- a/custom_components/huesensor/binary_sensor.py +++ b/custom_components/huesensor/binary_sensor.py @@ -2,14 +2,15 @@ Binary sensor for Hue motion sensors. """ import asyncio -import async_timeout import logging import threading from datetime import timedelta -from homeassistant.components.sensor import PLATFORM_SCHEMA -from homeassistant.const import STATE_ON, STATE_OFF +import async_timeout + from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.sensor import PLATFORM_SCHEMA +from homeassistant.const import STATE_OFF, STATE_ON from homeassistant.helpers.event import async_track_time_interval from . import get_bridges, update_api diff --git a/custom_components/huesensor/device_tracker.py b/custom_components/huesensor/device_tracker.py index fa542c4..7a7b498 100644 --- a/custom_components/huesensor/device_tracker.py +++ b/custom_components/huesensor/device_tracker.py @@ -6,7 +6,9 @@ from datetime import timedelta import async_timeout + import homeassistant.util.dt as dt_util +from homeassistant.components import zone from homeassistant.components.device_tracker import PLATFORM_SCHEMA from homeassistant.components.device_tracker.const import ( ATTR_ATTRIBUTES, @@ -24,7 +26,6 @@ ) from homeassistant.helpers.event import async_track_time_interval from homeassistant.util import slugify -from homeassistant.components import zone from . import get_bridges, update_api diff --git a/custom_components/huesensor/manifest.json b/custom_components/huesensor/manifest.json index b2ab23b..923797b 100644 --- a/custom_components/huesensor/manifest.json +++ b/custom_components/huesensor/manifest.json @@ -4,5 +4,5 @@ "documentation": "https://github.com/robmarkcole/Hue-sensors-HASS", "requirements": [], "dependencies": ["hue"], - "codeowners": ["@robmarkcole"] + "codeowners": ["@robmarkcole"], } diff --git a/custom_components/huesensor/remote.py b/custom_components/huesensor/remote.py index c86f78a..b65c527 100644 --- a/custom_components/huesensor/remote.py +++ b/custom_components/huesensor/remote.py @@ -2,20 +2,14 @@ Hue remotes. """ import asyncio -import async_timeout import logging import threading from datetime import timedelta -from homeassistant.components.remote import ( - PLATFORM_SCHEMA, - RemoteDevice, -) -from homeassistant.helpers.entity import ( - Entity, - ToggleEntity, -) +import async_timeout +from homeassistant.components.remote import PLATFORM_SCHEMA, RemoteDevice +from homeassistant.helpers.entity import Entity, ToggleEntity from homeassistant.helpers.event import async_track_time_interval from . import get_bridges, update_api From 0874a44c63cb284c33e2af3ceb6d17f9c4b66a54 Mon Sep 17 00:00:00 2001 From: Robin Cole Date: Wed, 12 Feb 2020 05:52:26 +0000 Subject: [PATCH 2/4] Update __init__.py --- custom_components/huesensor/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/custom_components/huesensor/__init__.py b/custom_components/huesensor/__init__.py index 7e379fe..7de6e96 100644 --- a/custom_components/huesensor/__init__.py +++ b/custom_components/huesensor/__init__.py @@ -6,6 +6,8 @@ _LOGGER = logging.getLogger(__name__) +DEPENDENCIES = ["hue"] + def get_bridges(hass): from homeassistant.components import hue From e59a053a932af79437b9ad9c5a12a2785fbcd2e8 Mon Sep 17 00:00:00 2001 From: Robin Cole Date: Wed, 12 Feb 2020 05:56:38 +0000 Subject: [PATCH 3/4] Update manifest.json --- custom_components/huesensor/manifest.json | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/custom_components/huesensor/manifest.json b/custom_components/huesensor/manifest.json index 923797b..cbf08c2 100644 --- a/custom_components/huesensor/manifest.json +++ b/custom_components/huesensor/manifest.json @@ -3,6 +3,10 @@ "name": "Hue sensor custom component", "documentation": "https://github.com/robmarkcole/Hue-sensors-HASS", "requirements": [], - "dependencies": ["hue"], - "codeowners": ["@robmarkcole"], -} + "dependencies": [ + "hue" + ], + "codeowners": [ + "@robmarkcole" + ] +} \ No newline at end of file From 0db38c4f70b52b2a5b6cb328fbe20fc4417b9dbe Mon Sep 17 00:00:00 2001 From: Robin Cole Date: Wed, 12 Feb 2020 07:56:00 +0000 Subject: [PATCH 4/4] Remove DEPENDENCIES --- custom_components/huesensor/__init__.py | 2 -- custom_components/huesensor/binary_sensor.py | 2 -- custom_components/huesensor/device_tracker.py | 1 - custom_components/huesensor/remote.py | 2 -- 4 files changed, 7 deletions(-) diff --git a/custom_components/huesensor/__init__.py b/custom_components/huesensor/__init__.py index 7de6e96..7e379fe 100644 --- a/custom_components/huesensor/__init__.py +++ b/custom_components/huesensor/__init__.py @@ -6,8 +6,6 @@ _LOGGER = logging.getLogger(__name__) -DEPENDENCIES = ["hue"] - def get_bridges(hass): from homeassistant.components import hue diff --git a/custom_components/huesensor/binary_sensor.py b/custom_components/huesensor/binary_sensor.py index e00eb27..07b543c 100644 --- a/custom_components/huesensor/binary_sensor.py +++ b/custom_components/huesensor/binary_sensor.py @@ -15,8 +15,6 @@ from . import get_bridges, update_api -DEPENDENCIES = ["hue"] - _LOGGER = logging.getLogger(__name__) diff --git a/custom_components/huesensor/device_tracker.py b/custom_components/huesensor/device_tracker.py index 7a7b498..6b47f0a 100644 --- a/custom_components/huesensor/device_tracker.py +++ b/custom_components/huesensor/device_tracker.py @@ -29,7 +29,6 @@ from . import get_bridges, update_api -DEPENDENCIES = ["hue"] _LOGGER = logging.getLogger(__name__) diff --git a/custom_components/huesensor/remote.py b/custom_components/huesensor/remote.py index b65c527..bbef247 100644 --- a/custom_components/huesensor/remote.py +++ b/custom_components/huesensor/remote.py @@ -14,8 +14,6 @@ from . import get_bridges, update_api -DEPENDENCIES = ["hue"] - _LOGGER = logging.getLogger(__name__)