add reconnect timer
This commit is contained in:
parent
76ad1f11f4
commit
51fbe99722
|
@ -29,11 +29,23 @@ signal on_disconnect()
|
||||||
|
|
||||||
## The current home automation system adapter
|
## The current home automation system adapter
|
||||||
var api: Node
|
var api: Node
|
||||||
|
var reconnect_timer := Timer.new()
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
print("HomeApi ready")
|
print("HomeApi ready")
|
||||||
start()
|
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
|
## Starts the adapter with the settings from the settings file
|
||||||
func start():
|
func start():
|
||||||
var success = Store.settings.load_local()
|
var success = Store.settings.load_local()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user