fix debug info
This commit is contained in:
parent
922894bf04
commit
0b90c99f06
@ -32,7 +32,7 @@ ai_event(Id) when is_integer(Id) ->
|
||||
case hackney:request(post, Url, Headers, Body, [{pool, false}]) of
|
||||
{ok, 200, _, ClientRef} ->
|
||||
{ok, RespBody} = hackney:body(ClientRef),
|
||||
lager:debug("[iot_api] send body: ~p, get error is: ~p", [Body, RespBody]),
|
||||
lager:debug("[iot_api] send body: ~p, get response is: ~p", [Body, RespBody]),
|
||||
hackney:close(ClientRef);
|
||||
{ok, HttpCode, _, ClientRef} ->
|
||||
{ok, RespBody} = hackney:body(ClientRef),
|
||||
|
||||
@ -485,12 +485,12 @@ handle_event(cast, {handle, {event, Event0}}, ?STATE_ACTIVATED, State = #state{u
|
||||
|
||||
handle_event(cast, {handle, {ai_event, Event0}}, ?STATE_ACTIVATED, State = #state{uuid = UUID, aes = AES, has_session = true}) ->
|
||||
EventText = iot_cipher_aes:decrypt(AES, Event0),
|
||||
lager:debug("[iot_host] uuid: ~p, get ai_event: ~p", [UUID, EventText]),
|
||||
lager:debug("[iot_host] ai_event uuid: ~p, text: ~p", [UUID, EventText]),
|
||||
case catch jiffy:decode(EventText, [return_maps]) of
|
||||
#{<<"event_type">> := EventType, <<"params">> := Params0 = #{<<"device_uuid">> := DeviceUUID, <<"props">> := Props}} ->
|
||||
case iot_device:is_alive(DeviceUUID) of
|
||||
error ->
|
||||
lager:notice("[iot_host] uuid: ~p, device_uuid: ~p is not alive, get ai_event: ~p", [UUID, DeviceUUID, EventText]),
|
||||
lager:notice("[iot_host] ai_event uuid: ~p, device_uuid: ~p is not alive, text: ~p", [UUID, DeviceUUID, EventText]),
|
||||
ok;
|
||||
{ok, DevicePid} ->
|
||||
Params = maps:remove(<<"props">>, Params0),
|
||||
@ -509,9 +509,9 @@ handle_event(cast, {handle, {ai_event, Event0}}, ?STATE_ACTIVATED, State = #stat
|
||||
iot_device:ai_event(DevicePid, EventType, Params)
|
||||
end;
|
||||
Event when is_map(Event) ->
|
||||
lager:warning("[iot_host] host: ~p, event: ~p, not supported", [UUID, Event]);
|
||||
lager:warning("[iot_host] ai_event host: ~p, text: ~p, not supported", [UUID, Event]);
|
||||
Other ->
|
||||
lager:warning("[iot_host] host: ~p, event error: ~p", [UUID, Other])
|
||||
lager:warning("[iot_host] ai_event host: ~p, error: ~p", [UUID, Other])
|
||||
end,
|
||||
{keep_state, State};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user