mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Migrate Met.no to new entity naming style (#74908)
This commit is contained in:
parent
c81d63e070
commit
d6ceebbb68
@ -71,6 +71,7 @@ def format_condition(condition: str) -> str:
|
||||
class MetWeather(CoordinatorEntity[MetDataUpdateCoordinator], WeatherEntity):
|
||||
"""Implementation of a Met.no weather condition."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
_attr_native_temperature_unit = TEMP_CELSIUS
|
||||
_attr_native_precipitation_unit = LENGTH_MILLIMETERS
|
||||
_attr_native_pressure_unit = PRESSURE_HPA
|
||||
@ -111,7 +112,7 @@ class MetWeather(CoordinatorEntity[MetDataUpdateCoordinator], WeatherEntity):
|
||||
name = self._config.get(CONF_NAME)
|
||||
name_appendix = ""
|
||||
if self._hourly:
|
||||
name_appendix = " Hourly"
|
||||
name_appendix = " hourly"
|
||||
|
||||
if name is not None:
|
||||
return f"{name}{name_appendix}"
|
||||
|
@ -16,10 +16,10 @@ async def test_tracking_home(hass, mock_weather):
|
||||
# Test the hourly sensor is disabled by default
|
||||
registry = er.async_get(hass)
|
||||
|
||||
state = hass.states.get("weather.test_home_hourly")
|
||||
state = hass.states.get("weather.forecast_test_home_hourly")
|
||||
assert state is None
|
||||
|
||||
entry = registry.async_get("weather.test_home_hourly")
|
||||
entry = registry.async_get("weather.forecast_test_home_hourly")
|
||||
assert entry
|
||||
assert entry.disabled
|
||||
assert entry.disabled_by is er.RegistryEntryDisabler.INTEGRATION
|
||||
@ -50,7 +50,7 @@ async def test_not_tracking_home(hass, mock_weather):
|
||||
WEATHER_DOMAIN,
|
||||
DOMAIN,
|
||||
"10-20-hourly",
|
||||
suggested_object_id="somewhere_hourly",
|
||||
suggested_object_id="forecast_somewhere_hourly",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user