2016-03-09 09:25:50 +00:00
|
|
|
"""The tests for the Rfxtrx sensor platform."""
|
2016-02-29 12:06:35 +00:00
|
|
|
import unittest
|
|
|
|
|
2016-09-28 07:05:38 +00:00
|
|
|
import pytest
|
|
|
|
|
2016-02-29 12:06:35 +00:00
|
|
|
from homeassistant.components import rfxtrx as rfxtrx_core
|
2020-02-28 19:46:48 +00:00
|
|
|
from homeassistant.const import TEMP_CELSIUS, UNIT_PERCENTAGE
|
2019-10-14 15:38:34 +00:00
|
|
|
from homeassistant.setup import setup_component
|
2016-02-29 12:06:35 +00:00
|
|
|
|
2017-03-01 04:33:19 +00:00
|
|
|
from tests.common import get_test_home_assistant, mock_component
|
2016-02-29 12:06:35 +00:00
|
|
|
|
|
|
|
|
2016-10-01 20:57:10 +00:00
|
|
|
@pytest.mark.skipif("os.environ.get('RFXTRX') != 'RUN'")
|
2016-02-29 12:06:35 +00:00
|
|
|
class TestSensorRfxtrx(unittest.TestCase):
|
2016-03-09 09:25:50 +00:00
|
|
|
"""Test the Rfxtrx sensor platform."""
|
2016-02-29 12:06:35 +00:00
|
|
|
|
|
|
|
def setUp(self):
|
2018-08-19 20:29:08 +00:00
|
|
|
"""Set up things to be run when tests are started."""
|
2016-10-31 15:47:29 +00:00
|
|
|
self.hass = get_test_home_assistant()
|
2019-07-31 19:25:30 +00:00
|
|
|
mock_component(self.hass, "rfxtrx")
|
2020-06-08 19:26:40 +00:00
|
|
|
self.addCleanup(self.tear_down_cleanup)
|
2016-02-29 12:06:35 +00:00
|
|
|
|
2020-06-08 19:26:40 +00:00
|
|
|
def tear_down_cleanup(self):
|
2016-03-09 09:25:50 +00:00
|
|
|
"""Stop everything that was started."""
|
2016-02-29 12:06:35 +00:00
|
|
|
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS = []
|
|
|
|
rfxtrx_core.RFX_DEVICES = {}
|
2016-10-01 20:57:10 +00:00
|
|
|
if rfxtrx_core.RFXOBJECT:
|
|
|
|
rfxtrx_core.RFXOBJECT.close_connection()
|
2016-02-29 12:06:35 +00:00
|
|
|
self.hass.stop()
|
|
|
|
|
|
|
|
def test_default_config(self):
|
2016-03-09 09:25:50 +00:00
|
|
|
"""Test with 0 sensor."""
|
2019-07-31 19:25:30 +00:00
|
|
|
assert setup_component(
|
|
|
|
self.hass, "sensor", {"sensor": {"platform": "rfxtrx", "devices": {}}}
|
|
|
|
)
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 0 == len(rfxtrx_core.RFX_DEVICES)
|
2016-02-29 12:06:35 +00:00
|
|
|
|
2016-04-23 17:57:36 +00:00
|
|
|
def test_old_config_sensor(self):
|
2016-03-09 09:25:50 +00:00
|
|
|
"""Test with 1 sensor."""
|
2019-07-31 19:25:30 +00:00
|
|
|
assert setup_component(
|
|
|
|
self.hass,
|
|
|
|
"sensor",
|
|
|
|
{
|
|
|
|
"sensor": {
|
|
|
|
"platform": "rfxtrx",
|
|
|
|
"devices": {
|
|
|
|
"sensor_0502": {
|
|
|
|
"name": "Test",
|
|
|
|
"packetid": "0a52080705020095220269",
|
|
|
|
"data_type": "Temperature",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2016-04-10 23:05:32 +00:00
|
|
|
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 1 == len(rfxtrx_core.RFX_DEVICES)
|
2019-07-31 19:25:30 +00:00
|
|
|
entity = rfxtrx_core.RFX_DEVICES["sensor_0502"]["Temperature"]
|
|
|
|
assert "Test" == entity.name
|
2018-10-24 10:10:05 +00:00
|
|
|
assert TEMP_CELSIUS == entity.unit_of_measurement
|
|
|
|
assert entity.state is None
|
2016-04-23 17:57:36 +00:00
|
|
|
|
|
|
|
def test_one_sensor(self):
|
|
|
|
"""Test with 1 sensor."""
|
2019-07-31 19:25:30 +00:00
|
|
|
assert setup_component(
|
|
|
|
self.hass,
|
|
|
|
"sensor",
|
|
|
|
{
|
|
|
|
"sensor": {
|
|
|
|
"platform": "rfxtrx",
|
|
|
|
"devices": {
|
|
|
|
"0a52080705020095220269": {
|
|
|
|
"name": "Test",
|
|
|
|
"data_type": "Temperature",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2016-04-23 17:57:36 +00:00
|
|
|
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 1 == len(rfxtrx_core.RFX_DEVICES)
|
2019-07-31 19:25:30 +00:00
|
|
|
entity = rfxtrx_core.RFX_DEVICES["sensor_0502"]["Temperature"]
|
|
|
|
assert "Test" == entity.name
|
2018-10-24 10:10:05 +00:00
|
|
|
assert TEMP_CELSIUS == entity.unit_of_measurement
|
|
|
|
assert entity.state is None
|
2016-02-29 12:06:35 +00:00
|
|
|
|
2016-04-24 09:48:01 +00:00
|
|
|
def test_one_sensor_no_datatype(self):
|
|
|
|
"""Test with 1 sensor."""
|
2019-07-31 19:25:30 +00:00
|
|
|
assert setup_component(
|
|
|
|
self.hass,
|
|
|
|
"sensor",
|
|
|
|
{
|
|
|
|
"sensor": {
|
|
|
|
"platform": "rfxtrx",
|
|
|
|
"devices": {"0a52080705020095220269": {"name": "Test"}},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2016-04-24 09:48:01 +00:00
|
|
|
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 1 == len(rfxtrx_core.RFX_DEVICES)
|
2019-07-31 19:25:30 +00:00
|
|
|
entity = rfxtrx_core.RFX_DEVICES["sensor_0502"]["Temperature"]
|
|
|
|
assert "Test" == entity.name
|
2018-10-24 10:10:05 +00:00
|
|
|
assert TEMP_CELSIUS == entity.unit_of_measurement
|
|
|
|
assert entity.state is None
|
2016-04-24 09:48:01 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
entity_id = rfxtrx_core.RFX_DEVICES["sensor_0502"]["Temperature"].entity_id
|
2016-07-17 08:30:56 +00:00
|
|
|
entity = self.hass.states.get(entity_id)
|
2019-07-31 19:25:30 +00:00
|
|
|
assert "Test" == entity.name
|
|
|
|
assert "unknown" == entity.state
|
2016-07-17 08:24:08 +00:00
|
|
|
|
2016-02-29 12:06:35 +00:00
|
|
|
def test_several_sensors(self):
|
2016-03-09 09:25:50 +00:00
|
|
|
"""Test with 3 sensors."""
|
2019-07-31 19:25:30 +00:00
|
|
|
assert setup_component(
|
|
|
|
self.hass,
|
|
|
|
"sensor",
|
|
|
|
{
|
|
|
|
"sensor": {
|
|
|
|
"platform": "rfxtrx",
|
|
|
|
"devices": {
|
|
|
|
"0a52080705020095220269": {
|
|
|
|
"name": "Test",
|
|
|
|
"data_type": "Temperature",
|
|
|
|
},
|
|
|
|
"0a520802060100ff0e0269": {
|
|
|
|
"name": "Bath",
|
|
|
|
"data_type": ["Temperature", "Humidity"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2016-04-10 23:05:32 +00:00
|
|
|
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 2 == len(rfxtrx_core.RFX_DEVICES)
|
2016-02-29 12:06:35 +00:00
|
|
|
device_num = 0
|
2016-04-10 23:05:32 +00:00
|
|
|
for id in rfxtrx_core.RFX_DEVICES:
|
2019-07-31 19:25:30 +00:00
|
|
|
if id == "sensor_0601":
|
2016-02-29 12:06:35 +00:00
|
|
|
device_num = device_num + 1
|
2018-10-24 10:10:05 +00:00
|
|
|
assert len(rfxtrx_core.RFX_DEVICES[id]) == 2
|
2019-07-31 19:25:30 +00:00
|
|
|
_entity_temp = rfxtrx_core.RFX_DEVICES[id]["Temperature"]
|
|
|
|
_entity_hum = rfxtrx_core.RFX_DEVICES[id]["Humidity"]
|
2020-02-28 19:46:48 +00:00
|
|
|
assert UNIT_PERCENTAGE == _entity_hum.unit_of_measurement
|
2019-07-31 19:25:30 +00:00
|
|
|
assert "Bath" == _entity_hum.__str__()
|
2018-10-24 10:10:05 +00:00
|
|
|
assert _entity_hum.state is None
|
2019-07-31 19:25:30 +00:00
|
|
|
assert TEMP_CELSIUS == _entity_temp.unit_of_measurement
|
|
|
|
assert "Bath" == _entity_temp.__str__()
|
|
|
|
elif id == "sensor_0502":
|
2016-02-29 12:06:35 +00:00
|
|
|
device_num = device_num + 1
|
2019-07-31 19:25:30 +00:00
|
|
|
entity = rfxtrx_core.RFX_DEVICES[id]["Temperature"]
|
2018-10-24 10:10:05 +00:00
|
|
|
assert entity.state is None
|
|
|
|
assert TEMP_CELSIUS == entity.unit_of_measurement
|
2019-07-31 19:25:30 +00:00
|
|
|
assert "Test" == entity.__str__()
|
2016-02-29 12:06:35 +00:00
|
|
|
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 2 == device_num
|
2016-02-29 12:06:35 +00:00
|
|
|
|
|
|
|
def test_discover_sensor(self):
|
2016-03-09 09:25:50 +00:00
|
|
|
"""Test with discovery of sensor."""
|
2019-07-31 19:25:30 +00:00
|
|
|
assert setup_component(
|
|
|
|
self.hass,
|
|
|
|
"sensor",
|
|
|
|
{"sensor": {"platform": "rfxtrx", "automatic_add": True, "devices": {}}},
|
|
|
|
)
|
|
|
|
|
|
|
|
event = rfxtrx_core.get_rfx_object("0a520801070100b81b0279")
|
|
|
|
event.data = bytearray(b"\nR\x08\x01\x07\x01\x00\xb8\x1b\x02y")
|
2016-02-29 12:06:35 +00:00
|
|
|
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
entity = rfxtrx_core.RFX_DEVICES["sensor_0701"]["Temperature"]
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 1 == len(rfxtrx_core.RFX_DEVICES)
|
2019-07-31 19:25:30 +00:00
|
|
|
assert {
|
|
|
|
"Humidity status": "normal",
|
|
|
|
"Temperature": 18.4,
|
|
|
|
"Rssi numeric": 7,
|
|
|
|
"Humidity": 27,
|
|
|
|
"Battery numeric": 9,
|
|
|
|
"Humidity status numeric": 2,
|
|
|
|
} == entity.device_state_attributes
|
|
|
|
assert "0a520801070100b81b0279" == entity.__str__()
|
2016-02-29 12:06:35 +00:00
|
|
|
|
|
|
|
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 1 == len(rfxtrx_core.RFX_DEVICES)
|
2016-02-29 12:06:35 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
event = rfxtrx_core.get_rfx_object("0a52080405020095240279")
|
|
|
|
event.data = bytearray(b"\nR\x08\x04\x05\x02\x00\x95$\x02y")
|
2016-02-29 12:06:35 +00:00
|
|
|
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
|
2019-07-31 19:25:30 +00:00
|
|
|
entity = rfxtrx_core.RFX_DEVICES["sensor_0502"]["Temperature"]
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 2 == len(rfxtrx_core.RFX_DEVICES)
|
2019-07-31 19:25:30 +00:00
|
|
|
assert {
|
|
|
|
"Humidity status": "normal",
|
|
|
|
"Temperature": 14.9,
|
|
|
|
"Rssi numeric": 7,
|
|
|
|
"Humidity": 36,
|
|
|
|
"Battery numeric": 9,
|
|
|
|
"Humidity status numeric": 2,
|
|
|
|
} == entity.device_state_attributes
|
|
|
|
assert "0a52080405020095240279" == entity.__str__()
|
|
|
|
|
|
|
|
event = rfxtrx_core.get_rfx_object("0a52085e070100b31b0279")
|
|
|
|
event.data = bytearray(b"\nR\x08^\x07\x01\x00\xb3\x1b\x02y")
|
2016-02-29 12:06:35 +00:00
|
|
|
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
|
2019-07-31 19:25:30 +00:00
|
|
|
entity = rfxtrx_core.RFX_DEVICES["sensor_0701"]["Temperature"]
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 2 == len(rfxtrx_core.RFX_DEVICES)
|
2019-07-31 19:25:30 +00:00
|
|
|
assert {
|
|
|
|
"Humidity status": "normal",
|
|
|
|
"Temperature": 17.9,
|
|
|
|
"Rssi numeric": 7,
|
|
|
|
"Humidity": 27,
|
|
|
|
"Battery numeric": 9,
|
|
|
|
"Humidity status numeric": 2,
|
|
|
|
} == entity.device_state_attributes
|
|
|
|
assert "0a520801070100b81b0279" == entity.__str__()
|
2016-02-29 12:06:35 +00:00
|
|
|
|
|
|
|
# trying to add a switch
|
2019-07-31 19:25:30 +00:00
|
|
|
event = rfxtrx_core.get_rfx_object("0b1100cd0213c7f210010f70")
|
2016-02-29 12:06:35 +00:00
|
|
|
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 2 == len(rfxtrx_core.RFX_DEVICES)
|
2016-02-29 12:06:35 +00:00
|
|
|
|
|
|
|
def test_discover_sensor_noautoadd(self):
|
2016-03-09 09:25:50 +00:00
|
|
|
"""Test with discover of sensor when auto add is False."""
|
2019-07-31 19:25:30 +00:00
|
|
|
assert setup_component(
|
|
|
|
self.hass,
|
|
|
|
"sensor",
|
|
|
|
{"sensor": {"platform": "rfxtrx", "automatic_add": False, "devices": {}}},
|
|
|
|
)
|
2016-02-29 12:06:35 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
event = rfxtrx_core.get_rfx_object("0a520801070100b81b0279")
|
|
|
|
event.data = bytearray(b"\nR\x08\x01\x07\x01\x00\xb8\x1b\x02y")
|
2016-02-29 12:06:35 +00:00
|
|
|
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 0 == len(rfxtrx_core.RFX_DEVICES)
|
2016-02-29 12:06:35 +00:00
|
|
|
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 0 == len(rfxtrx_core.RFX_DEVICES)
|
2016-02-29 12:06:35 +00:00
|
|
|
|
|
|
|
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 0 == len(rfxtrx_core.RFX_DEVICES)
|
2016-02-29 12:06:35 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
event = rfxtrx_core.get_rfx_object("0a52080405020095240279")
|
|
|
|
event.data = bytearray(b"\nR\x08\x04\x05\x02\x00\x95$\x02y")
|
2016-02-29 12:06:35 +00:00
|
|
|
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 0 == len(rfxtrx_core.RFX_DEVICES)
|
2016-02-29 12:06:35 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
event = rfxtrx_core.get_rfx_object("0a52085e070100b31b0279")
|
|
|
|
event.data = bytearray(b"\nR\x08^\x07\x01\x00\xb3\x1b\x02y")
|
2016-02-29 12:06:35 +00:00
|
|
|
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 0 == len(rfxtrx_core.RFX_DEVICES)
|
2016-03-30 08:52:29 +00:00
|
|
|
|
|
|
|
def test_update_of_sensors(self):
|
|
|
|
"""Test with 3 sensors."""
|
2019-07-31 19:25:30 +00:00
|
|
|
assert setup_component(
|
|
|
|
self.hass,
|
|
|
|
"sensor",
|
|
|
|
{
|
|
|
|
"sensor": {
|
|
|
|
"platform": "rfxtrx",
|
|
|
|
"devices": {
|
|
|
|
"0a52080705020095220269": {
|
|
|
|
"name": "Test",
|
|
|
|
"data_type": "Temperature",
|
|
|
|
},
|
|
|
|
"0a520802060100ff0e0269": {
|
|
|
|
"name": "Bath",
|
|
|
|
"data_type": ["Temperature", "Humidity"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2016-03-30 08:52:29 +00:00
|
|
|
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 2 == len(rfxtrx_core.RFX_DEVICES)
|
2016-03-30 08:52:29 +00:00
|
|
|
device_num = 0
|
2016-04-10 23:05:32 +00:00
|
|
|
for id in rfxtrx_core.RFX_DEVICES:
|
2019-07-31 19:25:30 +00:00
|
|
|
if id == "sensor_0601":
|
2016-03-30 08:52:29 +00:00
|
|
|
device_num = device_num + 1
|
2018-10-24 10:10:05 +00:00
|
|
|
assert len(rfxtrx_core.RFX_DEVICES[id]) == 2
|
2019-07-31 19:25:30 +00:00
|
|
|
_entity_temp = rfxtrx_core.RFX_DEVICES[id]["Temperature"]
|
|
|
|
_entity_hum = rfxtrx_core.RFX_DEVICES[id]["Humidity"]
|
2020-02-28 19:46:48 +00:00
|
|
|
assert UNIT_PERCENTAGE == _entity_hum.unit_of_measurement
|
2019-07-31 19:25:30 +00:00
|
|
|
assert "Bath" == _entity_hum.__str__()
|
2018-10-24 10:10:05 +00:00
|
|
|
assert _entity_temp.state is None
|
2019-07-31 19:25:30 +00:00
|
|
|
assert TEMP_CELSIUS == _entity_temp.unit_of_measurement
|
|
|
|
assert "Bath" == _entity_temp.__str__()
|
|
|
|
elif id == "sensor_0502":
|
2016-03-30 08:52:29 +00:00
|
|
|
device_num = device_num + 1
|
2019-07-31 19:25:30 +00:00
|
|
|
entity = rfxtrx_core.RFX_DEVICES[id]["Temperature"]
|
2018-10-24 10:10:05 +00:00
|
|
|
assert entity.state is None
|
|
|
|
assert TEMP_CELSIUS == entity.unit_of_measurement
|
2019-07-31 19:25:30 +00:00
|
|
|
assert "Test" == entity.__str__()
|
2016-03-30 08:52:29 +00:00
|
|
|
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 2 == device_num
|
2016-03-30 08:52:29 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
event = rfxtrx_core.get_rfx_object("0a520802060101ff0f0269")
|
|
|
|
event.data = bytearray(b"\nR\x08\x01\x07\x01\x00\xb8\x1b\x02y")
|
2016-03-30 08:52:29 +00:00
|
|
|
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
|
|
|
|
|
|
|
|
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
|
2019-07-31 19:25:30 +00:00
|
|
|
event = rfxtrx_core.get_rfx_object("0a52080705020085220269")
|
|
|
|
event.data = bytearray(b"\nR\x08\x04\x05\x02\x00\x95$\x02y")
|
2016-03-30 08:52:29 +00:00
|
|
|
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
|
|
|
|
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 2 == len(rfxtrx_core.RFX_DEVICES)
|
2016-03-30 08:52:29 +00:00
|
|
|
|
|
|
|
device_num = 0
|
2016-04-10 23:05:32 +00:00
|
|
|
for id in rfxtrx_core.RFX_DEVICES:
|
2019-07-31 19:25:30 +00:00
|
|
|
if id == "sensor_0601":
|
2016-03-30 08:52:29 +00:00
|
|
|
device_num = device_num + 1
|
2018-10-24 10:10:05 +00:00
|
|
|
assert len(rfxtrx_core.RFX_DEVICES[id]) == 2
|
2019-07-31 19:25:30 +00:00
|
|
|
_entity_temp = rfxtrx_core.RFX_DEVICES[id]["Temperature"]
|
|
|
|
_entity_hum = rfxtrx_core.RFX_DEVICES[id]["Humidity"]
|
2020-02-28 19:46:48 +00:00
|
|
|
assert UNIT_PERCENTAGE == _entity_hum.unit_of_measurement
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 15 == _entity_hum.state
|
2019-07-31 19:25:30 +00:00
|
|
|
assert {
|
|
|
|
"Battery numeric": 9,
|
|
|
|
"Temperature": 51.1,
|
|
|
|
"Humidity": 15,
|
|
|
|
"Humidity status": "normal",
|
|
|
|
"Humidity status numeric": 2,
|
|
|
|
"Rssi numeric": 6,
|
|
|
|
} == _entity_hum.device_state_attributes
|
|
|
|
assert "Bath" == _entity_hum.__str__()
|
|
|
|
|
|
|
|
assert TEMP_CELSIUS == _entity_temp.unit_of_measurement
|
2018-10-24 10:10:05 +00:00
|
|
|
assert 51.1 == _entity_temp.state
|
2019-07-31 19:25:30 +00:00
|
|
|
assert {
|
|
|
|
"Battery numeric": 9,
|
|
|
|
"Temperature": 51.1,
|
|
|
|
"Humidity": 15,
|
|
|
|
"Humidity status": "normal",
|
|
|
|
"Humidity status numeric": 2,
|
|
|
|
"Rssi numeric": 6,
|
|
|
|
} == _entity_temp.device_state_attributes
|
|
|
|
assert "Bath" == _entity_temp.__str__()
|
|
|
|
elif id == "sensor_0502":
|
2016-03-30 08:52:29 +00:00
|
|
|
device_num = device_num + 1
|
2019-07-31 19:25:30 +00:00
|
|
|
entity = rfxtrx_core.RFX_DEVICES[id]["Temperature"]
|
2018-10-24 10:10:05 +00:00
|
|
|
assert TEMP_CELSIUS == entity.unit_of_measurement
|
|
|
|
assert 13.3 == entity.state
|
2019-07-31 19:25:30 +00:00
|
|
|
assert {
|
|
|
|
"Humidity status": "normal",
|
|
|
|
"Temperature": 13.3,
|
|
|
|
"Rssi numeric": 6,
|
|
|
|
"Humidity": 34,
|
|
|
|
"Battery numeric": 9,
|
|
|
|
"Humidity status numeric": 2,
|
|
|
|
} == entity.device_state_attributes
|
|
|
|
assert "Test" == entity.__str__()
|
2018-10-24 10:10:05 +00:00
|
|
|
|
|
|
|
assert 2 == device_num
|
|
|
|
assert 2 == len(rfxtrx_core.RFX_DEVICES)
|