hass-core/tests/components/wyoming/test_switch.py
Michael Hansen a9381d2590
Add Wyoming satellite (#104759)
* First draft of Wyoming satellite

* Set up homeassistant in tests

* Move satellite

* Add devices with binary sensor and select

* Add more events

* Add satellite enabled switch

* Fix mistake

* Only set up necessary platforms for satellites

* Lots of fixes

* Add tests

* Use config entry id as satellite id

* Initial satellite test

* Add satellite pipeline test

* More tests

* More satellite tests

* Only support single device per config entry

* Address comments

* Make a copy of platforms
2023-12-04 15:13:15 -05:00

32 lines
1,016 B
Python

"""Test Wyoming switch devices."""
from homeassistant.components.wyoming.devices import SatelliteDevice
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.core import HomeAssistant
async def test_satellite_enabled(
hass: HomeAssistant,
satellite_config_entry: ConfigEntry,
satellite_device: SatelliteDevice,
) -> None:
"""Test satellite enabled."""
satellite_enabled_id = satellite_device.get_satellite_enabled_entity_id(hass)
assert satellite_enabled_id
state = hass.states.get(satellite_enabled_id)
assert state is not None
assert state.state == STATE_ON
assert satellite_device.is_enabled
await hass.services.async_call(
"switch",
"turn_off",
{"entity_id": satellite_enabled_id},
blocking=True,
)
state = hass.states.get(satellite_enabled_id)
assert state is not None
assert state.state == STATE_OFF
assert not satellite_device.is_enabled