The Sensor Data DB Action Component is to read from the Sensor Data DB. Each recorded piece of data gets stored in the Sensor Data DB. With this component, you can query that database.
The SensorDataDB component queries data from the SensorDataDB stored in HubKit and passes each record, one row at a time, to the next component.

With the content specified in the property, search the sensor DB and execute a filter expression for each matched record. The matched records can be referenced in the “Value” variable. If the result of the expression is true, the record will be passed through and the output Payload.

Output Payload Description
cv.Payload Outputs a JSON Object for each record that matches the conditions.

Output Example

   "AreaName":"Entrance Area",

Timestamp is output as a date/time type in the JSON Object type.
For each record, the component variable ( cv.Id ) is given a record ID, the component variable ( cv.Count ) is given the first record that matches the record, and the ID is incremented by 1, and the number of the ID is incremented in order.

Component Properties

Name Required Description
Filter Key True The property to filter for
Filter Value True The value to filter for
From Previous True The number of records to retrieve (e.g., if From Previous is 10 and the timescale is a record, the latest 10 will be retrieved).
Timescale True Unit of the latest data to be acquired (choose from records, milliseconds, seconds, minutes, hours, days, weeks, months, and years). cp.Timescale can be one of the following values: “Records”, “Milliseconds”, “Seconds”, “Minutes”, “Hours”, “Days”, “Weeks”, “Months”, or “Years”.
All Records True Get all records by overriding the From Previous and Timescale conditions.
Time Rounding True Get data from the last second, minute, hour, day, day, week, month, and year rounded up to the last time the component was executed.
Filter Expressions false Allow you to choose whether to output the payload in an expression, like the Filter component Filter Expressions. Filter Formula Example
Value.Data > 123
Value.Data.key1 == "abc" && Value.Data.key2 > 123


If you like to use the data from the sensor DB in the next step, for example a Matrix Display that rotates various latest database values, you will have to access the data using cv.Payload.Data:

In this example, each SensorDataDB step reads a particular last data set of a layer, the Gravio Led Matrix shows it on the display and the Sleep step pauses the display for 15 seconds.

Need more help with this?
Join our slack community for help

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.