1,规则书写
2,自己对规则进行测试,并且测试通过
3,但是在接收到点位上传信息后,又无法通过
4,日志信息如下
以下是各个部分的原文,方便测试:
1,规则
FOREACH
payload.values as t
DO
concat(replace(replace(replace( t.id,‘.’,‘‘),’ ‘,’’),‘-’,‘_’),‘_nlf’) as name,
float(substr(str(t.v),0,15)) as t.v,
t.t,
t.q,
t.id
FROM “D1_TAOS_TXGLJ/#”
2,样例数据:
{“timestamp”:1719045664263,“values”:[
{“id”:“D1.OPC.A1_B1_NY_PDSTXGLJ2.B1_PDSTXGLJ2.2_1A01_P_PJ”,“v”:5920167.96875,“q”:true,“t”:1719045575989},
{“id”:“D1.OPC.A1_B1_NY_PDSTXGLJ2.B1_PDSTXGLJ2.2_1A03_P_PJ”,“v”:8508.800048828125,“q”:true,“t”:1719038779055},
{“id”:“D1.OPC.A1_B1_NY_PDSTXGLJ2.B1_PDSTXGLJ2.2_1A02_P_PJ”,“v”:32935.198974609375,“q”:true,“t”:1719045042450}]}
3,日志信息:
D1_TAOS_TXGLJ, msg: FOREACH_clause_exception, peername: 172.17.0.1:51624, reason:
{error,{decode_json_failed,<<“{"timestamp":1719045664263,"values":[
{"id":"D1.OPC.A1_B1_NY_PDSTXGLJ2.B1_PDSTXGLJ2.2_1A01_P_PJ","v":5920167.96875,"q":true,"t":1719045575989},
{"id":"D1.OPC.A1_B1_NY_PDSTXGLJ2.B1_PDSTXGLJ2.2_1A03_P_PJ","v":8508.800048828125,"q":true,"t":1719038779055},
{"id":"D1.OPC.A1_B1_NY_PDSTXGLJ2.B1_PDSTXGLJ2.2_1A02_P_PJ","v":32935.198974609375,"q":true,"t":1719045042450},
{"id":"D1.OPC.A1_B1”…>>},[{emqx_rule_runtime,safe_decode_and_cache,1,[{file,“emqx_rule_runtime.erl”},{line,566}]},
{emqx_rule_runtime,eval,2,[{file,“emqx_rule_runtime.erl”},{line,409}]},
{emqx_rule_runtime,select_and_collect,3,[{file,“emqx_rule_runtime.erl”},
{line,219}]},{emqx_rule_runtime,‘-do_apply_rule/3-fun-0-’,2,[{file,“emqx_rule_runtime.erl”},{line,133}]},{emqx_rule_runtime,do_apply_rule,3,[{file,“emqx_rule_runtime.erl”},{line,132}]},{emqx_rule_runtime,apply_rule,3,[{file,“emqx_rule_runtime.erl”},{line,72}]},{emqx_rule_runtime,apply_rule_discard_result,3,[{file,“emqx_rule_runtime.erl”},{line,65}]},{emqx_rule_runtime,apply_rules,3,[{file,“emqx_rule_runtime.erl”},{line,61}]},{emqx_rule_events,on_message_publish,2,[{file,“emqx_rule_events.erl”},{line,142}]},{emqx_hooks,safe_execute,2,[{file,“emqx_hooks.erl”},{line,205}]},{emqx_hooks,do_run_fold,3,[{file,“emqx_hooks.erl”},{line,185}]},{emqx_broker,publish,1,[{file,“emqx_broker.erl”},{line,234}]},{emqx_channel,do_publish,3,[{file,“emqx_channel.erl”},{line,708}]},{emqx_connection,with_channel,3,[{file,“emqx_connection.erl”},{line,846}]},{emqx_connection,process_msg,2,[{file,“emqx_connection.erl”},{line,495}]},{emqx_connection,process_msg,2,[{file,“emqx_connection.erl”},{line,501}]},{emqx_connection,handle_recv,3,[{file,“emqx_connection.erl”},{line,457}]},{proc_lib,wake_up,3,[{file,“proc_lib.erl”},{line,250}]}]}, rule_id: <<“D1_TAOS_TXGLJ”>>
望各位大佬给予支持(跪求)