Hi! I’m trying to query a group and its devices, but the devices query doens’t seems to work when there are more than one device to return.
I’ve tried many queries, but only got the right results when I selected only one device using the “Select by IDs and tags” option.
The workflow and the debug return (empty deviceIds):
I think there is some confusion about the values that the Group: Get Node returns.
-
deviceQueryJson
is the advanced query that defines which devices are associated with your experience group.
-
deviceIds
is not an array of devices matching your query; rather, it is an array of explicit device IDs defined on the experience group as the association. If you provide an advanced query as your association method on the experience group, the deviceIds
property has no effect in how the query is built and it is usually blanked out.
If you want to return an array of devices that are associated with a given experience group, you can use the Device: Get Node using either the “Experience Group ID” query method of the “Advanced Query” query method. Make sure to also check the “Return multiple devices” checkbox, too.
You can also use the Losant API directly to retrieve a list of devices associated with an experience group ID through an advanced query - utilizing the experienceGroupId
query property.