Skip to content

Commit

Permalink
feat: mqtt sysc_rules
Browse files Browse the repository at this point in the history
  • Loading branch information
AvantLiu committed Jan 22, 2022
1 parent 435a2f1 commit ecb9243
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/dgiot_mqtt/src/dgiot_mqtt_channel.erl
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ init(?TYPE, ChannelId, #{
id = ChannelId,
auth = Auth
},
dgiot_rule_handler:sysc_rules(),
emqx_rule_engine_api:list_rules(#{}, []),
%% dgiot_matlab_tcp:start(Port, State)
{ok, State};

Expand Down Expand Up @@ -138,7 +140,7 @@ handle_message({rule, #{clientid := _DeviceId, username := ProductId, payload :=
case binary:split(Topic, <<$/>>, [global, trim]) of
%% /ecfd3a227c/6C4B909AF64A/metadata/derived 派生物模型上报
[<<>>, ProductId, DtuAddr, <<"metadata">>, <<"derived">>] ->
create_device(ProductId, DtuAddr, <<"MATLAB_", DtuAddr/binary>>, Peerhost),
create_device(ProductId, DtuAddr, <<"MQTT_", DtuAddr/binary>>, Peerhost),
case jsx:decode(Payload, [{labels, binary}, return_maps]) of
#{<<"timestamp">> := _Timestamp,
<<"metadata">> := Metadata,
Expand Down

0 comments on commit ecb9243

Please sign in to comment.