1、V5.0.X版本 EMQX安装、卸载 以及使用
安装教程
2、emqx规则案例
2.1、数组嵌套JSON对象
[{ "measurement":"MQBRD02", "fields": {"TGHS":400, "TTH01R":499, "TGHR":398, "GroupName":"MQBRD02" }, "timestamp":"2021-10-21T05:59:16.063Z" }] 要求:判断TGHS的值小于等于400 大于380 引擎规则: SELECT payload as p, p[1].fields.TGHS as c FROM "abc/#" where 400 < c and c < 5002.2、数据是对象嵌套数组
假设数据是
{
"date": "2020-04-24",
"sensors": [
{"name": "a", "idx":0},
{"name": "b", "idx":1},
{"name": "c", "idx":2}
]
}
要求:筛选出name 为a 或者为c的数据
引擎规则:
FOREACH
payload.sensors
DO
item.name as name,
item.idx as idx
INCASE
item.name = 'a' or item.name = 'c'
FROM
"t/#"
或者
FOREACH
payload.sensors as ps
DO
ps.name as name,
ps.idx as idx
INCASE
ps.name = 'a' or ps.name = 'c'
FROM
"t/#"
2.3、除结果包含变量值的c_前缀 对象
1、去除结果包含变量值的c_前缀 对象 { "date": "2020-04-24", "se