Lighting tests
==============
>>> import logging
>>> import sys
>>> logging.root.handlers = []
>>> logging.basicConfig(level=logging.DEBUG, format="RFXTRX: %(message)s", handlers=[logging.StreamHandler(sys.stdout)])


Lighting1
---------

>>> from RFXtrx import DummyTransport, get_device
>>> x = get_device(0x10, 0x00, 'E13')
>>> print(x)
<class 'RFXtrx.LightingDevice'> type='X10 lighting' id='E13'
>>> transport = DummyTransport()
>>> x = transport.receive([0x07, 0x10, 0x00, 0x2a, 0x45, 0x05, 0x01, 0x70])
RFXTRX: Recv: 0x07 0x10 0x00 0x2a 0x45 0x05 0x01 0x70
>>> print(x)
<class 'RFXtrx.ControlEvent'> device=[<class 'RFXtrx.LightingDevice'> type='X10 lighting' id='E5'] values=[('Command', 'On'), ('Rssi numeric', 7)]
>>> x.device.send_on(transport)
RFXTRX: Send: 0x07 0x10 0x00 0x00 0x45 0x05 0x01 0x00
>>> x.device.send_off(transport)
RFXTRX: Send: 0x07 0x10 0x00 0x00 0x45 0x05 0x00 0x00


Lighting2
---------

>>> from RFXtrx import DummyTransport, get_device
>>> x = get_device(0x11, 0x00, '1234567:5')
>>> print(x)
<class 'RFXtrx.LightingDevice'> type='AC' id='1234567:5'
>>> transport = DummyTransport()
>>> x = transport.receive([0x0b, 0x11, 0x00, 0x2a, 0x01, 0x23, 0x45, 0x67, 0x05, 0x02, 0x07, 0x70])
RFXTRX: Recv: 0x0b 0x11 0x00 0x2a 0x01 0x23 0x45 0x67 0x05 0x02 0x07 0x70
>>> print(x)
<class 'RFXtrx.ControlEvent'> device=[<class 'RFXtrx.LightingDevice'> type='AC' id='1234567:5'] values=[('Command', 'Set level'), ('Dim level', 50), ('Rssi numeric', 7)]
>>> x.device.send_on(transport)
RFXTRX: Send: 0x0b 0x11 0x00 0x00 0x01 0x23 0x45 0x67 0x05 0x01 0x00 0x00
>>> x.device.send_off(transport)
RFXTRX: Send: 0x0b 0x11 0x00 0x00 0x01 0x23 0x45 0x67 0x05 0x00 0x00 0x00
>>> x.device.send_dim(transport, 0)
RFXTRX: Send: 0x0b 0x11 0x00 0x00 0x01 0x23 0x45 0x67 0x05 0x00 0x00 0x00
>>> x.device.send_dim(transport, 1)
RFXTRX: Send: 0x0b 0x11 0x00 0x00 0x01 0x23 0x45 0x67 0x05 0x02 0x00 0x00
>>> x.device.send_dim(transport, 50)
RFXTRX: Send: 0x0b 0x11 0x00 0x00 0x01 0x23 0x45 0x67 0x05 0x02 0x07 0x00
>>> x.device.send_dim(transport, 99)
RFXTRX: Send: 0x0b 0x11 0x00 0x00 0x01 0x23 0x45 0x67 0x05 0x02 0x0f 0x00
>>> x.device.send_dim(transport, 100)
RFXTRX: Send: 0x0b 0x11 0x00 0x00 0x01 0x23 0x45 0x67 0x05 0x02 0x0f 0x00


Lighting3
---------

>>> from RFXtrx import DummyTransport, get_device
>>> x = get_device(0x12, 0x00, '1:234')
>>> print(x)
<class 'RFXtrx.LightingDevice'> type='Ikea Koppla' id='1:234'
>>> transport = DummyTransport()
>>> x = transport.receive([0x08, 0x12, 0x00, 0x2a, 0x01, 0x34, 0x02, 0x15, 0x79])
RFXTRX: Recv: 0x08 0x12 0x00 0x2a 0x01 0x34 0x02 0x15 0x79
>>> print(x)
<class 'RFXtrx.ControlEvent'> device=[<class 'RFXtrx.LightingDevice'> type='Ikea Koppla' id='1:234'] values=[('Command', 'Level 5'), ('Rssi numeric', 7)]
>>> x.device.send_on(transport)
RFXTRX: Send: 0x08 0x12 0x00 0x00 0x01 0x34 0x02 0x10 0x00
>>> x.device.send_off(transport)
RFXTRX: Send: 0x08 0x12 0x00 0x00 0x01 0x34 0x02 0x1a 0x00


Lighting5
---------

