OneNET IoT Platform Platform Introduction Introduction Manual Guidline for Device Development Guideline for Application Development
API
API Usage API List SDK MQTT LwM2M EDP Modbus TCP
HTTP Push MQ
Other Service Common Question

Rule Configuration

OneNET supports user-defined data forwarding rules based on data stream

  • Forward all data streams
  • Select data stream based on data stream template
  • Use regular expression to self-define matching rules for data stream names

Regular Expression Use

OneNET supports the user to use regular expression to self-define the filtering and matching rules for data stream names when filtering

Example 1: Select all data streams

The reference filter expression is:

.*

Example 2: Precisely filter a data stream

Expression syntax:

Data stream name

Or

^Data stream name $ 

Example: If you need to select only the data stream ccc from aaa, bbb, ccc data streams, the reference filter expression is:

ccc

Or

^ccc$

Example 3: Precisely filter multiple data streams

Expression syntax:

Data stream name 1 | data stream name 2 | data stream name 3

Or

^Data stream name 1$|^Data stream name 2$|^Data stream name 3$

If you need to select only the data streams aaa, ccc, from aaa, bbb, and ccc data streams, the reference filter expression is: aaa|ccc

Or

^aaa$|^ccc$

Example 4: Fuzzy filter data stream

(1) If you need to select only the data stream (abc, bcd) containing bc from abc, bcd, cde data streams, the reference filter expression is:

.*bc.*

(2) If you need to select only test0 test1 test2 from test0, test1, test2, test3, abctest0 data streams, the reference filter expression is:

^test[0-2]

Example 5: Multiple fuzzy filter data stream

If you need to select only test0 test01 humi2 from test0, test01, humi2, humi3, abctest0 data streams, the reference filter expression is:

^test0.*|humi2

Data format after filtering rules

The data filtered by the rules is distributed to subsequent services in a uniform data format (json). The data format is as follows:

Data Stream Messages

The message in the forward data stream is actually a new data point (deviceDatapoint) in the forward data stream. The data format is as follows:

Parameter Property Format Description Example
sysProperty messageType String Message type: Fixed as deviceDatapoint
timestamp Int The timestamp of the message using the rule engine, unix time, in second 15980987429
productId string Product ID 90273
appProperty deviceId String Device ID 102839
dataTimestamp Int Device data point production timestamp, which can be self-defined and carried when uploading 15980987429
datastream string Data stream name weather
body object/string Detailed message content of data point See the example below

Data json example 1, json data

{
    "sysProperty": {
        "messageType": "deviceDatapoint",
        "timestamp": 15980987429,
        "productId": "90273",
    },
    "appProperty":{
        "deviceId": "102839",
        "dataTimestamp": 15980987429,
        "datastream":"weather"
    },
    "body":{
        "temperature": 30,
        "humidity": "47%"
    }
}

Data json example 2, string data

{
    "sysProperty": {
        "messageType": "deviceDatapoint",
        "timestamp": 15980987429,
        "productId": "90273",
    },
    "appProperty":{
        "deviceId": "102839",
        "dataTimestamp": 15980987429,
        "datastream":"weather"
    },
    "body":"sunny with wind"
}

Data json example 3, binary data

{
    "sysProperty": {
        "messageType": "deviceDatapoint",
        "timestamp": 15980987429,
        "productId": "90273",
    },
    "appProperty":{
        "deviceId": "102839",
        "dataTimestamp": 15980987429,
        "datastream":"weather"
    },
    "body":{
        "index": "3491506_1475204886914_bin"
    }
}

results matching ""

    No results matching ""