DOIF *Ich blicke es scheinbar nicht*

Begonnen von SVBE, 02 September 2016, 14:27:52

Vorheriges Thema - Nächstes Thema

SVBE

Servus zusammen,

nachdem ich nun einige Dinge probiert habe und viel gesucht habe, stelle ich hier mal mein Problem vor...

Mir fehlt leider das Programmierwissen...

Ich habe mir des Zwave Zipato RFID Reader gekauft. (Höheres Ziel ist es damit das gesamte Haus abschließen zu können und die Alarmanlage zu schalten...)

Leider liefert mir das Gerät nur folgende bei Stati zurück:

AccessControl: Keypad Lock Operation, arg 0101
AccessControl: Keypad Unlock Operation, arg 0101

Diese werde einmal unter reading "alarm" angezeigt und einmal im internal "State"

Wenn ich nun versuche über das DOIF Modul einen Dummy zuschalten wird immer nur Kommando 2 ausgeführt. Warum? :o :o :o


define Alarm_Status DOIF (["Keypad:&state"] eq "AccessControl: Keypad Lock Operation, arg 0101") (set Alarm_Sven on) DOELSE (set Alarm_Sven off)

versucht habe ich auch noch:

define Alarm_Status DOIF (["Keypad:&state"] eq "AccessControl: Keypad Lock Operation, arg 0101") (set Alarm_Sven on) DOELSEIF (["Keypad:&state"] eq "AccessControl: Keypad Unlock Operation, arg 0101") (set Alarm_Sven off)

define Alarm_Status DOIF (["Keypad"] eq "AccessControl: Keypad Lock Operation, arg 0101") (set Alarm_Sven on) DOELSEIF (["Keypad"] eq "AccessControl: Keypad Unlock Operation, arg 0101") (set Alarm_Sven off)

define Alarm_Status DOIF (["Keypad:alarm"] eq "AccessControl: Keypad Lock Operation, arg 0101") (set Alarm_Sven on) DOELSEIF (["Keypad:alarm"] eq "AccessControl: Keypad Unlock Operation, arg 0101") (set Alarm_Sven off)

define Alarm_Status DOIF (["Keypad"] =~ "Lock") (set Alarm_Sven on) DOELSE (set Alarm_Sven off)

usw.

Alle Varianten bringe ich nicht mehr zusammen... Nicht jede hat auch funktioniert ;-)

Vielen Dank schon mal für Eure Hilfe.


Grüße
Sven

--------------------------------------------------------
FHEM auf Raspberry
ZWAVE, DUOFERN und Homematic Funktionen: Elektro Fußbodenheizung, Rollladensteuerung, Anwesenheitsüberwachung, Alarmanlage, Lichtsteuerung
Danke an das großartige Forum!
Planung: NUKI, Homematic IP, OSRAM Lightify

kumue

Wenn du in den Event monitor schaust, welche Events vom Keypad werden da geloggt ?

Ellert

Bitte setze Deinen Code in Code Tags dann wird er lesbarer.

FHEM macht einen Unterschied zwischen Gross,- u. Kleinschreibung, das ["Keypad:&state"] bezieht sich auf ein Internal und das wird "STATE" geschrieben.

ZitatWenn ich nun versuche über das DOIF Modul einen Dummy zuschalten wird immer nur Kommando 2 ausgeführt. Warum?
Es wird der DOELSE-Zweig ausgeführt, weil die Bedingung unwahr ist.

SVBE

Der Event Monitor schreibt folgendes:

2016-09-02_11:55:12 Keypad alarm: AccessControl:  Keypad Unlock Operation, arg 0101
2016-09-02_11:55:50 Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101
2016-09-02_12:01:45 Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101
2016-09-02_12:27:13 Keypad alarm: AccessControl:  Keypad Unlock Operation, arg 0101
2016-09-02_12:31:16 Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101
2016-09-02_13:30:18 Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101
2016-09-02_13:31:51 Keypad alarm: AccessControl:  Keypad Unlock Operation, arg 0101
2016-09-02_13:33:31 Keypad alarm: AccessControl:  Keypad Unlock Operation, arg 0101
2016-09-02_13:34:43 Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101
2016-09-02_13:35:21 Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101
2016-09-02_13:40:04 Keypad alarm: AccessControl:  Keypad Unlock Operation, arg 0101
2016-09-02_13:40:26 Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101
2016-09-02_13:40:51 Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101
2016-09-02_13:42:05 Keypad alarm: AccessControl:  Keypad Unlock Operation, arg 0101
2016-09-02_13:44:20 Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101
2016-09-02_13:45:12 Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101
2016-09-02_14:03:30 Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101
2016-09-02_14:04:31 Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101
2016-09-02_14:05:19 Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101
2016-09-02_14:06:11 Keypad alarm: AccessControl:  Keypad Unlock Operation, arg 0101
2016-09-02_14:08:40 Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101
2016-09-02_14:09:02 Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101
2016-09-02_14:14:33 Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101
2016-09-02_14:17:37 Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101

