Wie kann ich auf langen Tastendruck reagieren?

Begonnen von stenny73, 02 Februar 2014, 12:44:33

Vorheriges Thema - Nächstes Thema

stenny73

Hallo

Ich habe einen KeyMatic Sender den ich über einen HM-USB abfrage.

Jetzt möchte ich auf kurzes und langes drücken aktoren nutzen.

Wenn ich jedoch mit
define Test1l dummy
attr Test1l group test
attr Test1l room CUL_HM
attr Test1l webCmd toggle

define KeyMatic_Taste3_L notify Key_1:Btn2.offLong.* \
{if (Value("Test1l") eq "on"){fhem "set Test1l off"} \
else \
{fhem "set Test1l on"} \
}
attr KeyMatic_Taste3_L group test
attr KeyMatic_Taste3_L room CUL_HM


benutze wechselt es durchgehend zwischen on und off.
Im EventMonitor sehe ich

2014-02-02 12:37:48 dummy Test1l off
2014-02-02 12:37:48 CUL_HM Key_1 offLong 1-8440- (to A1B46C)
2014-02-02 12:37:48 CUL_HM Key_1 trigger: Long_20
2014-02-02 12:37:48 CUL_HM Key_1 battery: ok
2014-02-02 12:37:48 CUL_HM Key_1 Btn2 offLong 1-8440- (to A1B46C)
2014-02-02 12:37:48 dummy Test1l on
2014-02-02 12:37:48 CUL_HM Key_1 offLong 2-8440- (to A1B46C)
2014-02-02 12:37:48 CUL_HM Key_1 trigger: Long_20
2014-02-02 12:37:48 CUL_HM Key_1 battery: ok
2014-02-02 12:37:48 CUL_HM Key_1 Btn2 offLong 2-8440- (to A1B46C)
2014-02-02 12:37:48 dummy Test1l off
2014-02-02 12:37:48 CUL_HM Key_1 offLong 3-8440- (to A1B46C)
2014-02-02 12:37:48 CUL_HM Key_1 trigger: Long_20
2014-02-02 12:37:48 CUL_HM Key_1 battery: ok
2014-02-02 12:37:48 CUL_HM Key_1 Btn2 offLong 3-8440- (to A1B46C)
2014-02-02 12:37:49 dummy Test1l on
2014-02-02 12:37:49 CUL_HM Key_1 offLong 4-8440- (to A1B46C)
2014-02-02 12:37:49 CUL_HM Key_1 trigger: Long_20
2014-02-02 12:37:49 CUL_HM Key_1 battery: ok
2014-02-02 12:37:49 CUL_HM Key_1 Btn2 offLong 4-8440- (to A1B46C)
2014-02-02 12:37:49 dummy Test1l off
2014-02-02 12:37:49 CUL_HM Key_1 offLong 5-8440- (to A1B46C)
2014-02-02 12:37:49 CUL_HM Key_1 trigger: Long_20
2014-02-02 12:37:49 CUL_HM Key_1 battery: ok
2014-02-02 12:37:49 CUL_HM Key_1 Btn2 offLong 5-8440- (to A1B46C)
2014-02-02 12:37:49 dummy Test1l on
2014-02-02 12:37:49 CUL_HM Key_1 offLong 6-8440- (to A1B46C)
2014-02-02 12:37:49 CUL_HM Key_1 trigger: Long_20
2014-02-02 12:37:49 CUL_HM Key_1 battery: ok
2014-02-02 12:37:49 CUL_HM Key_1 Btn2 offLong 6-8440- (to A1B46C)
2014-02-02 12:37:49 dummy Test1l off
2014-02-02 12:37:49 CUL_HM Key_1 offLong 7-8440- (to A1B46C)
2014-02-02 12:37:49 CUL_HM Key_1 trigger: Long_20
2014-02-02 12:37:49 CUL_HM Key_1 battery: ok
2014-02-02 12:37:49 CUL_HM Key_1 Btn2 offLong 7-8440- (to A1B46C)
2014-02-02 12:37:50 dummy Test1l on
2014-02-02 12:37:50 CUL_HM Key_1 offLong 8-A240- (to A1B46C)
2014-02-02 12:37:50 CUL_HM Key_1 trigger: Long_20
2014-02-02 12:37:50 CUL_HM Key_1 battery: ok
2014-02-02 12:37:50 CUL_HM Key_1 Btn2 offLong 8-A240- (to A1B46C)


Wie könnte ich das lösen?

stenny73
FHEM auf XEN, Ubuntu-Server 14.04   - HM-Lan - Max - ZWave -WS1080 -BlueTooth

FHEM auf Ubuntu-Server 14.04   - HM-LAN

FHEM auf Raspberry Pi   - CSM für Max - HM-USB - WiFi-LED

martinp876

Hi,