>>> from RFXtrx import DummyTransport, get_device
>>> x = get_device(0x14, 0x00, '123456:7')
>>> print(x)
<class 'RFXtrx.LightingDevice'> type='LightwaveRF, Siemens' id='123456:7'
>>> transport = DummyTransport()
>>> x = transport.receive([0x0a, 0x14, 0x00, 0x2a, 0x12, 0x34, 0x56, 0x07, 0x10, 0x0f, 0x70])
RFXTRX: Recv: 0x0a 0x14 0x00 0x2a 0x12 0x34 0x56 0x07 0x10 0x0f 0x70
>>> print(x)
<class 'RFXtrx.ControlEvent'> device=[<class 'RFXtrx.LightingDevice'> type='LightwaveRF, Siemens' id='123456:7'] values=[('Command', 'Set level'), ('Dim level', 50), ('Rssi numeric', 7)]
>>> x.device.send_on(transport)
RFXTRX: Send: 0x0a 0x14 0x00 0x00 0x12 0x34 0x56 0x07 0x01 0x00 0x00
>>> x.device.send_off(transport)
RFXTRX: Send: 0x0a 0x14 0x00 0x00 0x12 0x34 0x56 0x07 0x00 0x00 0x00
>>> x.device.send_open(transport)
RFXTRX: Send: 0x0a 0x14 0x00 0x00 0x12 0x34 0x56 0x07 0x0f 0x00 0x00
>>> x.device.send_close(transport)
RFXTRX: Send: 0x0a 0x14 0x00 0x00 0x12 0x34 0x56 0x07 0x0d 0x00 0x00
>>> x.device.send_stop(transport)
RFXTRX: Send: 0x0a 0x14 0x00 0x00 0x12 0x34 0x56 0x07 0x0e 0x00 0x00
>>> x.device.send_dim(transport, 0)
RFXTRX: Send: 0x0a 0x14 0x00 0x00 0x12 0x34 0x56 0x07 0x00 0x00 0x00
>>> x.device.send_dim(transport, 1)
RFXTRX: Send: 0x0a 0x14 0x00 0x00 0x12 0x34 0x56 0x07 0x10 0x00 0x00
>>> x.device.send_dim(transport, 50)
RFXTRX: Send: 0x0a 0x14 0x00 0x00 0x12 0x34 0x56 0x07 0x10 0x0f 0x00
>>> x.device.send_dim(transport, 99)
RFXTRX: Send: 0x0a 0x14 0x00 0x00 0x12 0x34 0x56 0x07 0x10 0x1f 0x00
>>> x.device.send_dim(transport, 100)
RFXTRX: Send: 0x0a 0x14 0x00 0x00 0x12 0x34 0x56 0x07 0x10 0x1f 0x00


Lighting6
---------

>>> from RFXtrx import DummyTransport, get_device
>>> x = get_device(0x15, 0x00, '1234:A5')
>>> print(x)
<class 'RFXtrx.LightingDevice'> type='Blyss' id='1234:A5'
>>> transport = DummyTransport()
>>> x = transport.receive([0x0b, 0x15, 0x00, 0x2a, 0x12, 0x34, 0x41, 0x05, 0x03, 0x01, 0x00, 0x70])
RFXTRX: Recv: 0x0b 0x15 0x00 0x2a 0x12 0x34 0x41 0x05 0x03 0x01 0x00 0x70
>>> print(x)
<class 'RFXtrx.ControlEvent'> device=[<class 'RFXtrx.LightingDevice'> type='Blyss' id='1234:A5'] values=[('Command', 'Group off'), ('Rssi numeric', 7)]
>>> x.device.send_on(transport)
RFXTRX: Send: 0x0b 0x15 0x00 0x00 0x12 0x34 0x41 0x05 0x00 0x00 0x00 0x00
>>> x.device.send_off(transport)
RFXTRX: Send: 0x0b 0x15 0x00 0x00 0x12 0x34 0x41 0x05 0x01 0x01 0x00 0x00
>>> x.device.send_on(transport)
RFXTRX: Send: 0x0b 0x15 0x00 0x00 0x12 0x34 0x41 0x05 0x00 0x02 0x00 0x00
>>> x.device.send_off(transport)
RFXTRX: Send: 0x0b 0x15 0x00 0x00 0x12 0x34 0x41 0x05 0x01 0x03 0x00 0x00
>>> x.device.send_on(transport)
RFXTRX: Send: 0x0b 0x15 0x00 0x00 0x12 0x34 0x41 0x05 0x00 0x04 0x00 0x00
>>> x.device.send_off(transport)
RFXTRX: Send: 0x0b 0x15 0x00 0x00 0x12 0x34 0x41 0x05 0x01 0x00 0x00 0x00