Wobei das arg 0101 auf die einzelnen RFID Chips zurück führt....

Das mit der Gross,- und Kleinschreibung habe ich auch versucht leider hat dies auch keine Besserung gebracht.


define Alarm_Status DOIF (["Keypad"] =~ "Lock") (set Alarm_Sven on) DOELSE (set Alarm_Sven off)

define Alarm_Status DOIF (["Keypad"] eq "AccessControl: Keypad Lock Operation, arg 0101") (set Alarm_Sven on) DOELSEIF (["Keypad"] eq "AccessControl: Keypad Unlock Operation, arg 0101") (set Alarm_Sven off)

Ist das mit Code Tag gemeint?
--------------------------------------------------------
FHEM auf Raspberry
ZWAVE, DUOFERN und Homematic Funktionen: Elektro Fußbodenheizung, Rollladensteuerung, Anwesenheitsüberwachung, Alarmanlage, Lichtsteuerung
Danke an das großartige Forum!
Planung: NUKI, Homematic IP, OSRAM Lightify

Ellert

ZitatDas mit der Gross,- und Kleinschreibung habe ich auch versucht leider hat dies auch keine Besserung gebracht.

Es war auch mehr ein allgemeiner Hinweis.

ZitatIst das mit Code Tag gemeint?

Ja, und für Zitate ist der Button rechts daneben.

Zwave verwende ich nicht und ich habe auch keine Ahnung welche Readings es dort gibt. Die Events sehen irgendwie komisch aus. Bei mir haben sie folgende Struktur:

Zeitstempel Modulname Gerätename Readingname: Wert

Diese Struktur finde ich bei Dir nicht wieder.

Daher poste mal ein Listing des Zwave-Gerätes mit list Gerätename damit ich mal sehe welche Readings es gibt.


SVBE

 :)

Listing:


Internals:
   DEF        f1a1cbd8 9
   IODev      ZWAVE1
   LASTInputDev ZWAVE1
   MSGCNT     47
   NAME       Keypad
   NR         126
   STATE      AccessControl:  Keypad Lock Operation, arg 0101
   TYPE       ZWave
   ZWAVE1_MSGCNT 47
   ZWAVE1_RAWMSG 00040009028407
   ZWAVE1_TIME 2016-09-02 14:25:21
   ZWaveSubDevice no
   homeId     f1a1cbd8
   isWakeUp   1
   lastMsgSent 1472819123.54843
   nodeIdHex  09
   Readings:
     2016-09-02 14:17:37   alarm           AccessControl:  Keypad Lock Operation, arg 0101
     2016-08-30 13:23:44   assocGroup_1    Max 5 Nodes ZWAVE1
     2016-08-30 13:23:43   assocGroups     1
     2016-08-30 13:32:21   battery         100 %
     2016-08-30 13:32:22   configFeedbackBeepsPerSecond 2
     2016-08-30 13:32:22   configFeedbackTime 15
     2016-08-30 13:32:22   configFeedbackTimeout 0
     2016-08-30 13:32:22   configSetToDefault 170
     2016-08-30 13:32:22   configTheMode   Mode1NormalOperatingMode
     2016-08-30 13:22:31   model           Schlage Link Mini Keypad RFID
     2016-08-30 13:22:31   modelConfig     schlagelink/minikeypad.xml
     2016-08-30 13:22:31   modelId         0097-6131-4501
     2016-09-02 13:42:06   reportedState   off
     2016-09-02 13:42:06   state           off
     2016-09-02 14:25:23   timeToAck       0.053
     2016-09-02 14:25:23   transmit        OK
     2016-08-30 14:56:20   userCode        id 0 status 0 code 32323334310000000000
     2016-09-02 14:25:21   wakeup          notification
