diff --git a/apps/iot/src/http_handler/host_handler.erl b/apps/iot/src/http_handler/host_handler.erl index 290c023..5c2f64e 100644 --- a/apps/iot/src/http_handler/host_handler.erl +++ b/apps/iot/src/http_handler/host_handler.erl @@ -117,7 +117,8 @@ handle_request("POST", "/host/activate", _, #{<<"uuid">> := UUID, <<"auth">> := {ok, 200, iot_util:json_error(400, <<"host not found">>)}; {ok, Pid} when is_pid(Pid) -> lager:debug("[host_handler] activate host_id: ~p, start", [UUID]), - BinReply = jiffy:encode(#{<<"auth">> => true}, [force_utf8]), + {ok, Aes} = iot_host:get_aes(Pid), + BinReply = jiffy:encode(#{<<"auth">> => true, <<"aes">> => Aes}, [force_utf8]), case iot_host:publish_message(Pid, 8, BinReply) of {ok, Ref} -> diff --git a/apps/iot/src/iot_host.erl b/apps/iot/src/iot_host.erl index 8724357..b76ef09 100644 --- a/apps/iot/src/iot_host.erl +++ b/apps/iot/src/iot_host.erl @@ -62,7 +62,7 @@ handle(Pid, Packet) when is_pid(Pid) -> reload(Pid) when is_pid(Pid) -> gen_statem:call(Pid, reload). --spec get_aes(Pid :: pid()) -> Aes :: binary(). +-spec get_aes(Pid :: pid()) -> {ok, Aes :: binary()}. get_aes(Pid) when is_pid(Pid) -> gen_statem:call(Pid, get_aes).