简体   繁体   中英

How to get active device list from Google Cloud IoT core

I'm using Google's cloud-iot-core in my project with Firebase/Firestore. I've devices in my iot core registry, I want to get active devices from iot core using command or using iot core liabrary(Java/Python). I want to show/update active device in android app and also on Firebase/Firestore. How can I do that??

Google Cloud IoT exposes a REST interface that can be used to interrogate the state of devices. Specifically, there is an API called projects.locations.registries.devices.list which can be used to return a list of all devices.

https://cloud.google.com/iot/docs/reference/cloudiot/rest/v1/projects.locations.registries.devices/list

Using this API, you get back a list of Device objects:

https://cloud.google.com/iot/docs/reference/cloudiot/rest/v1/projects.locations.registries.devices#Device

which contains the identity of each device as well as fields such as lastHeartbeatTime . In your original question, you didn't define what you meant by active as it relates to a device so I am assuming that would be either lastHeartbeatTime or lastEventTime .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM