diff --git a/homeassistant/components/mysensors/binary_sensor.py b/homeassistant/components/mysensors/binary_sensor.py index b8a3769308a..47805e86b1c 100644 --- a/homeassistant/components/mysensors/binary_sensor.py +++ b/homeassistant/components/mysensors/binary_sensor.py @@ -17,8 +17,9 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback -from .. import mysensors +from . import setup_mysensors_platform from .const import MYSENSORS_DISCOVERY, DiscoveryInfo +from .device import MySensorsChildEntity from .helpers import on_unload @@ -77,7 +78,7 @@ async def async_setup_entry( @callback def async_discover(discovery_info: DiscoveryInfo) -> None: """Discover and add a MySensors binary_sensor.""" - mysensors.setup_mysensors_platform( + setup_mysensors_platform( hass, Platform.BINARY_SENSOR, discovery_info, @@ -96,7 +97,7 @@ async def async_setup_entry( ) -class MySensorsBinarySensor(mysensors.device.MySensorsChildEntity, BinarySensorEntity): +class MySensorsBinarySensor(MySensorsChildEntity, BinarySensorEntity): """Representation of a MySensors binary sensor child node.""" entity_description: MySensorsBinarySensorDescription diff --git a/homeassistant/components/mysensors/climate.py b/homeassistant/components/mysensors/climate.py index 0008297f299..79bc7b4b98d 100644 --- a/homeassistant/components/mysensors/climate.py +++ b/homeassistant/components/mysensors/climate.py @@ -18,8 +18,9 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.util.unit_system import METRIC_SYSTEM -from .. import mysensors +from . import setup_mysensors_platform from .const import MYSENSORS_DISCOVERY, DiscoveryInfo +from .device import MySensorsChildEntity from .helpers import on_unload DICT_HA_TO_MYS = { @@ -48,7 +49,7 @@ async def async_setup_entry( async def async_discover(discovery_info: DiscoveryInfo) -> None: """Discover and add a MySensors climate.""" - mysensors.setup_mysensors_platform( + setup_mysensors_platform( hass, Platform.CLIMATE, discovery_info, @@ -67,7 +68,7 @@ async def async_setup_entry( ) -class MySensorsHVAC(mysensors.device.MySensorsChildEntity, ClimateEntity): +class MySensorsHVAC(MySensorsChildEntity, ClimateEntity): """Representation of a MySensors HVAC.""" _attr_hvac_modes = OPERATION_LIST diff --git a/homeassistant/components/mysensors/cover.py b/homeassistant/components/mysensors/cover.py index acd5643965f..a5f4e7b1022 100644 --- a/homeassistant/components/mysensors/cover.py +++ b/homeassistant/components/mysensors/cover.py @@ -12,8 +12,9 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback -from .. import mysensors +from . import setup_mysensors_platform from .const import MYSENSORS_DISCOVERY, DiscoveryInfo +from .device import MySensorsChildEntity from .helpers import on_unload @@ -36,7 +37,7 @@ async def async_setup_entry( async def async_discover(discovery_info: DiscoveryInfo) -> None: """Discover and add a MySensors cover.""" - mysensors.setup_mysensors_platform( + setup_mysensors_platform( hass, Platform.COVER, discovery_info, @@ -55,7 +56,7 @@ async def async_setup_entry( ) -class MySensorsCover(mysensors.device.MySensorsChildEntity, CoverEntity): +class MySensorsCover(MySensorsChildEntity, CoverEntity): """Representation of the value of a MySensors Cover child node.""" def get_cover_state(self) -> CoverState: diff --git a/homeassistant/components/mysensors/light.py b/homeassistant/components/mysensors/light.py index c3691a40140..e10aee6187f 100644 --- a/homeassistant/components/mysensors/light.py +++ b/homeassistant/components/mysensors/light.py @@ -18,7 +18,7 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.util.color import rgb_hex_to_rgb_list -from .. import mysensors +from . import setup_mysensors_platform from .const import MYSENSORS_DISCOVERY, DiscoveryInfo, SensorType from .device import MySensorsChildEntity from .helpers import on_unload @@ -38,7 +38,7 @@ async def async_setup_entry( async def async_discover(discovery_info: DiscoveryInfo) -> None: """Discover and add a MySensors light.""" - mysensors.setup_mysensors_platform( + setup_mysensors_platform( hass, Platform.LIGHT, discovery_info, @@ -57,7 +57,7 @@ async def async_setup_entry( ) -class MySensorsLight(mysensors.device.MySensorsChildEntity, LightEntity): +class MySensorsLight(MySensorsChildEntity, LightEntity): """Representation of a MySensors Light child node.""" def __init__(self, *args: Any) -> None: diff --git a/homeassistant/components/mysensors/sensor.py b/homeassistant/components/mysensors/sensor.py index 82e6833f664..695382c491b 100644 --- a/homeassistant/components/mysensors/sensor.py +++ b/homeassistant/components/mysensors/sensor.py @@ -38,7 +38,7 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.util.unit_system import METRIC_SYSTEM -from .. import mysensors +from . import setup_mysensors_platform from .const import ( ATTR_GATEWAY_ID, ATTR_NODE_ID, @@ -49,6 +49,7 @@ from .const import ( DiscoveryInfo, NodeDiscoveryInfo, ) +from .device import MySensorNodeEntity, MySensorsChildEntity from .helpers import on_unload SENSORS: dict[str, SensorEntityDescription] = { @@ -215,7 +216,7 @@ async def async_setup_entry( async def async_discover(discovery_info: DiscoveryInfo) -> None: """Discover and add a MySensors sensor.""" - mysensors.setup_mysensors_platform( + setup_mysensors_platform( hass, Platform.SENSOR, discovery_info, @@ -252,7 +253,7 @@ async def async_setup_entry( ) -class MyBatterySensor(mysensors.device.MySensorNodeEntity, SensorEntity): +class MyBatterySensor(MySensorNodeEntity, SensorEntity): """Battery sensor of MySensors node.""" _attr_device_class = SensorDeviceClass.BATTERY @@ -277,7 +278,7 @@ class MyBatterySensor(mysensors.device.MySensorNodeEntity, SensorEntity): self.async_write_ha_state() -class MySensorsSensor(mysensors.device.MySensorsChildEntity, SensorEntity): +class MySensorsSensor(MySensorsChildEntity, SensorEntity): """Representation of a MySensors Sensor child node.""" _attr_force_update = True diff --git a/homeassistant/components/mysensors/text.py b/homeassistant/components/mysensors/text.py index 021324d7a67..8aed9df2eef 100644 --- a/homeassistant/components/mysensors/text.py +++ b/homeassistant/components/mysensors/text.py @@ -9,7 +9,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback -from .. import mysensors +from . import setup_mysensors_platform from .const import MYSENSORS_DISCOVERY, DiscoveryInfo from .device import MySensorsChildEntity from .helpers import on_unload @@ -25,7 +25,7 @@ async def async_setup_entry( @callback def async_discover(discovery_info: DiscoveryInfo) -> None: """Discover and add a MySensors text entity.""" - mysensors.setup_mysensors_platform( + setup_mysensors_platform( hass, Platform.TEXT, discovery_info,