|
|
|
|
@@ -4,7 +4,11 @@ import json
|
|
|
|
|
from unittest.mock import PropertyMock, patch
|
|
|
|
|
|
|
|
|
|
from homeassistant.components.accuweather.const import ATTRIBUTION, DOMAIN
|
|
|
|
|
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
|
|
|
|
from homeassistant.components.sensor import (
|
|
|
|
|
ATTR_STATE_CLASS,
|
|
|
|
|
DOMAIN as SENSOR_DOMAIN,
|
|
|
|
|
STATE_CLASS_MEASUREMENT,
|
|
|
|
|
)
|
|
|
|
|
from homeassistant.const import (
|
|
|
|
|
ATTR_ATTRIBUTION,
|
|
|
|
|
ATTR_DEVICE_CLASS,
|
|
|
|
|
@@ -43,6 +47,7 @@ async def test_sensor_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:weather-fog"
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == LENGTH_METERS
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) == STATE_CLASS_MEASUREMENT
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_cloud_ceiling")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -55,6 +60,7 @@ async def test_sensor_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == LENGTH_MILLIMETERS
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:weather-rainy"
|
|
|
|
|
assert state.attributes.get("type") is None
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) == STATE_CLASS_MEASUREMENT
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_precipitation")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -66,6 +72,7 @@ async def test_sensor_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:gauge"
|
|
|
|
|
assert state.attributes.get(ATTR_DEVICE_CLASS) == "accuweather__pressure_tendency"
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_pressure_tendency")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -77,6 +84,7 @@ async def test_sensor_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == TEMP_CELSIUS
|
|
|
|
|
assert state.attributes.get(ATTR_DEVICE_CLASS) == DEVICE_CLASS_TEMPERATURE
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) == STATE_CLASS_MEASUREMENT
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_realfeel_temperature")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -88,6 +96,7 @@ async def test_sensor_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UV_INDEX
|
|
|
|
|
assert state.attributes.get("level") == "High"
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) == STATE_CLASS_MEASUREMENT
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_uv_index")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -105,6 +114,7 @@ async def test_sensor_with_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:weather-partly-cloudy"
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == TIME_HOURS
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_hours_of_sun_0d")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -116,6 +126,7 @@ async def test_sensor_with_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == TEMP_CELSIUS
|
|
|
|
|
assert state.attributes.get(ATTR_DEVICE_CLASS) == DEVICE_CLASS_TEMPERATURE
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_realfeel_temperature_max_0d")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -126,6 +137,7 @@ async def test_sensor_with_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == TEMP_CELSIUS
|
|
|
|
|
assert state.attributes.get(ATTR_DEVICE_CLASS) == DEVICE_CLASS_TEMPERATURE
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_realfeel_temperature_min_0d")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -137,6 +149,7 @@ async def test_sensor_with_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:weather-lightning"
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_thunderstorm_probability_day_0d")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -148,6 +161,7 @@ async def test_sensor_with_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:weather-lightning"
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_thunderstorm_probability_night_0d")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -160,6 +174,7 @@ async def test_sensor_with_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:weather-sunny"
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UV_INDEX
|
|
|
|
|
assert state.attributes.get("level") == "Moderate"
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_uv_index_0d")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -346,6 +361,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == TEMP_CELSIUS
|
|
|
|
|
assert state.attributes.get(ATTR_DEVICE_CLASS) == DEVICE_CLASS_TEMPERATURE
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) == STATE_CLASS_MEASUREMENT
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_apparent_temperature")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -357,6 +373,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:weather-cloudy"
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) == STATE_CLASS_MEASUREMENT
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_cloud_cover")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -368,6 +385,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == TEMP_CELSIUS
|
|
|
|
|
assert state.attributes.get(ATTR_DEVICE_CLASS) == DEVICE_CLASS_TEMPERATURE
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) == STATE_CLASS_MEASUREMENT
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_dew_point")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -379,6 +397,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == TEMP_CELSIUS
|
|
|
|
|
assert state.attributes.get(ATTR_DEVICE_CLASS) == DEVICE_CLASS_TEMPERATURE
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) == STATE_CLASS_MEASUREMENT
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_realfeel_temperature_shade")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -390,6 +409,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == TEMP_CELSIUS
|
|
|
|
|
assert state.attributes.get(ATTR_DEVICE_CLASS) == DEVICE_CLASS_TEMPERATURE
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) == STATE_CLASS_MEASUREMENT
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_wet_bulb_temperature")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -401,6 +421,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == TEMP_CELSIUS
|
|
|
|
|
assert state.attributes.get(ATTR_DEVICE_CLASS) == DEVICE_CLASS_TEMPERATURE
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) == STATE_CLASS_MEASUREMENT
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_wind_chill_temperature")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -412,6 +433,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == SPEED_KILOMETERS_PER_HOUR
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:weather-windy"
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) == STATE_CLASS_MEASUREMENT
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_wind_gust")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -423,6 +445,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == SPEED_KILOMETERS_PER_HOUR
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:weather-windy"
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) == STATE_CLASS_MEASUREMENT
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_wind")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -434,6 +457,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:weather-cloudy"
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_cloud_cover_day_0d")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -445,6 +469,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:weather-cloudy"
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_cloud_cover_night_0d")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -459,6 +484,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
|
|
|
|
)
|
|
|
|
|
assert state.attributes.get("level") == "Low"
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:grass"
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_grass_pollen_0d")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -485,6 +511,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get("level") == "Good"
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:vector-triangle"
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_ozone_0d")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -511,6 +538,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == TEMP_CELSIUS
|
|
|
|
|
assert state.attributes.get(ATTR_DEVICE_CLASS) == DEVICE_CLASS_TEMPERATURE
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_realfeel_temperature_shade_max_0d")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -537,6 +565,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
|
|
|
|
)
|
|
|
|
|
assert state.attributes.get("level") == "Low"
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:tree-outline"
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_tree_pollen_0d")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -561,6 +590,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == SPEED_KILOMETERS_PER_HOUR
|
|
|
|
|
assert state.attributes.get("direction") == "WNW"
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:weather-windy"
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_wind_night_0d")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -573,6 +603,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == SPEED_KILOMETERS_PER_HOUR
|
|
|
|
|
assert state.attributes.get("direction") == "S"
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:weather-windy"
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_wind_gust_day_0d")
|
|
|
|
|
assert entry
|
|
|
|
|
@@ -585,6 +616,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
|
|
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == SPEED_KILOMETERS_PER_HOUR
|
|
|
|
|
assert state.attributes.get("direction") == "WSW"
|
|
|
|
|
assert state.attributes.get(ATTR_ICON) == "mdi:weather-windy"
|
|
|
|
|
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
|
|
|
|
|
|
|
|
|
entry = registry.async_get("sensor.home_wind_gust_night_0d")
|
|
|
|
|
assert entry
|
|
|
|
|
|