From d863e4b715ce527f0a3bca39c03517532b5fe55e Mon Sep 17 00:00:00 2001 From: dronenb Date: Sun, 11 Jun 2023 17:37:28 -0700 Subject: [PATCH] Fix device entities and update version --- custom_components/luxor/const.py | 2 +- custom_components/luxor/light.py | 14 ++++++++------ custom_components/luxor/manifest.json | 2 +- custom_components/luxor/scene.py | 12 ++++++------ 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/custom_components/luxor/const.py b/custom_components/luxor/const.py index 98759d1..1c421e8 100644 --- a/custom_components/luxor/const.py +++ b/custom_components/luxor/const.py @@ -2,7 +2,7 @@ NAME = "FXLuminaire Luxor" DOMAIN = "luxor" DOMAIN_DATA = f"{DOMAIN}_data" -VERSION = "0.0.1" +VERSION = "0.0.2" ISSUE_URL = "https://github.com/dcramer/hass-luxor/issues" # Platforms diff --git a/custom_components/luxor/light.py b/custom_components/luxor/light.py index 7970de5..c6bdc17 100644 --- a/custom_components/luxor/light.py +++ b/custom_components/luxor/light.py @@ -10,6 +10,7 @@ ) from homeassistant.exceptions import PlatformNotReady from homeassistant.helpers.debounce import Debouncer +from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, DataUpdateCoordinator, @@ -112,7 +113,7 @@ def __init__(self, coordinator, controller, group_id, name, intensity, color): self.group_id = group_id self.intensity = intensity self.color = color - + self._attr_unique_id = "{}{}".format(name, group_id) self._attr_name = name async def async_turn_on( @@ -150,8 +151,9 @@ def is_on(self): @property def device_info(self): - return { - "identifiers": ("{}_{}".format(DOMAIN, LIGHT), self.group_id), - "name": self.name, - "via_device": (DOMAIN, self.controller.name), - } + return DeviceInfo( + identifiers={("{}_{}".format(DOMAIN, LIGHT), self.group_id)}, + manufacturer="FXLuminaire", + name=self.name, + via_device=(DOMAIN, self.controller.name), + ) diff --git a/custom_components/luxor/manifest.json b/custom_components/luxor/manifest.json index 78f1703..0ae29a9 100644 --- a/custom_components/luxor/manifest.json +++ b/custom_components/luxor/manifest.json @@ -10,5 +10,5 @@ "requirements": [ "luxor-openapi-asyncio==0.1.0" ], - "version": "0.0.0" + "version": "0.0.2" } diff --git a/custom_components/luxor/scene.py b/custom_components/luxor/scene.py index 0a3b97a..36a8ac7 100644 --- a/custom_components/luxor/scene.py +++ b/custom_components/luxor/scene.py @@ -7,6 +7,7 @@ from homeassistant.components.scene import Scene from homeassistant.exceptions import PlatformNotReady from homeassistant.helpers.debounce import Debouncer +from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, DataUpdateCoordinator, @@ -98,7 +99,7 @@ def __init__(self, controller, theme_index, name, on_off): self.theme_index = theme_index self._attr_name = name - + self._attr_unique_id = "{}{}".format(name, theme_index) async def async_activate(self, **kwargs): # pylint: disable=unused-argument api_instance = themes_api.ThemesApi(self.controller.api) # TODO: handle non-0 status codes @@ -108,8 +109,7 @@ async def async_activate(self, **kwargs): # pylint: disable=unused-argument @property def device_info(self): - return { - "identifiers": ("{}_{}".format(DOMAIN, SCENE), self.theme_index), - "name": self.name, - "via_device": (DOMAIN, self.controller.name), - } + return DeviceInfo( + identifiers={(DOMAIN, self.controller.name)}, + name=self.controller.name, + )