Attributes:
   IODev      ZWAVE1
   alarmDevice Sensor
   classes    ASSOCIATION BATTERY WAKE_UP VERSION MANUFACTURER_SPECIFIC ALARM CONFIGURATION SWITCH_BINARY USER_CODE
   event-on-update-reading alarm
   room       ZWave
   stateFormat alarm
   vclasses   ALARM:2 ASSOCIATION:1 BATTERY:1 CONFIGURATION:1 MANUFACTURER_SPECIFIC:2 SWITCH_BINARY:1 USER_CODE:1 VERSION:1 WAKE_UP:1
   verbose    4


Ich hoffe das hilft Dir...


--------------------------------------------------------
FHEM auf Raspberry
ZWAVE, DUOFERN und Homematic Funktionen: Elektro Fußbodenheizung, Rollladensteuerung, Anwesenheitsüberwachung, Alarmanlage, Lichtsteuerung
Danke an das großartige Forum!
Planung: NUKI, Homematic IP, OSRAM Lightify

kumue

...entsprechend
http://fhem.de/commandref_DE.html#DOIF_Ereignissteuerung_ueber_Auswertung_von_Events
würde ich
(["^Keypad$:Lock"]) (set Alarm_Sven on) DOELSEIF (["^Keypad$:Unlock"]) (set Alarm_Sven off)
probieren.

Trigger auf Devices, die genau Keypad heißen und Lock bzw. Unlock im Event beinhalten.

SVBE

Gerade versucht, leider keine Besserung. Jetzt reagiert DOIF gar nicht auf eine Änderung des Status (Lock oder Unlock)


Internals:
   DEF        (["^Keypad$:Lock"]) (set Alarm_Sven on) DOELSEIF (["^Keypad$:Unlock"]) (set Alarm_Sven off)
   NAME       Alarm_Status
   NR         140
   NTFY_ORDER 50-Alarm_Status
   STATE      initialized
   TYPE       DOIF
   Readings:
     2016-09-03 10:43:55   cmd             0
     2016-09-03 10:43:55   state           initialized
   Condition:
     0          EventDoIf('^Keypad$',$hash,'Lock',0)
     1          EventDoIf('^Keypad$',$hash,'Unlock',0)
   Devices:
   Do:
     0:
       0          set Alarm_Sven on
     1:
       0          set Alarm_Sven off
   Helper:
     globalinit 1
     last_timer 0
     sleeptimer -1
   Itimer:
   Regexp:
     0:
       0          ^Keypad$:Lock
     1:
       0          ^Keypad$:Unlock
     All:
       0          ^Keypad$:Lock
       1          ^Keypad$:Unlock
   State:
Attributes:


Grüße
Sven
--------------------------------------------------------
FHEM auf Raspberry
ZWAVE, DUOFERN und Homematic Funktionen: Elektro Fußbodenheizung, Rollladensteuerung, Anwesenheitsüberwachung, Alarmanlage, Lichtsteuerung
Danke an das großartige Forum!
Planung: NUKI, Homematic IP, OSRAM Lightify

Ellert

Zitat von: SVBE am 03 September 2016, 10:48:13
Gerade versucht, leider keine Besserung. Jetzt reagiert DOIF gar nicht auf eine Änderung des Status (Lock oder Unlock)


Internals:
   DEF        (["^Keypad$:Lock"]) (set Alarm_Sven on) DOELSEIF (["^Keypad$:Unlock"]) (set Alarm_Sven off)
   NAME       Alarm_Status
   NR         140
   NTFY_ORDER 50-Alarm_Status
   STATE      initialized
   TYPE       DOIF
   Readings:
     2016-09-03 10:43:55   cmd             0
     2016-09-03 10:43:55   state           initialized
   Condition:
     0          EventDoIf('^Keypad$',$hash,'Lock',0)
     1          EventDoIf('^Keypad$',$hash,'Unlock',0)
   Devices:
   Do:
     0:
       0          set Alarm_Sven on
     1:
       0          set Alarm_Sven off
   Helper:
     globalinit 1
     last_timer 0
     sleeptimer -1
   Itimer:
   Regexp:
     0:
       0          ^Keypad$:Lock
     1:
       0          ^Keypad$:Unlock
     All:
       0          ^Keypad$:Lock
       1          ^Keypad$:Unlock
   State:
Attributes:


Grüße
Sven

Gab es denn zwischen 10:43:55 und 10:48:13 Events, die hätten triggern müssen?

SVBE

ich habe es :)

der Hinweis mit dem Eventmonitor war sehr hilfreich... scheinbar hat das Keypad heute
nach Nacht die Verbindung verloren...

VIELEN DANK!

