hass-core/tests/components/sma/test_sensor.py
René Klomp 926c2489f0
Implement SMA config flow (#48003)
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Johann Kellerman <kellerza@gmail.com>
2021-04-13 06:21:01 -10:00

21 lines
617 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, init_integration
async def test_sensors(hass):
"""Test states of the sensors."""
await init_integration(hass)
state = hass.states.get("sensor.current_consumption")
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