[Neues Modul] Elgato Stream Deck Modul

Begonnen von blecher-at, 11 Dezember 2017, 13:21:08

Vorheriges Thema - Nächstes Thema

MaxKnall

#15
Hallo zusammen,

ich habe mir ein Stream Deck zugelegt mit der Hoffnung, mein FHEM darüber steuern zu können. Das ganze soll an einem Raspberry 4 betrieben werden auf dem auch meine FHEM-Instanz läuft.
Ich hänge jetzt allerdings an der Einrichtung von deinem Modul. Bzw. mein FHEM hängt, wenn ich ein Redraw in FHEM anstoße.
Anmerkung: Gleiches Verhalten wenn nur das Stream Deck am USB hängt deswegen hier die Belegung mit Touchscreen USB und Logitech USB Dongle:

HID Belegung:
hidraw0          G2Touch Multi-Touch by G2TSP
hidraw1          G2Touch Multi-Touch by G2TSP
hidraw2          Logitech USB Receiver
hidraw3          Logitech K400
hidraw4          Elgato Stream Deck MK.2


Berechtigungen über eine UDEV Rule angepasst und fhem der Gruppe plugdev hinzugefügt:

cat /etc/udev/rules.d/70-streamdeck.rules
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", GROUP="plugdev"


ls -al /dev/hidraw*
crw-rw-r-- 1 root plugdev 243, 0 Jan  5 02:21 /dev/hidraw0
crw-rw-r-- 1 root plugdev 243, 1 Jan  5 02:21 /dev/hidraw1
crw-rw-r-- 1 root plugdev 243, 2 Jan  5 02:25 /dev/hidraw2
crw-rw-r-- 1 root plugdev 243, 3 Jan  5 02:25 /dev/hidraw3
crw-rw-r-- 1 root plugdev 243, 4 Jan  5 13:32 /dev/hidraw4


Status wechselt auf opened sobald die Berechtigungen gesetzt sind aber eine Steuerung ist nicht möglich.

List vom Streamdeck Device:

Internals:
   DEF        /dev/hidraw4
   DeviceName /dev/hidraw4@directio
   FD         14
   FUUID      61d4cf85-f33f-c1c7-ad2d-df29de00fd1ece03
   NAME       STREAMDECK_HUB
   NR         93
   PARTIAL   
   STATE      opened
   TYPE       STREAMDECK
   brightnesslevel 80
   file       /dev/hidraw4
   opened     1
   page       root
   READINGS:
     2022-01-05 13:37:38   state           opened
Attributes:
   brightness 80
   room       STREAM DECK


Kannst du mir eventuell noch einen Tipp geben, was ich noch probieren kann?

blecher-at

Hallo.

Offenbar gibt es eine neue version vom Streamdeck (v2). Keine Ahnung ob die vom Protokoll her noch kompatibel ist. Das Modul wurde nur mit der v1 getestet.
poste mir mal den output von
"lsusb -v -d 0fd9:"

sowie deine fhem.cfg mit den relevanten geräten.
logfile mit verbose auf 5 gestellt wäre auch interessant.

MaxKnall

#17
Hi blecher-at,

danke für die schnelle Antwort  :)

lsusb -v -d 0fd9:

Bus 001 Device 005: ID 0fd9:0080 Elgato Systems GmbH
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x0fd9 Elgato Systems GmbH
  idProduct          0x0080
  bcdDevice            2.00
  iManufacturer           1
  iProduct                2
  iSerial                 3
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0029
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     177
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               1


Die 2 Config Zeilen am Anfang habe ich übernommen aus deiner Beispielconfig bei der Fehlersuche, danach die 2 Devices für Stream Deck und eine Taste:


attr global autoload_undefined_devices 1
attr WEB csrfToken none

define STREAMDECK_HUB STREAMDECK /dev/hidraw4
setuuid STREAMDECK_HUB 61d4cf85-f33f-c1c7-ad2d-df29de00fd1ece03
attr STREAMDECK_HUB brightness 80
attr STREAMDECK_HUB room STREAM DECK
define STREAMDECK_KEY5 STREAMDECK_KEY STREAMDECK_HUB 5
setuuid STREAMDECK_KEY5 61d4d305-f33f-c1c7-89ed-5d472289362dd68b
attr STREAMDECK_KEY5 image device:Schreibtisch resize:48x48 rotate:0
attr STREAMDECK_KEY5 room STREAM DECK
attr STREAMDECK_KEY5 svgfill {(Value("Schreibtisch") eq "on" ?"yellow":"grey")}
define STREAMDECK_KEY5_N notify STREAMDECK_KEY5.*pressed set Schreibtisch toggle
setuuid STREAMDECK_KEY5_N 61d4d357-f33f-c1c7-3fc4-21cde8f446aefede
attr STREAMDECK_KEY5_N room STREAM DECK


