769d9584647c1092b524a8f53f3a732b2e4488ca,tests/components/sensor/test_rfxtrx.py,TestSensorRfxtrx,test_discover_sensor,#TestSensorRfxtrx#,126
Before Change
def test_discover_sensor(self):
Test with discovery of sensor.
config = {"devices": {}}
devices = []
def add_dev_callback(devs):
Add a callback to add devices.
for dev in devs:
devices.append(dev)
rfxtrx.setup_platform(self.hass, config, add_dev_callback)
event = rfxtrx_core.get_rfx_object("0a520801070100b81b0279")
event.data = bytearray(b"\nR\x08\x01\x07\x01\x00\xb8\x1b\x02y")
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
After Change
event.data = bytearray(b"\nR\x08\x01\x07\x01\x00\xb8\x1b\x02y")
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
entity = rfxtrx_core.RFX_DEVICES["sensor_0701"]
self.assertEqual(1, len(rfxtrx_core.RFX_DEVICES))
self.assertEqual({"Humidity status": "normal",
"Temperature": 18.4,
"Rssi numeric": 7, "Humidity": 27,
"Battery numeric": 9,
"Humidity status numeric": 2},
entity.device_state_attributes)
self.assertEqual("sensor_0701 : 0a520801070100b81b0279",
entity.__str__())
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
self.assertEqual(1, len(rfxtrx_core.RFX_DEVICES))
event = rfxtrx_core.get_rfx_object("0a52080405020095240279")
event.data = bytearray(b"\nR\x08\x04\x05\x02\x00\x95$\x02y")
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
entity = rfxtrx_core.RFX_DEVICES["sensor_0502"]
self.assertEqual(2, len(rfxtrx_core.RFX_DEVICES))
self.assertEqual({"Humidity status": "normal",
"Temperature": 14.9,
"Rssi numeric": 7, "Humidity": 36,
"Battery numeric": 9,
"Humidity status numeric": 2},
entity.device_state_attributes)
self.assertEqual("sensor_0502 : 0a52080405020095240279",
entity.__str__())
event = rfxtrx_core.get_rfx_object("0a52085e070100b31b0279")
event.data = bytearray(b"\nR\x08^\x07\x01\x00\xb3\x1b\x02y")
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
entity = rfxtrx_core.RFX_DEVICES["sensor_0701"]
self.assertEqual(2, len(rfxtrx_core.RFX_DEVICES))
self.assertEqual({"Humidity status": "normal",
"Temperature": 17.9,
"Rssi numeric": 7, "Humidity": 27,
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 14
Instances Project Name: home-assistant/home-assistant
Commit Name: 769d9584647c1092b524a8f53f3a732b2e4488ca
Time: 2016-04-10
Author: mail@dahoiv.net
File Name: tests/components/sensor/test_rfxtrx.py
Class Name: TestSensorRfxtrx
Method Name: test_discover_sensor
Project Name: home-assistant/home-assistant
Commit Name: 769d9584647c1092b524a8f53f3a732b2e4488ca
Time: 2016-04-10
Author: mail@dahoiv.net
File Name: tests/components/sensor/test_rfxtrx.py
Class Name: TestSensorRfxtrx
Method Name: test_discover_sensor
Project Name: home-assistant/home-assistant
Commit Name: cac555fc69717c049aac0fcd128fe52190f90313
Time: 2016-04-08
Author: mail@dahoiv.net
File Name: tests/components/light/test_rfxtrx.py
Class Name: TestLightRfxtrx
Method Name: test_discover_light
Project Name: home-assistant/home-assistant
Commit Name: cac555fc69717c049aac0fcd128fe52190f90313
Time: 2016-04-08
Author: mail@dahoiv.net
File Name: tests/components/switch/test_rfxtrx.py
Class Name: TestSwitchRfxtrx
Method Name: test_discover_switch