Example #1
0
 def test_mini_remote_button_config_with_data3(self):
     modem = MockModem()
     remote = Remote(modem.protocol, modem, Address("11.22.33"), "Remote", 4)
     modem.devices[str(remote.addr)] = remote
     device = modem.find(Address("aa.bb.cc"))
     modem.devices[device.label] = device
     scenes = Scenes.SceneManager(modem, None)
     # We'll build the following via DeviceEntrys:
     #scenes.data = [{'controllers': [{'11.22.33': {group: 2, data_3: 2}],
     #                'responders': ['aa.bb.cc']}]
     scenes._init_scene_entries()
     # Preserve data_3 values if present
     entry = DeviceEntry.from_json({"addr": "aa.bb.cc",
                                    "group": 2,
                                    "mem_loc" : 8119,
                                    "db_flags": {"is_last_rec": False,
                                                 "in_use": True,
                                                 "is_controller": True},
                                    "data": [3, 0, 2]})
     scenes.add_or_update(remote, entry)
     print(str(scenes.data))
     # We should end up with a single scene with:
     # - 1 controller entry: 11.22.33, group 2, data_3 = 2
     # - 1 responder entry: aa.bb.cc
     assert len(scenes.entries) == 1
     assert len(scenes.data[0]['controllers']) == 1
     assert len(scenes.data[0]['responders']) == 1
     assert scenes.entries[0].controllers[0].group == 2
     assert scenes.entries[0].controllers[0].link_data == [3, 0, 2]
     assert scenes.entries[0].controllers[0].style == 0
     assert scenes.data[0]['controllers'][0]['Remote']['group'] == 2
     assert scenes.data[0]['controllers'][0]['Remote']['data_3'] == 2
Example #2
0
def test_device8(tmpdir):
    '''
    Returns a generically configured iolinc for testing
    '''
    protocol = H.main.MockProtocol()
    modem = H.main.MockModem(tmpdir)
    addr = IM.Address(0x01, 0x02, 0x03)
    device = Remote(protocol, modem, addr, "8button", 8)
    return device