Eine Frage noch wo schreibt man den am Besten seine Befehle? Ich schreibe die momentan in Notepad++ und kopiere
die Zeile anschließend in die Befehlseingabezeile... So richtig schön sieht das aber nicht aus.

--------------------------------------------------------
FHEM auf Raspberry
ZWAVE, DUOFERN und Homematic Funktionen: Elektro Fußbodenheizung, Rollladensteuerung, Anwesenheitsüberwachung, Alarmanlage, Lichtsteuerung
Danke an das großartige Forum!
Planung: NUKI, Homematic IP, OSRAM Lightify

SVBE

ok gleich den nächsten Test gemacht... wieder Fehler...


Ich möchte nun das er auf das komplette Event reagiert damit ich eine Unterscheidung machen kann wer den Alarm deaktiviert hat...

AccessControl: Keypad Lock Operation, arg 0101

die Unterscheidung ist nur bei "arg0101" zusehen deshalb brauche ich das gesamte Event.

(["^Keypad$:AccessControl: Keypad Lock Operation, arg 0101"]) (set Alarm_Sven on) DOELSEIF (["^Keypad$:AccessControl: Keypad Unlock Operation, arg 0101"]) (set Alarm_Sven off)

Das hab ich mal versucht.

Eventmonitor:


2016-09-03 11:51:06 ZWave Keypad alarm: AccessControl:  Keypad Lock Operation, arg 0101
2016-09-03 11:51:19 ZWave Keypad alarm: AccessControl:  Keypad Unlock Operation, arg 0101
2016-09-03 11:51:19 HMLAN HMLAN1 loadLvl: low



Listing:
Internals:
   DEF        (["^Keypad$:AccessControl: Keypad Lock Operation, arg 0101"]) (set Alarm_Sven on) DOELSEIF (["^Keypad$:AccessControl: Keypad Unlock Operation, arg 0101"]) (set Alarm_Sven off)
   NAME       Alarm_Status
   NR         140
   NTFY_ORDER 50-Alarm_Status
   STATE      initialized
   TYPE       DOIF
   Readings:
     2016-09-03 11:46:16   cmd             0
     2016-09-03 11:46:16   state           initialized
   Condition:
     0          EventDoIf('^Keypad$',$hash,'AccessControl: Keypad Lock Operation, arg 0101',0)
     1          EventDoIf('^Keypad$',$hash,'AccessControl: Keypad Unlock Operation, arg 0101',0)
   Devices:
   Do:
     0:
       0          set Alarm_Sven on
     1:
       0          set Alarm_Sven off
   Helper:
     globalinit 1
     last_timer 0
     sleeptimer -1
   Itimer:
   Regexp:
     0:
       0          ^Keypad$:AccessControl: Keypad Lock Operation, arg 0101
     1:
       0          ^Keypad$:AccessControl: Keypad Unlock Operation, arg 0101
     All:
       0          ^Keypad$:AccessControl: Keypad Lock Operation, arg 0101
       1          ^Keypad$:AccessControl: Keypad Unlock Operation, arg 0101
   State:
Attributes:


--------------------------------------------------------
FHEM auf Raspberry
ZWAVE, DUOFERN und Homematic Funktionen: Elektro Fußbodenheizung, Rollladensteuerung, Anwesenheitsüberwachung, Alarmanlage, Lichtsteuerung
Danke an das großartige Forum!
Planung: NUKI, Homematic IP, OSRAM Lightify

Ellert

ZitatAccessControl:  Keypad
im Event sind 2 Leerzeichen:
Du könntest die Regex verkürzen auf
["^Keypad$:.*Lock.*0101"]

ZitatEine Frage noch wo schreibt man den am Besten seine Befehle?

siehe:DOIF: Tips leichtere Bedienung Syntaxhervorhebung Klammerprüfung Suchen&Ersetzen

SVBE

Vielen Dank! :-)

.* steht also für beliebig viele Zeichen.

--------------------------------------------------------
FHEM auf Raspberry
ZWAVE, DUOFERN und Homematic Funktionen: Elektro Fußbodenheizung, Rollladensteuerung, Anwesenheitsüberwachung, Alarmanlage, Lichtsteuerung
Danke an das großartige Forum!
Planung: NUKI, Homematic IP, OSRAM Lightify

Ellert

Ja, der Punkt steht für ein beliebiges Zeichen und der Stern steht für eine beliebige Wiederholung des vorstehenden Zeichen, genaueres siehe hier