From 51fbe9972244127e1633ce193eb9212f7595a942 Mon Sep 17 00:00:00 2001 From: Nitwel Date: Mon, 6 May 2024 13:34:56 +0200 Subject: [PATCH] add reconnect timer --- app/lib/globals/home_api.gd | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/lib/globals/home_api.gd b/app/lib/globals/home_api.gd index 6f98cb1..82bd92c 100644 --- a/app/lib/globals/home_api.gd +++ b/app/lib/globals/home_api.gd @@ -29,11 +29,23 @@ signal on_disconnect() ## The current home automation system adapter var api: Node +var reconnect_timer := Timer.new() func _ready(): print("HomeApi ready") start() + reconnect_timer.wait_time = 60 + reconnect_timer.one_shot = false + reconnect_timer.autostart = true + + add_child(reconnect_timer) + + reconnect_timer.timeout.connect(func(): + if has_connected() == false: + start() + ) + ## Starts the adapter with the settings from the settings file func start(): var success = Store.settings.load_local()