设备卡片

This commit is contained in:
AvantLiu 2021-08-17 18:51:40 +08:00
parent e1443422b7
commit 31d7712fb8
8 changed files with 20 additions and 10 deletions

2
.gitignore vendored
View File

@ -52,4 +52,6 @@ ci.sh
data/
apps/dgiot_parse/etc/dgiot_parse.conf
apps/dgiot_jieshun/
apps/dgiot_mingcheng/
apps/dgiot_xinchuangwei/
apps/dgiot_http/etc/dgiot_http.conf

View File

@ -291,3 +291,4 @@ dets_loop(Name, Fun, Key, Acc) ->
dets_loop(Name, Fun, dets:next(Name, Key), Acc);
'$end_of_table' -> ok
end.

View File

@ -72,7 +72,7 @@ start(#{
} = Args) ->
%% 线
dgiot_data:set_consumer(<<"taskround/", Channel/binary, "/", DtuId/binary>>, 1000000),
case dgiot_task:get_pnque(DtuId) of
case dgiot_task:get_pnque(<<"207636730b">>) of
not_find ->
%% ?LOG(info, "not_find ~p", [DtuId]);
pass;

View File

@ -83,7 +83,7 @@
order => 4,
type => string,
required => false,
default => <<"2020-05-28 10:35:10"/utf8>>,
default => <<"2025-05-28 10:35:10"/utf8>>,
title => #{
zh => <<"结束时间"/utf8>>
},
@ -95,7 +95,7 @@
order => 5,
type => integer,
required => false,
default => 20,
default => 180,
title => #{
zh => <<"采集频率/秒"/utf8>>
},

View File

@ -200,7 +200,7 @@ send_msg(#task{tid = Channel, product = Product, devaddr = DevAddr, ref = Ref, q
_ -> erlang:cancel_timer(Ref)
end,
NewQue = lists:nthtail(NewCount, Que),
State#task{que = NewQue, dis = Dis, ref = erlang:send_after((Interval + 5) * 1000, self(), retry)}.
State#task{que = NewQue, dis = Dis, ref = erlang:send_after(Interval * 1000, self(), retry)}.
get_next_pn(#task{mode = Mode, dtuid = DtuId, firstid = DeviceId, product = ProductId, devaddr = DevAddr, round = Round, ref = Ref} = State) ->

View File

@ -339,28 +339,29 @@ get_app(ProductId, Results) ->
error ->
Acc;
{ok, Name} ->
{NewV, Unit, Ico} =
{NewV, Unit, Ico, Devicetype} =
case maps:find(Name, Props) of
error ->
{V, <<"">>, <<"">>};
{ok, #{<<"dataType">> := #{<<"type">> := Type, <<"specs">> := Specs}} = Prop} ->
Devicetype1 = maps:get(<<"devicetype">>, Prop, <<"others">>),
case Type of
Type1 when Type1 == <<"enum">>; Type1 == <<"bool">> ->
Value = maps:get(dgiot_utils:to_binary(V), Specs, V),
Ico1 = maps:get(<<"ico">>, Prop, <<"">>),
{Value, <<"">>, Ico1};
{Value, <<"">>, Ico1, Devicetype1};
Type2 when Type2 == <<"struct">> ->
Ico1 = maps:get(<<"ico">>, Prop, <<"">>),
{V, <<"">>, Ico1};
{V, <<"">>, Ico1, Devicetype1};
_ ->
Unit1 = maps:get(<<"unit">>, Specs, <<"">>),
Ico1 = maps:get(<<"ico">>, Prop, <<"">>),
{V, Unit1, Ico1}
{V, Unit1, Ico1, Devicetype1}
end;
_ ->
{V, <<"">>, <<"">>}
{V, <<"">>, <<"">>, <<"">>}
end,
Acc ++ [#{<<"name">> => Name, <<"number">> => NewV, <<"time">> => NewTime, <<"unit">> => Unit, <<"imgurl">> => Ico}]
Acc ++ [#{<<"name">> => Name, <<"number">> => NewV, <<"time">> => NewTime, <<"unit">> => Unit, <<"imgurl">> => Ico, <<"devicetype">> => Devicetype}]
end
end, [], R)
end, [], Results).

View File

@ -25,3 +25,5 @@
{dgiot_modbus, {{enable_plugin_dgiot_modbus}}}.
{dgiot_group, {{enable_plugin_dgiot_group}}}.
{dgiot_ffmpeg, {{enable_plugin_dgiot_ffmpeg}}}.
{dgiot_ffmpeg, {{enable_plugin_dgiot_xinchuangwei}}}.
{dgiot_ffmpeg, {{enable_plugin_dgiot_mingcheng}}}.

View File

@ -218,6 +218,8 @@ overlay_vars_rel(RelType) ->
, {enable_plugin_dgiot_modbus, true}
, {enable_plugin_dgiot_group, true}
, {enable_plugin_dgiot_ffmpeg, true}
, {enable_plugin_dgiot_xinchuangwei, true}
, {enable_plugin_dgiot_mingcheng, true}
, {vm_args_file, VmArgs}
].
@ -345,6 +347,8 @@ relx_plugin_apps_per_rel(cloud) ->
, dgiot_modbus
, dgiot_group
, dgiot_ffmpeg
, dgiot_xinchuangwei
, dgiot_mingcheng
];
relx_plugin_apps_per_rel(edge) ->
[].