Make rfxtrx RfyDevices have sun automation switches (#38210)

* RfyDevices have sun automation

* We must accept sun automation commands for switch

* Add test for Rfy sun automation
This commit is contained in:
Joakim Plate authored and GitHub committed 2020-07-25 22:56:58 +02:00
1 parent 85c856cfa3
commit fd11748a1a
3 files changed
+21

No files matched your search

+18
View File
@@ -8,6 +8,9 @@ from homeassistant.setup import async_setup_component
from tests.common import mock_restore_cache
EVENT_RFY_ENABLE_SUN_AUTO = "081a00000301010113"
EVENT_RFY_DISABLE_SUN_AUTO = "081a00000301010114"
async def test_one_switch(hass, rfxtrx):
"""Test with 1 switch."""
@@ -133,3 +136,18 @@ async def test_discover_switch(hass, rfxtrx_automatic):
state = hass.states.get("switch.ac_118cdeb_2")
assert state
assert state.state == "on"
async def test_discover_rfy_sun_switch(hass, rfxtrx_automatic):
"""Test with discovery of switches."""
rfxtrx = rfxtrx_automatic
await rfxtrx.signal(EVENT_RFY_DISABLE_SUN_AUTO)
state = hass.states.get("switch.rfy_030101_1")
assert state
assert state.state == "off"
await rfxtrx.signal(EVENT_RFY_ENABLE_SUN_AUTO)
state = hass.states.get("switch.rfy_030101_1")
assert state
assert state.state == "on"