Files
project-work/home-assistant/tests/components/nexia/test_binary_sensor.py
2026-11-19 15:15:32 -05:00

37 lines
1.3 KiB
Python

"""The binary_sensor tests for the nexia platform."""
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.core import HomeAssistant
from .util import async_init_integration
async def test_create_binary_sensors(hass: HomeAssistant) -> None:
"""Test creation of binary sensors."""
await async_init_integration(hass)
state = hass.states.get("binary_sensor.master_suite_blower_active")
assert state.state == STATE_ON
expected_attributes = {
"attribution": "Data provided by Trane Technologies",
"friendly_name": "Master Suite Blower active",
}
# Only test for a subset of attributes in case
# HA changes the implementation and a new one appears
assert all(
state.attributes[key] == value for key, value in expected_attributes.items()
)
state = hass.states.get("binary_sensor.downstairs_east_wing_blower_active")
assert state.state == STATE_OFF
expected_attributes = {
"attribution": "Data provided by Trane Technologies",
"friendly_name": "Downstairs East Wing Blower active",
}
# Only test for a subset of attributes in case
# HA changes the implementation and a new one appears
assert all(
state.attributes[key] == value for key, value in expected_attributes.items()
)