This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

problem with loop for one-time email notification
#1
Hello together,


im tying to build a simple "alarm system" with email notification.

But i have a little problem with the loop for the email notification.

If there is an alarm, i don´t get a one-time email notification, i get endles email notifications.

Can somebody show me where the mistake in my thinking is?



The objects / variabels (alarm_on; door_1_closed; door_1_locked; door_2_cloded; door_3_closedWink have the same "Tag" to start a event based script.


-- ==========================================================================
--                                                                         
--  alarm system                                                           
--  © 2021 123einerlei                                                       
--                                                                         
--  simple email alarm notification                                                           
--                                                                         
-- ==========================================================================

--variable declaration-------------------------------------------------------

alarm_on = grp.getvalue('1/1/1') -- arm the alarm system
garage_armed = grp.getvalue('2/2/2') -- alarm system armed
alarm = grp.getvalue('3/3/3') -- alarm
door_1_closed = grp.getvalue('4/4/4') -- side entrance door closed
door_1_locked = grp.getvalue('5/5/5') -- side entrance door locked
door_2_closed = grp.getvalue('6/6/6') -- door street closed
door_3_closed = grp.getvalue('7/7/7') -- door garden closed

--arm the alarmsystem--------------------------------------------------------

if
    alarm_on == true then

--logic----------------------------------------------------------------------

    if
        door_1_closed == true and door_1_locked == true and door_2_closed == true and door_3_closed == true

    then
        grp.write('3/3/3', true)      -- no alarm
    i = 1
     
    else
        grp.write('3/3/3', false)    -- alarm
        alert('message')
 
--loop for one-time email notification---------------------------------------

        repeat
            Email("user@provider.com", "subject", "message")
            i, = i+1
             
        until (i > 1)
     
    end
 
--status alarmsystem---------------------------------------------------------

    grp.write('2/2/2', true)                    -- status alarmsystem armed

else
    grp.write('2/2/2', false)                -- status alarm system disarmed

end
Reply


Messages In This Thread
problem with loop for one-time email notification - by 123einerlei - 25.10.2021, 18:12

Forum Jump: