c8a2ce20be850ed99e8b7fb0d3ff48ec025fb4f0,iot/api-client/manager/manager.py,,get_state,#Any#Any#Any#Any#Any#,267

Before Change


        device_id):
    Retrieve a device"s state blobs.
    // [START iot_get_device_state]
    client = get_client(service_account_json)
    registry_name = "projects/{}/locations/{}/registries/{}".format(
            project_id, cloud_region, registry_id)

    device_name = "{}/devices/{}".format(registry_name, device_id)
    devices = client.projects().locations().registries().devices()
    state = devices.states().list(name=device_name, numStates=5).execute()

    print("State: {}\n".format(state))

    return state

After Change


    device = client.get_device(device_path)
    print("Last state: {}".format(device.state))

    print("State history")
    states = client.list_device_states(device_path).device_states
    for state in states:
        print("State: {}".format(state))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: c8a2ce20be850ed99e8b7fb0d3ff48ec025fb4f0
Time: 2019-09-26
Author: gguuss@gmail.com
File Name: iot/api-client/manager/manager.py
Class Name:
Method Name: get_state


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 223abdede96295f7fba58a1d1e1fb63a961c33f5
Time: 2019-10-09
Author: gguuss@gmail.com
File Name: iot/api-client/manager/manager.py
Class Name:
Method Name: delete_registry


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 223abdede96295f7fba58a1d1e1fb63a961c33f5
Time: 2019-10-09
Author: gguuss@gmail.com
File Name: iot/api-client/manager/manager.py
Class Name:
Method Name: create_registry