Simplify imports in mysensors (#125746)
This commit is contained in:
parent
c33ba541b0
commit
09dd647741
6 changed files with 22 additions and 18 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue