def test_device_info_rpc(device): pw_client = PigweedClient(device, RPC_PROTOS) status, payload = pw_client.rpcs.chip.rpc.Device.GetDeviceInfo() assert status.ok() == True assert payload.vendor_id != None and payload.product_id != None and payload.serial_number != None device_details = get_device_details(device) assert device_details != None and len(device_details) != 0 assert int(device_details["VendorID"]) == payload.vendor_id assert int(device_details["ProductID"]) == payload.product_id assert int( device_details["Discriminator"]) == payload.pairing_info.discriminator assert int(device_details["SetUpPINCode"]) == payload.pairing_info.code
def test_ligth_ctrl_rpc(device): pw_client = PigweedClient(device, RPC_PROTOS) # Check light on status, payload = pw_client.rpcs.chip.rpc.Lighting.Set(on=True) assert status.ok() == True status, payload = pw_client.rpcs.chip.rpc.Lighting.Get() assert status.ok() == True assert payload.on == True # Check light off status, payload = pw_client.rpcs.chip.rpc.Lighting.Set(on=False) assert status.ok() == True status, payload = pw_client.rpcs.chip.rpc.Lighting.Get() assert status.ok() == True assert payload.on == False
def test_lock_ctrl_rpc(device): pw_client = PigweedClient(device, RPC_PROTOS) # Check locked status, payload = pw_client.rpcs.chip.rpc.Locking.Set(locked=True) assert status.ok() == True status, payload = pw_client.rpcs.chip.rpc.Locking.Get() assert status.ok() == True assert payload.locked == True # Check unlocked status, payload = pw_client.rpcs.chip.rpc.Locking.Set(locked=False) assert status.ok() == True status, payload = pw_client.rpcs.chip.rpc.Locking.Get() assert status.ok() == True assert payload.locked == False
def test_button_ctrl_rpc(device): pw_client = PigweedClient(device, RPC_PROTOS) # Check button 0 (lighting) status, payload = pw_client.rpcs.chip.rpc.Lighting.Get() assert status.ok() == True initial_state = bool(payload.on) compare_state = not initial_state status, payload = pw_client.rpcs.chip.rpc.Button.Event(idx=0, pushed=True) assert status.ok() == True sleep(2) status, payload = pw_client.rpcs.chip.rpc.Lighting.Get() assert status.ok() == True assert payload.on == compare_state compare_state = initial_state status, payload = pw_client.rpcs.chip.rpc.Button.Event(idx=0, pushed=True) assert status.ok() == True sleep(2) status, payload = pw_client.rpcs.chip.rpc.Lighting.Get() assert status.ok() == True assert payload.on == compare_state
def test_device_ota_rpc(device): pw_client = PigweedClient(device, RPC_PROTOS) status, payload = pw_client.rpcs.chip.rpc.Device.TriggerOta() assert status == Status.UNIMPLEMENTED
def test_device_reboot_rpc(device): pw_client = PigweedClient(device, RPC_PROTOS) status, payload = pw_client.rpcs.chip.rpc.Device.Reboot() assert status == Status.UNIMPLEMENTED
def test_device_factory_reset_rpc(device): pw_client = PigweedClient(device, RPC_PROTOS) status, payload = pw_client.rpcs.chip.rpc.Device.FactoryReset() assert status.ok() == True
def test_echo(device): pw_client = PigweedClient(device, RPC_PROTOS) status, payload = pw_client.rpcs.pw.rpc.EchoService.Echo( msg=PW_ECHO_TEST_MESSAGE) assert status.ok() == True assert payload.msg == PW_ECHO_TEST_MESSAGE