From c92bfb70dd3c148c9418f22f38749bafa7a296c5 Mon Sep 17 00:00:00 2001 From: anlicheng Date: Thu, 31 Aug 2023 17:44:31 +0800 Subject: [PATCH] add debug --- apps/iot/src/iot_host.erl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/iot/src/iot_host.erl b/apps/iot/src/iot_host.erl index 08ae114..b4161c3 100644 --- a/apps/iot/src/iot_host.erl +++ b/apps/iot/src/iot_host.erl @@ -419,6 +419,7 @@ handle_event(cast, heartbeat, _, State = #state{uuid = UUID, heartbeat_counter = handle_event(info, {timeout, _, heartbeat_ticker}, StateName, State = #state{uuid = UUID, host_id = HostId, heartbeat_counter = HeartbeatCounter}) -> case StateName =:= ?STATE_DENIED andalso HeartbeatCounter =:= 0 of true -> + lager:warning("[iot_host] uuid: ~p, heartbeat lost, devices will unknown", [UUID]), {ok, _} = host_bo:change_status(UUID, ?HOST_OFFLINE), change_devices_status(HostId, ?DEVICE_UNKNOWN); false -> @@ -461,6 +462,7 @@ code_change(_OldVsn, StateName, State = #state{}, _Extra) -> %% 修改设备的状态 change_devices_status(HostId, NewStatus) when is_integer(HostId), is_integer(NewStatus) -> {ok, Devices} = device_bo:get_host_devices(HostId), + lager:debug("[iot_host] host_id: ~p, devices new status: ~p, devices: ~p", [HostId, NewStatus, Devices]), lists:foreach(fun(DeviceUUID) -> Pid = iot_device:get_pid(DeviceUUID), iot_device:change_status(Pid, NewStatus)