From e85ab067bd62cc3fc4a81eca7c05c36c2ce98e8f Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 16 Sep 2024 14:26:20 +0200 Subject: [PATCH] Move and rename crownstone base entity to separate module (#126034) --- .../components/crownstone/{devices.py => entity.py} | 2 +- homeassistant/components/crownstone/light.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) rename homeassistant/components/crownstone/{devices.py => entity.py} (96%) diff --git a/homeassistant/components/crownstone/devices.py b/homeassistant/components/crownstone/entity.py similarity index 96% rename from homeassistant/components/crownstone/devices.py rename to homeassistant/components/crownstone/entity.py index 4995702701d..cb06a5fb00d 100644 --- a/homeassistant/components/crownstone/devices.py +++ b/homeassistant/components/crownstone/entity.py @@ -10,7 +10,7 @@ from homeassistant.helpers.entity import Entity from .const import CROWNSTONE_INCLUDE_TYPES, DOMAIN -class CrownstoneBaseEntity(Entity): +class CrownstoneEntity(Entity): """Base entity class for Crownstone devices.""" _attr_should_poll = False diff --git a/homeassistant/components/crownstone/light.py b/homeassistant/components/crownstone/light.py index 37904408606..16faa3a36d2 100644 --- a/homeassistant/components/crownstone/light.py +++ b/homeassistant/components/crownstone/light.py @@ -24,7 +24,7 @@ from .const import ( SIG_CROWNSTONE_STATE_UPDATE, SIG_UART_STATE_CHANGE, ) -from .devices import CrownstoneBaseEntity +from .entity import CrownstoneEntity from .helpers import map_from_to if TYPE_CHECKING: @@ -39,7 +39,7 @@ async def async_setup_entry( """Set up crownstones from a config entry.""" manager: CrownstoneEntryManager = hass.data[DOMAIN][config_entry.entry_id] - entities: list[CrownstoneEntity] = [] + entities: list[CrownstoneLightEntity] = [] # Add Crownstone entities that support switching/dimming for sphere in manager.cloud.cloud_data: @@ -47,10 +47,10 @@ async def async_setup_entry( if crownstone.type in CROWNSTONE_INCLUDE_TYPES: # Crownstone can communicate with Crownstone USB if manager.uart and sphere.cloud_id == manager.usb_sphere_id: - entities.append(CrownstoneEntity(crownstone, manager.uart)) + entities.append(CrownstoneLightEntity(crownstone, manager.uart)) # Crownstone can't communicate with Crownstone USB else: - entities.append(CrownstoneEntity(crownstone)) + entities.append(CrownstoneLightEntity(crownstone)) async_add_entities(entities) @@ -65,7 +65,7 @@ def hass_to_crownstone_state(value: int) -> int: return map_from_to(value, 0, 255, 0, 100) -class CrownstoneEntity(CrownstoneBaseEntity, LightEntity): +class CrownstoneLightEntity(CrownstoneEntity, LightEntity): """Representation of a crownstone. Light platform is used to support dimming.