Manage States
After launching the thing console and bringing up a list of things, click the thing you want to manage.
The thing attribute screen will show up. By selecting the "States" tab, the current state will show up as follows.
You can make the following operations.
See State Registration and Retrieval to learn the difference between a state and state history.
Register a state
Define a state in the editor. The state is to be defined in the JSON format. See State Registration and Retrieval for the details on how to define the state.
When you are done with defining the state, press the "Update" button. The state will be registered as the latest state.
Browse state history
Press the "State Query" button to browse the state history.
The state history query screen will show up as follows.
In the search window, specify the conditional expression for filtering the state history you want to browse.
Clicking the "help?" button at the right of the search window will show you examples of conditional expressions.
As shown in these examples, a conditional expression is composed of an aggregation method, a target field, and a time range.
Aggregation method
Specify how to aggregate the state history.
You can specify one of the following methods.
Method | Description |
---|---|
count | Count the number of the state history that has a non-null value in the target field. |
sum | Calculate the sum of the values in the target field. |
max | Determine the maximum value of the target field. |
min | Determine the minimum value of the target field. |
mean | Calculate the average of the values in the target field. |
You can select the method "max", "min", and "mean" only when the target field has the data type "integer" or "decimal".
Currently, the thing console only allows you to browse the aggregated results. You cannot browse the state history as is. If you want to browse non-aggregated state history, use the data browser.
Target field
Specify the target field to aggregate in the form of FIELD_NAME:DATA_TYPE
.
You can use the following data types.
- integer: Integer
- decimal: Floating point
- string: String
- boolean: Boolean
Time range
Specify the time rage in the form of from "START_DAMETIME" to "END_DATETIME"
. Use the ISO 8601 format for specifying the data and time.
Note that the actual state history retrieval is performed in group units. Read Time range for more detail.