mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Rename environment_canada entities (#136817)
This commit is contained in:
parent
7b1b229718
commit
417003ad35
@ -30,7 +30,7 @@ async def async_setup_entry(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Add a weather entity from a config_entry."""
|
"""Add a weather entity from a config_entry."""
|
||||||
coordinator = config_entry.runtime_data.radar_coordinator
|
coordinator = config_entry.runtime_data.radar_coordinator
|
||||||
async_add_entities([ECCamera(coordinator)])
|
async_add_entities([ECCameraEntity(coordinator)])
|
||||||
|
|
||||||
platform = async_get_current_platform()
|
platform = async_get_current_platform()
|
||||||
platform.async_register_entity_service(
|
platform.async_register_entity_service(
|
||||||
@ -40,7 +40,7 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ECCamera(CoordinatorEntity, Camera):
|
class ECCameraEntity(CoordinatorEntity, Camera):
|
||||||
"""Implementation of an Environment Canada radar camera."""
|
"""Implementation of an Environment Canada radar camera."""
|
||||||
|
|
||||||
_attr_has_entity_name = True
|
_attr_has_entity_name = True
|
||||||
|
@ -256,16 +256,20 @@ async def async_setup_entry(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Add a weather entity from a config_entry."""
|
"""Add a weather entity from a config_entry."""
|
||||||
weather_coordinator = config_entry.runtime_data.weather_coordinator
|
weather_coordinator = config_entry.runtime_data.weather_coordinator
|
||||||
sensors: list[ECBaseSensor] = [
|
sensors: list[ECBaseSensorEntity] = [
|
||||||
ECSensor(weather_coordinator, desc) for desc in SENSOR_TYPES
|
ECSensorEntity(weather_coordinator, desc) for desc in SENSOR_TYPES
|
||||||
]
|
]
|
||||||
sensors.extend([ECAlertSensor(weather_coordinator, desc) for desc in ALERT_TYPES])
|
sensors.extend(
|
||||||
|
[ECAlertSensorEntity(weather_coordinator, desc) for desc in ALERT_TYPES]
|
||||||
|
)
|
||||||
|
|
||||||
sensors.append(ECSensor(config_entry.runtime_data.aqhi_coordinator, AQHI_SENSOR))
|
sensors.append(
|
||||||
|
ECSensorEntity(config_entry.runtime_data.aqhi_coordinator, AQHI_SENSOR)
|
||||||
|
)
|
||||||
async_add_entities(sensors)
|
async_add_entities(sensors)
|
||||||
|
|
||||||
|
|
||||||
class ECBaseSensor(CoordinatorEntity, SensorEntity):
|
class ECBaseSensorEntity(CoordinatorEntity, SensorEntity):
|
||||||
"""Environment Canada sensor base."""
|
"""Environment Canada sensor base."""
|
||||||
|
|
||||||
entity_description: ECSensorEntityDescription
|
entity_description: ECSensorEntityDescription
|
||||||
@ -289,7 +293,7 @@ class ECBaseSensor(CoordinatorEntity, SensorEntity):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
class ECSensor(ECBaseSensor):
|
class ECSensorEntity(ECBaseSensorEntity):
|
||||||
"""Environment Canada sensor for conditions."""
|
"""Environment Canada sensor for conditions."""
|
||||||
|
|
||||||
def __init__(self, coordinator, description):
|
def __init__(self, coordinator, description):
|
||||||
@ -301,7 +305,7 @@ class ECSensor(ECBaseSensor):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ECAlertSensor(ECBaseSensor):
|
class ECAlertSensorEntity(ECBaseSensorEntity):
|
||||||
"""Environment Canada sensor for alerts."""
|
"""Environment Canada sensor for alerts."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -75,7 +75,7 @@ async def async_setup_entry(
|
|||||||
):
|
):
|
||||||
entity_registry.async_remove(hourly_entity_id)
|
entity_registry.async_remove(hourly_entity_id)
|
||||||
|
|
||||||
async_add_entities([ECWeather(config_entry.runtime_data.weather_coordinator)])
|
async_add_entities([ECWeatherEntity(config_entry.runtime_data.weather_coordinator)])
|
||||||
|
|
||||||
|
|
||||||
def _calculate_unique_id(config_entry_unique_id: str | None, hourly: bool) -> str:
|
def _calculate_unique_id(config_entry_unique_id: str | None, hourly: bool) -> str:
|
||||||
@ -83,7 +83,7 @@ def _calculate_unique_id(config_entry_unique_id: str | None, hourly: bool) -> st
|
|||||||
return f"{config_entry_unique_id}{'-hourly' if hourly else '-daily'}"
|
return f"{config_entry_unique_id}{'-hourly' if hourly else '-daily'}"
|
||||||
|
|
||||||
|
|
||||||
class ECWeather(SingleCoordinatorWeatherEntity):
|
class ECWeatherEntity(SingleCoordinatorWeatherEntity):
|
||||||
"""Representation of a weather condition."""
|
"""Representation of a weather condition."""
|
||||||
|
|
||||||
_attr_has_entity_name = True
|
_attr_has_entity_name = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user