1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Use metric units internally in Accuweather integration (#90444)

* Use metric units internally

* Remove unnecessary code

* Simplify sensor classes

* Remove AccuWeatherForecastSensor class

* Update wind speed value in test

* Return suggested_unit_of_measurement for wind entities

* Clean test

* Use _attr_suggested_unit_of_measurement

* Remove _get_suggested_unit()

* Remove unnecessarey code
This commit is contained in:
Maciej Bieniek
2023-03-30 13:11:33 +02:00
committed by GitHub
parent ead88cc3f8
commit 8d21e2b168
5 changed files with 82 additions and 149 deletions

View File

@@ -741,11 +741,21 @@ async def test_sensor_imperial_units(hass: HomeAssistant) -> None:
state = hass.states.get("sensor.home_cloud_ceiling")
assert state
assert state.state == "10500.0"
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
assert state.attributes.get(ATTR_ICON) == "mdi:weather-fog"
assert state.state == "10498.687664042"
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfLength.FEET
state = hass.states.get("sensor.home_wind")
assert state
assert state.state == "9.0"
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfSpeed.MILES_PER_HOUR
state = hass.states.get("sensor.home_realfeel_temperature")
assert state
assert state.state == "77.2"
assert (
state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfTemperature.FAHRENHEIT
)
async def test_state_update(hass: HomeAssistant) -> None:
"""Ensure the sensor state changes after updating the data."""