首次提交

This commit is contained in:
Bujue.Win10 2022-01-21 19:09:34 +08:00
commit 768d2ab93c
3 changed files with 86 additions and 0 deletions

46
logDataClean.awk Normal file
View File

@ -0,0 +1,46 @@
#!/bin/awk -f
#############################
# clean data and filter some to rediect to new file
# Author: Liao
# modify time: 2021/12/15 17:05 (+8:00)
#############################
BEGIN{
# system("echo '\n\n\n----------' >> "awk_run_log_path" && date '+%x %X' >> "awk_run_log_path)
dp_recv_from_device = @/ dp rept_type:[[:digit:]]+, data:{/
dp_is_condition = @/dp [[:digit:]]+ match/
dp_not_condition = @/no [[:digit:]]+ match/
pattern = @/([[:digit:]]+-[[:digit:]]+ ([[:digit:]]+:){3}[[:digit:]]+)/
connection_check_ok = @
# Get form OS
}
!a++{
}
$0~dp_recv_from_device{
matchRet(/([0-9]{1,2}-[0-9]{1,2} ([0-9]{1,2}:){3}[0-9]{1,3})/);
substr($0,RSTART,RLENGTH)
match($0,"^\\[([[:digit:]]+-[[:digit:]]+ ([[:digit:]]+:){3}[[:digit:]]+).*? dp .*?, data:(.*)$",d)
print d[1],d[3]
echo '[12-09 19:03:03:863 TUYA Debug][smart_frame.c:2110] dp rept_type:0, data:{"1":true}'
}
$0~dp_is_condition{
}
$0~connection_check_ok{
}
END{
}
function matchRet(reg ,RSTART,RLENGTH){
match($0,reg);
return substr($0,RSTART,RLENGTH)
}

16
start_monitor.sh Normal file
View File

@ -0,0 +1,16 @@
# 创建场景
tail -f /tmp/tuya.log | grep '\] Rev MQTT:' | grep '"ruleId":' >> /data/SceneLinkage &
# 触发场景
tail -f /tmp/tuya.log | grep 'condition set is ok,then execute action set. scene:' >>
# 子设备上报
# 是否有相关场景( dp \d+ match | no dp match)
# 条件判断(conditions check finish. result:true)
# 条件判断结果(condition set is ok,then execute action set. scene:6DAMVviZamUqanPP, 0x8b26d8)
# 动作执行(in work-queue. execute scene:6DAMVviZamUqanPP begin)([scene_linkage_rule_exe.c)
# 子设备上报

24
必要日志.log Normal file
View File

@ -0,0 +1,24 @@
[12-09 19:03:03:863 TUYA Debug][smart_frame.c:2110] dp rept_type:0, data:{"1":true}
[12-09 19:03:03:884 TUYA Debug][mqc_app.c:862] Send MQTT Msg.P:4 N:54368 Q:1 Data:{"dps":{"1":true},"cid":"000d6ffffe972ab8"}
[12-09 19:03:03:885 TUYA Debug][scene_linkage_dp_detect.c:377] rev id:000d6ffffe972ab8 cmd:{"1":true} type:0
[12-09 19:03:03:885 TUYA Debug][scene_linkage_dp_detect.c:415] dp 1 match
[12-09 19:03:03:887 TUYA Debug][condition.c:1376] time_cond is disabled. skip
[12-09 19:03:03:887 TUYA Debug][condition.c:1496] conditions check finish. result:true
[12-09 19:03:03:887 TUYA Notice][scene_linkage_rule_exe.c:2152] condition set is ok,then execute action set. scene:6DAMVviZamUqanPP, 0x89eb80
[12-09 19:03:03:888 TUYA Debug][scene_linkage_rule_exe.c:3430] in work-queue. execute scene:6DAMVviZamUqanPP begin
[12-09 19:03:03:888 TUYA Debug][scene_linkage_rule_exe.c:2392] action<0> is dp cmd:{"cid":"000d6ffffe972ab8","dps":{"2":true}}
[12-09 19:03:03:932 TUYA Debug][scene_linkage_rule_exe.c:2392] action<1> is dp cmd:{"cid":"086bd7fffe1ecf52","dps":{"1":false}}
[12-09 19:03:04:17 TUYA Debug][smart_frame.c:2110] dp rept_type:0, data:{"2":true}
[12-09 19:03:04:47 TUYA Debug][mqc_app.c:862] Send MQTT Msg.P:4 N:54369 Q:1 Data:{"dps":{"2":true},"cid":"000d6ffffe972ab8"}
[12-09 19:03:04:113 TUYA Debug][smart_frame.c:2110] dp rept_type:0, data:{"1":false}
[12-09 19:03:04:157 TUYA Debug][mqc_app.c:862] Send MQTT Msg.P:4 N:54370 Q:1 Data:{"dps":{"1":false},"cid":"086bd7fffe1ecf52"}