Support rfxtrx smoke detectors, motion sensors as binary_sensors (#38000)

* Add binary sensor support to motion sensors and smoke detectors

* Add support for new sensor events as binary sensors

Adds a default device_class for motion sensors and smoke detector

* Use device type instead of event to set class

* Add some additional binary values
This commit is contained in:
Joakim Plate
2020-07-24 17:16:41 +02:00
committed by GitHub
parent 84df0efb5e
commit 632a36d819
7 changed files with 160 additions and 62 deletions

View File

@@ -148,13 +148,9 @@ async def test_several_sensors(hass, rfxtrx):
assert state.attributes.get("unit_of_measurement") == UNIT_PERCENTAGE
async def test_discover_sensor(hass, rfxtrx):
async def test_discover_sensor(hass, rfxtrx_automatic):
"""Test with discovery of sensor."""
assert await async_setup_component(
hass, "rfxtrx", {"rfxtrx": {"device": "abcd", "automatic_add": True}},
)
await hass.async_block_till_done()
await hass.async_start()
rfxtrx = rfxtrx_automatic
# 1
await rfxtrx.signal("0a520801070100b81b0279")