diff --git a/apps/iot/src/iot_host.erl b/apps/iot/src/iot_host.erl index 71a0108..e4d7d4e 100644 --- a/apps/iot/src/iot_host.erl +++ b/apps/iot/src/iot_host.erl @@ -315,7 +315,8 @@ handle_message(#{<<"method">> := <<"inform">>, <<"params">> := Info0}, State = # Info = iot_cipher_aes:decrypt(AES, base64:decode(Info0)), case catch jiffy:decode(Info, [return_maps]) of #{<<"at">> := At, <<"services">> := ServiceInforms} -> - lists:foreach(fun(#{<<"scene_id">> := SceneId, <<"name">> := Name, <<"version">> := Version, <<"version_copy">> := VersionCopy, <<"status">> := Status}) -> + lists:foreach(fun(Item = #{<<"name">> := Name, <<"version">> := Version, <<"version_copy">> := VersionCopy, <<"status">> := Status}) -> + SceneId = maps:get(<<"scene_id">>, Item, 0), micro_inform_log:insert(#{ <<"host_id">> => HostId, <<"scene_id">> => SceneId, @@ -330,7 +331,7 @@ handle_message(#{<<"method">> := <<"inform">>, <<"params">> := Info0}, State = # ok end, ServiceInforms); Error -> - lager:warning("[iot_host] inform error: ~p", [Error]) + lager:warning("[iot_host] inform get error: ~p", [Error]) end, State; diff --git a/apps/iot/src/mocker/host_mocker.erl b/apps/iot/src/mocker/host_mocker.erl index 3d20a92..d1e12be 100644 --- a/apps/iot/src/mocker/host_mocker.erl +++ b/apps/iot/src/mocker/host_mocker.erl @@ -308,11 +308,11 @@ handle_info({timeout, _, inform_ticker}, State = #state{aes = Aes, topic = Topic handle_info({timeout, _, feedback_ticker}, State = #state{aes = Aes, topic = Topic}) -> Info = jiffy:encode(#{ <<"task_id">> => 1, - <<"task_type">> => 2, + <<"type">> => 2, <<"code">> => 200, <<"reason">> => <<"ok">>, <<"error">> => <<"">>, - <<"created_at">> => iot_util:current_time() + <<"time">> => iot_util:current_time() }, [force_utf8]), Msg = jiffy:encode(#{