Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FP2] Offline event after reconnection attempt to prevent fake offline #1734

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions drivers/Aqara/aqara-presence-sensor/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,16 @@ end
local function check_and_update_connection(driver, device)
local conn_info = device:get_field(fields.CONN_INFO)
if not driver.device_manager.is_valid_connection(driver, device, conn_info) then
device:offline()
find_new_connection(driver, device)
conn_info = device:get_field(fields.CONN_INFO)
end

if driver.device_manager.is_valid_connection(driver, device, conn_info) then
-- Check if the new connection works well
if driver.device_manager.is_valid_connection(driver, device, conn_info) then
device:online()
else
device:offline()
end
else
device:online()
end
end
Expand Down
Loading