'Test with discovery of sensor.'

def test_discover_sensor(self):

    self.assertTrue(setup_component(self.hass, 'sensor', {'sensor': {'platform': 'rfxtrx', 'automatic_add': True, 'devices': {}}}))
    event = rfxtrx_core.get_rfx_object('0a520801070100b81b0279')
    event.data = bytearray('\nR\x08\x01\x07\x01\x00\xb8\x1b\x02y')
    rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
    entity = rfxtrx_core.RFX_DEVICES['sensor_0701']['Temperature']
    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('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('\nR\x08\x04\x05\x02\x00\x95$\x02y')
    rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
    entity = rfxtrx_core.RFX_DEVICES['sensor_0502']['Temperature']
    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('0a52080405020095240279', entity.__str__())
    event = rfxtrx_core.get_rfx_object('0a52085e070100b31b0279')
    event.data = bytearray('\nR\x08^\x07\x01\x00\xb3\x1b\x02y')
    rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
    entity = rfxtrx_core.RFX_DEVICES['sensor_0701']['Temperature']
    self.assertEqual(2, len(rfxtrx_core.RFX_DEVICES))
    self.assertEqual({'Humidity    status': 'normal', 'Temperature': 17.9, 'Rssi    numeric': 7, 'Humidity': 27, 'Battery    numeric': 9, 'Humidity    status    numeric': 2}, entity.device_state_attributes)
    self.assertEqual('0a520801070100b81b0279', entity.__str__())
    event = rfxtrx_core.get_rfx_object('0b1100cd0213c7f210010f70')
    rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS[0](event)
    self.assertEqual(2, len(rfxtrx_core.RFX_DEVICES))