wie du siehst kommen
2014-02-02 12:37:48 CUL_HM Key_1 Btn2 offLong 1-8440- (to A1B46C)
2014-02-02 12:37:48 CUL_HM Key_1 Btn2 offLong 2-8440- (to A1B46C)
2014-02-02 12:37:48 CUL_HM Key_1 Btn2 offLong 3-8440- (to A1B46C)

da siehst du sicher, dass bei einem langen Tastendruck jede halbe sec ein trigger kommt und FHEM diese zählt. Also nutze immer den ersten

define KeyMatic_Taste3_L notify Key_1:Btn2.offLong.1.* \

generell wundere ich mich, warum die Buttons nicht als Kanäle definiert sind. Welches Device ist dies? Dann würden die trigger leicht anders aussehen

Gruss Martin

stenny73

#2
Das ist der Handsender vom KeyMatic

HM-RC-Key4-2
FHEM auf XEN, Ubuntu-Server 14.04   - HM-Lan - Max - ZWave -WS1080 -BlueTooth

FHEM auf Ubuntu-Server 14.04   - HM-LAN

FHEM auf Raspberry Pi   - CSM für Max - HM-USB - WiFi-LED

martinp876


stenny73

Deine ruckfrage kam schneller als ich per remote reinschauen konnte.....

HM-RC-Key4-2
FHEM auf XEN, Ubuntu-Server 14.04   - HM-Lan - Max - ZWave -WS1080 -BlueTooth

FHEM auf Ubuntu-Server 14.04   - HM-LAN

FHEM auf Raspberry Pi   - CSM für Max - HM-USB - WiFi-LED

stenny73

#5
Angelegt und umbenannt....


define Key_1 CUL_HM 24BE3B
attr Key_1 .devInfo 040000
attr Key_1 .stc 40
attr Key_1 IODev hmusb
attr Key_1 autoReadReg 4_reqStatus
attr Key_1 expert 2_full
attr Key_1 firmware 1.1
attr Key_1 model HM-RC-Key4-2
attr Key_1 peerIDs
attr Key_1 room 02-HomeMatic
attr Key_1 serialNr KEQ0855094
attr Key_1 subType remote
define FileLog_Key_1 FileLog ./log/Key_1-%Y.log Key_1
attr FileLog_Key_1 logtype text
attr FileLog_Key_1 room 98-Log
define Key_1_offen CUL_HM 24BE3B01
attr Key_1_offen model HM-RC-Key4-2
attr Key_1_offen peerIDs
attr Key_1_offen room 02-HomeMatic
define Key_1_zu CUL_HM 24BE3B02
attr Key_1_zu model HM-RC-Key4-2
attr Key_1_zu peerIDs
attr Key_1_zu room 02-HomeMatic
FHEM auf XEN, Ubuntu-Server 14.04   - HM-Lan - Max - ZWave -WS1080 -BlueTooth

FHEM auf Ubuntu-Server 14.04   - HM-LAN

FHEM auf Raspberry Pi   - CSM für Max - HM-USB - WiFi-LED

stenny73

Erstmal reagiere ich auf

define KeyMatic_Taste3_L notify Key_1:Btn2.offLong.1.2.*

stenny73
FHEM auf XEN, Ubuntu-Server 14.04   - HM-Lan - Max - ZWave -WS1080 -BlueTooth

FHEM auf Ubuntu-Server 14.04   - HM-LAN

FHEM auf Raspberry Pi   - CSM für Max - HM-USB - WiFi-LED

martinp876

warum nicht auf
Key_1_offen:Long
?
Dein Channel ist doch Key_1_offen, nicht Key_1:Btn2.off

stenny73

Hallo

Der KeyMatic hat 4 Tasten

Erste Taste ist Key_1_zu zum Schliessen des KeyMatic
Zweite Taste ist Key_1_offen zum Entriegeln (kurz drücken) und öffnen (lang drücken)

die 3te (CUL_HM Key_1 Btn2 offShort 1-8440) und 4te Taste (CUL_HM Key_1 Btn2 onShort) sind die ich frei nutzen kann
FHEM auf XEN, Ubuntu-Server 14.04   - HM-Lan - Max - ZWave -WS1080 -BlueTooth

FHEM auf Ubuntu-Server 14.04   - HM-LAN

FHEM auf Raspberry Pi   - CSM für Max - HM-USB - WiFi-LED

martinp876

die kannst du genauso definieren wir die ersten beiden. Mit namen, die dir gefallen

stenny73

Das mit den Namen und so ist klar.....

Wäre ggf nicht schlecht wenn man irgendwie auf z.b. das loslassen der Teaste reagieren kann
FHEM auf XEN, Ubuntu-Server 14.04   - HM-Lan - Max - ZWave -WS1080 -BlueTooth

FHEM auf Ubuntu-Server 14.04   - HM-LAN

FHEM auf Raspberry Pi   - CSM für Max - HM-USB - WiFi-LED

martinp876

sofern die Taste gepeert ist bekommst du ein "Release" - geht also. Nicht aber, wenn nicht gepeert ist!
Schalte "inform on ",peere und drücke.