Use enums for ozw tests (#62547)
parent
5580e87253
commit
3663e0af41
|
@ -1,7 +1,7 @@
|
|||
"""Test Z-Wave Sensors."""
|
||||
from homeassistant.components.binary_sensor import (
|
||||
DEVICE_CLASS_MOTION,
|
||||
DOMAIN as BINARY_SENSOR_DOMAIN,
|
||||
BinarySensorDeviceClass,
|
||||
)
|
||||
from homeassistant.components.ozw.const import DOMAIN
|
||||
from homeassistant.const import ATTR_DEVICE_CLASS
|
||||
|
@ -35,7 +35,7 @@ async def test_binary_sensor(hass, generic_data, binary_sensor_msg):
|
|||
state = hass.states.get("binary_sensor.trisensor_home_security_motion_detected")
|
||||
assert state
|
||||
assert state.state == "off"
|
||||
assert state.attributes[ATTR_DEVICE_CLASS] == DEVICE_CLASS_MOTION
|
||||
assert state.attributes[ATTR_DEVICE_CLASS] == BinarySensorDeviceClass.MOTION
|
||||
|
||||
# Test incoming state change
|
||||
receive_msg(binary_sensor_msg)
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
"""Test Z-Wave Sensors."""
|
||||
from homeassistant.components.ozw.const import DOMAIN
|
||||
from homeassistant.components.sensor import (
|
||||
DEVICE_CLASS_HUMIDITY,
|
||||
DEVICE_CLASS_POWER,
|
||||
DEVICE_CLASS_PRESSURE,
|
||||
DOMAIN as SENSOR_DOMAIN,
|
||||
)
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN, SensorDeviceClass
|
||||
from homeassistant.const import ATTR_DEVICE_CLASS
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
|
@ -24,15 +19,15 @@ async def test_sensor(hass, generic_data):
|
|||
|
||||
# Test device classes
|
||||
state = hass.states.get("sensor.trisensor_relative_humidity")
|
||||
assert state.attributes[ATTR_DEVICE_CLASS] == DEVICE_CLASS_HUMIDITY
|
||||
assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.HUMIDITY
|
||||
state = hass.states.get("sensor.trisensor_pressure")
|
||||
assert state.attributes[ATTR_DEVICE_CLASS] == DEVICE_CLASS_PRESSURE
|
||||
assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.PRESSURE
|
||||
state = hass.states.get("sensor.trisensor_fake_power")
|
||||
assert state.attributes[ATTR_DEVICE_CLASS] == DEVICE_CLASS_POWER
|
||||
assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.POWER
|
||||
state = hass.states.get("sensor.trisensor_fake_energy")
|
||||
assert state.attributes[ATTR_DEVICE_CLASS] == DEVICE_CLASS_POWER
|
||||
assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.POWER
|
||||
state = hass.states.get("sensor.trisensor_fake_electric")
|
||||
assert state.attributes[ATTR_DEVICE_CLASS] == DEVICE_CLASS_POWER
|
||||
assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.POWER
|
||||
|
||||
# Test ZWaveListSensor disabled by default
|
||||
registry = er.async_get(hass)
|
||||
|
|
Loading…
Reference in New Issue