You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the nimha_gateway receives a message with a trigger, it starts the trigger proc asyncCheck alarmTriggered(). Inside the trigger proc, I would like to run a loop with await sleepAsync. The loop needs to break, if the user changes the alarm status from triggered to disarmed. If the user does not change the alarm status before the countdown time, the loop will set alarm status to ringing and break.
But using await inside this proc does not work. The await never finishes - therefore the alarm will never start ringing.
# One of many triesprocalarmTriggerTimer() {.async.} =var counter =0whiletrue:
waitForsleepAsync(1000)
inc(counter)
if counter == countDownTime or alarmStatus !="triggered":
breakvar f =alarmTriggerTimer(countDown)
whilenot f.finished:
poll(1000)
if f.finished:
if alarmStatus =="triggered":
asyncCheckalarmRinging(db, trigger, device)
# Another tryvar counter =0whiletrue:
awaitsleepAsync(100)
inc(counter)
if counter == countDownTime and alarmStatus =="triggered":
alarmRinging(db, trigger, device)
breakelif counter == countDownTime and alarmStatus !="triggered":
break
The text was updated successfully, but these errors were encountered:
When the nimha_gateway receives a message with a trigger, it starts the trigger proc
asyncCheck alarmTriggered()
. Inside the trigger proc, I would like to run a loop withawait sleepAsync
. The loop needs to break, if the user changes the alarm status from triggered to disarmed. If the user does not change the alarm status before the countdown time, the loop will set alarm status to ringing and break.But using await inside this proc does not work. The await never finishes - therefore the alarm will never start ringing.
Trigger proc
Await tries inside the trigger proc
The text was updated successfully, but these errors were encountered: