Add rfxtrx ability to send a raw command to device (#37793)

* Add the ability to send a raw command to device

* Add a test for new service

* Use async test

* Sort includes
This commit is contained in:
Joakim Plate authored and GitHub committed 2020-07-13 16:54:52 +02:00
1 parent dbcd5f4c2c
commit ccbc3b5e39
4 files changed
+50 -1

No files matched your search

+18
View File
@@ -6,6 +6,8 @@ from homeassistant.setup import async_setup_component
from . import _signal_event
from tests.async_mock import call
async def test_valid_config(hass):
"""Test configuration."""
@@ -104,3 +106,19 @@ async def test_fire_event(hass):
"values": {"Sound": 9, "Battery numeric": 0, "Rssi numeric": 7},
},
]
async def test_send(hass, rfxtrx):
"""Test configuration."""
assert await async_setup_component(
hass, "rfxtrx", {"rfxtrx": {"device": "/dev/null"}}
)
await hass.async_block_till_done()
await hass.services.async_call(
"rfxtrx", "send", {"event": "0a520802060101ff0f0269"}, blocking=True
)
assert rfxtrx.transport.send.mock_calls == [
call(bytearray(b"\x0a\x52\x08\x02\x06\x01\x01\xff\x0f\x02\x69"))
]