Logfile mit verbose 5 liefere ich noch nach. Ich brauche erstmal einen Kaffee bevor es mit der Bastelei weitergeht  ;)

edit:
Programmierkenntnisse sind vorhanden, wenn ich unterstützen kann dein Modul mit der MK.2 Version kompatibel zu machen falls es wirklich daran liegen sollte.

Gruß Chris

MaxKnall

#18
Ich habe jetzt mal STREAMDECK_HUB auf verbose 5 gestellt. Aber mehr als das taucht leider nicht im log auf:

2022.01.06 13:41:32 3: STREAMDECK: STREAMDECK_HUB Initialization
2022.01.06 13:41:32 1: /dev/hidraw0 reappeared (STREAMDECK_HUB)
2022.01.06 13:41:58 5: Set brightness to 0% rc:12
2022.01.06 13:41:59 5: Set brightness to 80% rc:12


edit:
Also ich habe jetzt zuerst einmal alle Keys angelegt - FHEM wartet auf die Response der Keys (die aber noch nicht angelegt waren außer KEY 5 und ist blockiert:

2022.01.06 13:54:25 5: Setting STREAMDECK_HUB image...
2022.01.06 13:54:25 5: Writing STREAMDECK_HUB image to streamdeck key 1...
2022.01.06 13:54:25 1: PERL WARNING: Use of uninitialized value $FW_wname in hash element at ./FHEM/10_STREAMDECK_KEY.pm line 187, <$fh> line 762.
2022.01.06 13:54:25 1: PERL WARNING: Use of uninitialized value $FW_cname in hash element at ./FHEM/01_FHEMWEB.pm line 816, <$fh> line 762.
2022.01.06 13:54:25 1: PERL WARNING: Use of uninitialized value $d in hash element at fhem.pl line 4682, <$fh> line 762.
2022.01.06 13:54:25 1: PERL WARNING: Use of uninitialized value $FW_ME in regexp compilation at ./FHEM/01_FHEMWEB.pm line 826, <$fh> line 762.
2022.01.06 13:54:25 1: PERL WARNING: Use of uninitialized value $FW_ME in regexp compilation at ./FHEM/01_FHEMWEB.pm line 834, <$fh> line 762.
2022.01.06 13:54:25 1: PERL WARNING: Use of uninitialized value $FW_wname in concatenation (.) or string at ./FHEM/01_FHEMWEB.pm line 837, <$fh> line 762.
2022.01.06 13:54:25 1: NOTE:  is probed by a search engine
2022.01.06 13:54:40 5: Setting image... done
2022.01.06 13:54:40 5: Setting STREAMDECK_HUB image...
2022.01.06 13:54:56 5: Writing STREAMDECK_HUB image to streamdeck key 2...
2022.01.06 13:55:16 5: Setting image... done
2022.01.06 13:55:16 5: Setting STREAMDECK_HUB image...
2022.01.06 13:55:16 5: Writing STREAMDECK_HUB image to streamdeck key 3...
2022.01.06 13:55:36 5: Setting image... done
2022.01.06 13:55:36 5: Setting STREAMDECK_HUB image...
2022.01.06 13:55:36 5: Writing STREAMDECK_HUB image to streamdeck key 4...
2022.01.06 13:55:56 5: Setting image... done
2022.01.06 13:55:56 5: Setting STREAMDECK_HUB image...
2022.01.06 13:55:56 5: Writing STREAMDECK_HUB image to streamdeck key 6...
2022.01.06 13:56:16 5: Setting image... done
2022.01.06 13:56:16 5: Setting STREAMDECK_HUB image...
2022.01.06 13:56:16 5: Writing STREAMDECK_HUB image to streamdeck key 7...
2022.01.06 13:56:36 5: Setting image... done
2022.01.06 13:56:36 5: Setting STREAMDECK_HUB image...
2022.01.06 13:56:36 5: Writing STREAMDECK_HUB image to streamdeck key 8...
2022.01.06 13:56:56 5: Setting image... done
2022.01.06 13:56:56 5: Setting STREAMDECK_HUB image...
2022.01.06 13:56:56 5: Writing STREAMDECK_HUB image to streamdeck key 9...
2022.01.06 13:57:17 5: Setting image... done
2022.01.06 13:57:17 5: Setting STREAMDECK_HUB image...
2022.01.06 13:57:17 5: Writing STREAMDECK_HUB image to streamdeck key 10...
2022.01.06 13:57:37 5: Setting image... done
2022.01.06 13:57:37 5: Setting STREAMDECK_HUB image...
2022.01.06 13:57:37 5: Writing STREAMDECK_HUB image to streamdeck key 11...
2022.01.06 13:57:57 5: Setting image... done
2022.01.06 13:57:57 5: Setting STREAMDECK_HUB image...
2022.01.06 13:57:57 5: Writing STREAMDECK_HUB image to streamdeck key 12...
2022.01.06 13:58:17 5: Setting image... done
2022.01.06 13:58:17 5: Setting STREAMDECK_HUB image...
2022.01.06 13:58:17 5: Writing STREAMDECK_HUB image to streamdeck key 13...
2022.01.06 13:58:37 5: Setting image... done
2022.01.06 13:58:37 5: Setting STREAMDECK_HUB image...
2022.01.06 13:58:37 5: Writing STREAMDECK_HUB image to streamdeck key 14...
2022.01.06 13:58:57 5: Setting image... done
2022.01.06 13:58:57 5: Setting STREAMDECK_HUB image...
2022.01.06 13:58:57 5: Writing STREAMDECK_HUB image to streamdeck key 15...


Beim Tastendruck erscheint dann:

2022.01.06 14:05:47 5: STREAMDECK_READ
2022.01.06 14:05:47 3: STREAMDECK_Read unexpected length read: '01000f0001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' 512


edit2: Bufferlength habe ich mal auf 512 angepasst - Tastendruck kommt in FHEM an aber die Nummerierung ist falsch. Ich hangel mich mal an einer Taste weiter durch  ;)

