* Use new get_sensors method * Update pysma requirement * Update primary codeowner * Update device_info handling * Fix LEGACY_MAP * Updated tests * Fix pysma references * Fix pylint raise-missing-from * Better import of Sensors * Remove software version related changes * Revert codeowners change
19 lines
574 B
Python
19 lines
574 B
Python
"""Test the sma sensor platform."""
|
|
from homeassistant.const import (
|
|
ATTR_UNIT_OF_MEASUREMENT,
|
|
ENERGY_KILO_WATT_HOUR,
|
|
POWER_WATT,
|
|
)
|
|
|
|
from . import MOCK_CUSTOM_SENSOR
|
|
|
|
|
|
async def test_sensors(hass, init_integration):
|
|
"""Test states of the sensors."""
|
|
state = hass.states.get("sensor.grid_power")
|
|
assert state
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == POWER_WATT
|
|
|
|
state = hass.states.get(f"sensor.{MOCK_CUSTOM_SENSOR['name']}")
|
|
assert state
|
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == ENERGY_KILO_WATT_HOUR
|