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.

Disarming the system after Entering correct PIN
#1
Hello Everyone Please I'm trying to create a security system with scripting (Arming / Disarming after entering a specific PIN code), but I'm still a beginner, I used your script with the same steps mentioned here:

 https://openrb.com/example-allow-switch-...alization/
but I faced an issue when pressing the Enter button which has the following script : 


local value = dpt.decode(event.datahex, dt.bool)
if value then
  -- get current pin
  local pin = storage.get('pin', '')

  -- verify pin number
  if pin == '1234' then
    grp.write('1/1/7', 1)
  end

  -- reset pin
    storage.set('pin', '')
    grp.write(event.dst, false, dt.bool)
end


I noticed that only it get the current pin then rest PIN only without verifying the PIN code. 
so what should I do? 
Thanks for your time.
Reply
#2
You can assign PIN to a visualization object directly. This way it can only be change if a valid PIN is supplied. Script is not needed in this case.
Reply
#3
(17.02.2022, 13:40)admin Wrote: You can assign PIN to a visualization object directly. This way it can only be change if a valid PIN is supplied. Script is not needed in this case.
Thanks for your reply, I already tried using pin code in the visualized object, and I have no problem with it, but I'm asking if I want to use scripting why this error occurred.

Attached Files Thumbnail(s)
   
Reply
#4
Have you mapped a script to each number button? Still I would not use this approach because there's no way of knowing how many numbers were pressed and if the supplied PIN is correct or not.
Reply
#5
(17.02.2022, 13:53)admin Wrote: Have you mapped a script to each number button? Still I would not use this approach because there's no way of knowing how many numbers were pressed and if the supplied PIN is correct or not.

Okay, I got your concept. yes, the PIN was 1234, I created 4 group objects, and made 4 event scripts for them, each has its own script :  

pindigit(event, n)          -- n=1:4
Reply


Forum Jump: