Skip to main content

HTML and CSV Reports

The Report Generator is a tool that allows you to receive customized reports about your data via email.

Usage

You can define a report as an Action in the Rule Engine UI. There are three ways to define a report.

Method 1: Array of Objects

Provide an array of IoT nodes _idthat should be included in the report.

Example:

[ 
{
"nodes": [
"63a2cfec12169cf61ae14381",
"63a2d11212169cf61ae14385"
],
"measurement": "temperature",
"graph": "step",
"duration": "1M",
"distance": "1d"
},
{
"nodes": [
"63a2cfec12169cf61ae14381",
"63a2d11212169cf61ae14385"
],
"measurement": "humidity",
"graph": "step",
"duration": "1w",
"distance": "1d"
}
]

Method 2: Single Object with Device Count

You can define a report using a single object that specifies a measurement type and sets the deviceCount boolean to true. This generates a special report that lists all IoT nodes owned by the user, primarily intended for billing purposes.

Example:

[
{
"measurement": "deviceCount",
"deviceCount": true,
"startTime": "2019-01-01T00:00:00.000Z", // optional
"endTime": "2019-01-31T00:00:00.000Z" // optional
}
]

Method 3: Single Object with Query

You can define a report using a single object that specifies both a measurement type and a query.
This method is useful for generating reports that include:

  • All IoT nodes owned by the user, or
  • Specific nodes filtered by device model name or ID.

When the report is generated, an email with a CSV file attached will be sent.

CSV Format

The format of the CSV file depends on the keys you define:

  • "csv-column": true → Data is structured as a column.
  • "csv-table": true → Data is structured as a table.
  • If neither is set, the default format is a table.

File Name

  • Set "fileName" to a string to define the output file name.
  • If not set, the file will be named report.csv by default.

End Time

  • Set "endTime" to a specific value to fix the report’s end time.
  • If not set, the current time is used as the end time by default.

Example:

[
{
"query": "all",
"csv-column": true,
"measurement": "temperature",
"duration": "3M",
"distance": "1M",
"endTime": "2019-01-31T00:00:00.000Z",
"fileName": "myReport.csv"
}
]
[
{
"query": {
"deviceModelName": "myDeviceModelName"
},
"csv-column": true,
"measurement": "temperature",
"duration": "3M",
"distance": "1M",
"fileName": "myReport.csv"
}
]
[
{
"query": {
"_id": "63a2d11212169cf61ae14385"
},
"csv-table": true,
"measurement": "temperature",
"duration": "3M",
"distance": "1M"
}
]

All methods - Report Structure

A report is defined as an array of objects, each containing information about a specific report:

  • Nodes: An array of strings representing the unique identifiers of the nodes being measured. At least one node is required.
  • Measurement: A string describing the type of measurement being taken (e.g., "temperature").
  • Graph: A string describing how the data should be displayed. Options include:
    • "step": Display the data as a step graph
    • "line": Display the data as a line graph
    • "bar": Display the data as a bar graph
  • Duration: A string specifying the length of time over which measurements will be taken for the entire report. Format: "value"+"unit", where value is a number and unit can be:
    • "s" = seconds
    • "m" = minutes
    • "h" = hours
    • "d" = days
    • "w" = weeks
    • "M" = months
    • "y" = years
  • Distance (optional): A string specifying the time interval between measurements. Format is the same as Duration.
Method 2 Device Count - Allowed Properties
  • Measurement: Currently, only "deviceCount" is supported for generating a special report that lists all IoT nodes owned by the user.
  • deviceCount: A boolean that must be set to true if the measurement is "deviceCount".
Method 3 Single Object with Query - Additional Properties
  • Query: A string or object specifying which nodes to include in the report. Options:
    • "all": Includes all IoT nodes owned by the user (query: "all").
    • "query.deviceModelName": Includes nodes with a specific device model name (query: { deviceModelName: "myDeviceModelName" }).
    • "query._id": Includes nodes with a specific device ID (query: { _id: "63a2d11212169cf61ae14385" }).

Note: The properties listed above are specific to each method. Not all properties apply to every method of defining a report.

