mirror of
https://github.com/home-assistant/core.git
synced 2026-09-27 01:46:11 -04:00
Add weatherkit sensor platform (#101150)
* Add weatherkit sensor platform and tests * Make unique ID assignment more explicit * Fix missing argument * Use const for top-level API response keys * Address code review feedback
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
"conditionCode": "PartlyCloudy",
|
||||
"daylight": true,
|
||||
"humidity": 0.91,
|
||||
"precipitationIntensity": 0.0,
|
||||
"precipitationIntensity": 0.7,
|
||||
"pressure": 1009.8,
|
||||
"pressureTrend": "rising",
|
||||
"temperature": 22.9,
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
"""Sensor entity tests for the WeatherKit integration."""
|
||||
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import init_integration
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("entity_name", "expected_value"),
|
||||
[
|
||||
("sensor.home_precipitation_intensity", 0.7),
|
||||
("sensor.home_pressure_trend", "rising"),
|
||||
],
|
||||
)
|
||||
async def test_sensor_values(
|
||||
hass: HomeAssistant, entity_name: str, expected_value: Any
|
||||
) -> None:
|
||||
"""Test that various sensor values match what we expect."""
|
||||
await init_integration(hass)
|
||||
|
||||
state = hass.states.get(entity_name)
|
||||
assert state
|
||||
assert state.state == str(expected_value)
|
||||
Reference in New Issue
Block a user