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:
|
||||
"""Add a weather entity from a config_entry."""
|
||||
coordinator = config_entry.runtime_data.radar_coordinator
|
||||
async_add_entities([ECCamera(coordinator)])
|
||||
async_add_entities([ECCameraEntity(coordinator)])
|
||||
|
||||
platform = async_get_current_platform()
|
||||
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."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
@ -256,16 +256,20 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Add a weather entity from a config_entry."""
|
||||
weather_coordinator = config_entry.runtime_data.weather_coordinator
|
||||
sensors: list[ECBaseSensor] = [
|
||||
ECSensor(weather_coordinator, desc) for desc in SENSOR_TYPES
|
||||
sensors: list[ECBaseSensorEntity] = [
|
||||
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)
|
||||
|
||||
|
||||
class ECBaseSensor(CoordinatorEntity, SensorEntity):
|
||||
class ECBaseSensorEntity(CoordinatorEntity, SensorEntity):
|
||||
"""Environment Canada sensor base."""
|
||||
|
||||
entity_description: ECSensorEntityDescription
|
||||
@ -289,7 +293,7 @@ class ECBaseSensor(CoordinatorEntity, SensorEntity):
|
||||
return value
|
||||
|
||||
|
||||
class ECSensor(ECBaseSensor):
|
||||
class ECSensorEntity(ECBaseSensorEntity):
|
||||
"""Environment Canada sensor for conditions."""
|
||||
|
||||
def __init__(self, coordinator, description):
|
||||
@ -301,7 +305,7 @@ class ECSensor(ECBaseSensor):
|
||||
}
|
||||
|
||||
|
||||
class ECAlertSensor(ECBaseSensor):
|
||||
class ECAlertSensorEntity(ECBaseSensorEntity):
|
||||
"""Environment Canada sensor for alerts."""
|
||||
|
||||
@property
|
||||
|
@ -75,7 +75,7 @@ async def async_setup_entry(
|
||||
):
|
||||
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:
|
||||
@ -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'}"
|
||||
|
||||
|
||||
class ECWeather(SingleCoordinatorWeatherEntity):
|
||||
class ECWeatherEntity(SingleCoordinatorWeatherEntity):
|
||||
"""Representation of a weather condition."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
Loading…
x
Reference in New Issue
Block a user