HTML and CSV Reports

The Report Generator is a tool that allows you to receive customized reports about your data via email.

Usage

You can define a report as an Action in the Rule Engine UI. There are three ways to define a report.

Method 1: Array of Objects

Provide an array of IoT nodes _idthat should be included in the report.

Example:

[ 
{
"nodes": [
"63a2cfec12169cf61ae14381",
"63a2d11212169cf61ae14385"
],
"measurement": "temperature",
"graph": "step",
"duration": "1M",
"distance": "1d"
},
{
"nodes": [
"63a2cfec12169cf61ae14381",
"63a2d11212169cf61ae14385"
],
"measurement": "humidity",
"graph": "step",
"duration": "1w",
"distance": "1d"
}
]

Method 2: Single Object with Device Count

You can define a report using a single object that specifies a measurement type and sets the deviceCount boolean to true. This generates a special report that lists all IoT nodes owned by the user, primarily intended for billing purposes.

Example:

[
{
"measurement": "deviceCount",
"deviceCount": true,
"startTime": "2019-01-01T00:00:00.000Z", // optional
"endTime": "2019-01-31T00:00:00.000Z" // optional
}
]

Method 3: Single Object with Query

You can define a report using a single object that specifies both a measurement type and a query.
This method is useful for generating reports that include:

  • All IoT nodes owned by the user, or
  • Specific nodes filtered by device model name or ID.

When the report is generated, an email with a CSV file attached will be sent.

CSV Format

The format of the CSV file depends on the keys you define:

  • "csv-column": true → Data is structured as a column.
  • "csv-table": true → Data is structured as a table.
  • If neither is set, the default format is a table.

File Name

  • Set "fileName" to a string to define the output file name.
  • If not set, the file will be named report.csv by default.

End Time

  • Set "endTime" to a specific value to fix the report’s end time.
  • If not set, the current time is used as the end time by default.

Example:

[
{
"query": "all",
"csv-column": true,
"measurement": "temperature",
"duration": "3M",
"distance": "1M",
"endTime": "2019-01-31T00:00:00.000Z",
"fileName": "myReport.csv"
}
]
[
{
"query": {
"deviceModelName": "myDeviceModelName"
},
"csv-column": true,
"measurement": "temperature",
"duration": "3M",
"distance": "1M",
"fileName": "myReport.csv"
}
]
[
{
"query": {
"_id": "63a2d11212169cf61ae14385"
},
"csv-table": true,
"measurement": "temperature",
"duration": "3M",
"distance": "1M"
}
]

All methods - Report Structure

A report is defined as an array of objects, each containing information about a specific report:

  • Nodes: An array of strings representing the unique identifiers of the nodes being measured. At least one node is required.
  • Measurement: A string describing the type of measurement being taken (e.g., "temperature").
  • Graph: A string describing how the data should be displayed. Options include:
    • "step": Display the data as a step graph
    • "line": Display the data as a line graph
    • "bar": Display the data as a bar graph
  • Duration: A string specifying the length of time over which measurements will be taken for the entire report. Format: "value"+"unit", where value is a number and unit can be:
    • "s" = seconds
    • "m" = minutes
    • "h" = hours
    • "d" = days
    • "w" = weeks
    • "M" = months
    • "y" = years
  • Distance (optional): A string specifying the time interval between measurements. Format is the same as Duration.
Method 2 Device Count - Allowed Properties
  • Measurement: Currently, only "deviceCount" is supported for generating a special report that lists all IoT nodes owned by the user.
  • deviceCount: A boolean that must be set to true if the measurement is "deviceCount".
Method 3 Single Object with Query - Additional Properties
  • Query: A string or object specifying which nodes to include in the report. Options:
    • "all": Includes all IoT nodes owned by the user (query: "all").
    • "query.deviceModelName": Includes nodes with a specific device model name (query: { deviceModelName: "myDeviceModelName" }).
    • "query._id": Includes nodes with a specific device ID (query: { _id: "63a2d11212169cf61ae14385" }).

Note: The properties listed above are specific to each method. Not all properties apply to every method of defining a report.