edit 3: Ich bin zumindest ein bisschen weiter gekommen. Brightness setzen funktioniert und die Tasten sind richtig gemappt. Leider kann ich noch keine Images senden.

blecher-at

Das sieht für mich so aus als hat sich das bitmap-format geändert das das streamdeck v2 erwartet. Ich habe damals mit dem windows tool "usblyzer" die kommunikation der nativen app von elgato mitgetraced und es damit herausgefunden, das müsstest du auch tun und die funktion STREAMDECK_SendImage entsprechend anpassen. vielleicht hast du auch glück und das format ist gleich, aber die puffergrößen sind anders, das wäre dann eine simple Änderung.

blecher-at


MaxKnall

Hallo,

bei dieser lib habe ich mich bedient um die Brightness anzupassen und das Key Mapping zu korrigieren.
Der Umbau von SendImage ist für mich ein bisschen aufwändiger (bin kein Perl Spezi) weshalb das erstmal pausieren muss. Ich bin aktuell noch am Einrichten der Wohnung und da muss die Bastelei hinten angestellt werden ;)

sTaN

Hallo Zusammen,

ich überlege auch gerade ein Stream Deck MK2 zu kaufen und plane den Betrieb an meiner CaDigit TS3 Dockingstation. Dort schließe ich tagsüber meinen Arbeitsrechner (Windows) und außerhalb der Arbeit mein privates Macbook an. Primär würde ich also die Elgato Software nutzen wollen, um zahlreiche Workflows während der Arbeit aber auch privat abzubilden. (Aufruf diverser Programme etc.)

Ich würde aber auch gern bestimmte FHEM Befehle oder Alexa Routinen nutzen wollen.
Gibt es hier die Möglichkeit über die Elgato Software mit zum Beispiel Hotkeys in FHEM Befehle abzusetzen? Schalten von Routinen/Strukturen etc. oder muss hierfür zwingend das Stream Deck am RPi (wo fhem läuft) angeschlossen werden und man verliert damit die Nutzung an der Docking also den PC's?

Grüße
sTaN
Raspberry Pi 3
2 x CUL CC1101-USB-Lite 868MHz
FS20 Komponenten, Philips HUE, Alexa-Fhem, MAX! Geräte, homebridge, harmony, Unifi, FirtzBox, MQTT, Aurora, Denon, Sonos, TabletUI, CALENDAR, EGPM2LAN, Pushover