Many features within the Losant Platform require users to provide a list of devices to interact with. For example:
- Dashboard blocks can visualize data from one or many devices
- Workflows can trigger commands to one or more devices
- Access keys can limit access to specific devices within your application
This list is provided in the form of a device query. In short, a device query is a list of device IDs and device tags. Queries are inclusive, meaning that if any condition in the query returns true, the device ID or tagged devices are returned.
Constructing Device Queries#
When prompted by a component to provide a device, a device tag, or a combination of the two, select the input and begin typing. You will then see a list of devices or tags that match your current search parameter.
Once you have found the device / tag you would like to add to your query, either click the item to add it to the query, or toggle your keyboard arrows down to the item you'd like to add and press enter.
Querying by Devices#
When creating a device, you are prompted to give your new device a name; and immediately after creation, that device is assigned an ID by Losant. When searching for a device to add to your query, you may enter any part of the device's name or ID to find it.
You may provide just a single ID to interact with one device, or you may provide a list of as many device IDs as you would like to interact with multiple specific devices.
Some components in the Losant Platform only accept one device at a time, in which case you will only be able to select one device.
Querying by Device Tags#
Queries may also be built against the tags you assign to your devices. Tags may be added, edited or deleted from a device at any time, which allows you to easily add or remove devices from dashboard visualizations, workflows and security groups without having to individually edit those components.
To add a tag to a device query, start typing any key or value that has been assigned to a device within your currently selected application. You will see a list of suggestions and, just like with devices, you may then add that tag to your query. Any device that matches the provided tag will then be returned by your query.
Note that you will see wildcard options in your tag searches; selecting one of these options (either a
key=* or a
value=* option) will return all devices within your application that have either that provided key or value assigned to it, regardless of the other value.
Removing Items from a Query#
Items can be removed from the query at any time. If the query only accepts one value, click the "x" to the right to delete the device / tag.
If the query takes multiple items, you may remove a single item by clicking the "x" in the item's box ...
... or you may delete all of your entries by clicking the "x" to the right.