Alarm und FTUI: Unterschied zwischen den Versionen
Keine Bearbeitungszusammenfassung |
|||
Zeile 34: | Zeile 34: | ||
==3.Schritt: Einbinden des Keypads in das FTUI== | ==3.Schritt: Einbinden des Keypads in das FTUI== | ||
Dazu muss in die anzuzeigende Seite der folgende Code eingetragen werden: | Dazu muss in die anzuzeigende Seite der folgende Code eingetragen werden: | ||
<!-- Alarmanlage Keypad --> | |||
<div data-type="popup" data-device="AAA.key" data-get-on="locked" data-get-off="unlocked" | <div data-type="popup" data-device="AAA.key" data-get-on="locked" data-get-off="unlocked" data-width="400px" data-height="500px" class="interlock"> | ||
<div class="red bold top-space-2x"/> | <div class="red bold top-space-2x"/> | ||
<div class="dialog"> | <div class="dialog"> | ||
Zeile 42: | Zeile 41: | ||
<div data-type="label" class="cell big top-space-2x wider">PIN-Code</div> | <div data-type="label" class="cell big top-space-2x wider">PIN-Code</div> | ||
<div class="inline big top-space"> | <div class="inline big top-space"> | ||
<div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="1" | <div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="1" onclick="">1</div> | ||
<div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="4" onclick="">4</div> | |||
<div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="4" | <div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="7" onclick="">7</div> | ||
<div data-type="push" data-icon="fa-long-arrow-left" data-device="AAA.key" data-set="key" data-set-on="&lt;" onclick=""/> | |||
<div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="7" | |||
<div data-type="push" data-icon="fa-long-arrow-left" data-device="AAA.key" | |||
</div> | </div> | ||
<div class="inline big"> | <div class="inline big"> | ||
<div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="2" | <div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="2" onclick="">2</div> | ||
<div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="5" onclick="">5</div> | |||
<div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="5" | <div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="8" onclick="">8</div> | ||
<div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="0" onclick="">0</div> | |||
<div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="8" | |||
<div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="0" | |||
</div> | </div> | ||
<div class="inline big"> | <div class="inline big"> | ||
<div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="3" | <div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="3" onclick="">3</div> | ||
<div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="6" onclick="">6</div> | |||
<div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="6" | <div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="9" onclick="">9</div> | ||
<div data-type="push" data-off-color="green" data-icon="fa-unlock" data-device="AAA.key" data-set="key" data-set-on="#" onclick=""/> | |||
<div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="9" | |||
<div data-type="push" data-off-color="green" data-icon="fa-unlock" data-device="AAA.key" | |||
</div> | </div> | ||
<div class="bg-lightgray border-white top-space centered" style="width:280px; height:50px;"> | <div class="bg-lightgray border-white top-space centered" style="width:280px; height:50px;"> |
Version vom 28. Februar 2018, 08:47 Uhr
Ziel und Voraussetzungen
Auf dieser Seite wird erläutert, wie man das Modul Alarm mit Hilfe eines Keypads aus dem FTUI heraus steuert.
Ziel ist, das TabletUI mit einem Keypad zu schützen während der Alarm aktiv ist und darüber hinaus über Eingabe des korrekten Pins die Alarmanlage zu entschärfen.
- Das Modul Alarm muss installiert sein, das Alarmdevice wird im Folgenden AAA genannt (ansonsten muss der entsprechende Name in den nachfolgenden Beispielen geändert werden)
- Es muss eine laufende TabletUI-Instanz vorhanden sein
1.Schritt: Anlegen eines Dummy
defmod AAA.key dummy attr AAA.key alarmDevice Sensor attr AAA.key alarmSettings alarm<alarmlevel>,|AAA.key:.unlocked|unlocked|off # wird durch das Modul Alarm angelegt attr AAA.key event-on-change-reading state,inputPin attr AAA.key event-on-update-reading key attr AAA.key readingList key,inputPin,fails,unlockPin attr AAA.key room Alarm attr AAA.key setList unlockPin attr AAA.key userReadings inputPin:key:.[0-9] { return ReadingsVal($NAME, "inputPin", "*") . ReadingsVal($NAME, "key", "0");; }, fails:key:.# { if (ReadingsVal($NAME, "inputPin", "0") ne ReadingsVal($NAME, "unlockPin", "0")) { return ReadingsVal($NAME, "fails", 0)+1;; } else { return 0;; } }, state:key:.# { if (ReadingsVal($NAME, "inputPin", "0") ne ReadingsVal($NAME, "unlockPin", "0")) { return "locked";; } else { return "unlocked";; } }, inputPin:key:.[\<] { my $inputVal = ReadingsVal($NAME, "inputPin", "0");; chop($inputVal);; return $inputVal;; }, inputPin:key:.# { return "";; }
Darin muss natürlich <alarmlevel> durch den gewünschten Level ersetzt werden (die Änderung dieses Attributes erfolgt automatisch durch das Alarm-Modul, bitte nicht manuell eingeben). In diesem Dummy kann über den Befehl
set unlockPin <Wert>
der gültige Pincode gesetzt werden
Die userReadings füllen (je nach Änderung des Readings key) die folgenden Readings:
- fails (Anzahl ungültiger Versuche)
- inputPin (Eingabe Pin, als Aneinanderreihung der einzelnen Keys)
- state (locked/unlocked)
2.Schritt: Anlegen eines Notify
Wenn der richtige Code eingegeben wurde, soll die Alarmanlage unscharf geschaltet werden:
defmod AAA.disarmed.N notify AAA.key:unlocked set AAA disarmed <alarmlevel> attr AAA.disarmed.N room Alarm
3.Schritt: Einbinden des Keypads in das FTUI
Dazu muss in die anzuzeigende Seite der folgende Code eingetragen werden:
<!-- Alarmanlage Keypad --> <div data-type="popup" data-device="AAA.key" data-get-on="locked" data-get-off="unlocked" data-width="400px" data-height="500px" class="interlock"> <div class="red bold top-space-2x"/> <div class="dialog"> <header>Alarm deaktivieren</header> <div data-type="label" class="cell big top-space-2x wider">PIN-Code</div> <div class="inline big top-space"> <div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="1" onclick="">1</div> <div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="4" onclick="">4</div> <div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="7" onclick="">7</div> <div data-type="push" data-icon="fa-long-arrow-left" data-device="AAA.key" data-set="key" data-set-on="<" onclick=""/> </div> <div class="inline big"> <div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="2" onclick="">2</div> <div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="5" onclick="">5</div> <div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="8" onclick="">8</div> <div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="0" onclick="">0</div> </div> <div class="inline big"> <div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="3" onclick="">3</div> <div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="6" onclick="">6</div> <div data-type="push" data-icon="" data-device="AAA.key" data-set="key" data-set-on="9" onclick="">9</div> <div data-type="push" data-off-color="green" data-icon="fa-unlock" data-device="AAA.key" data-set="key" data-set-on="#" onclick=""/> </div> <div class="bg-lightgray border-white top-space centered" style="width:280px; height:50px;"> <div data-type="label" data-device="AAA.key" data-get="inputPin" class="tall"/> </div> </div> </div>