natcl / node-red-contrib-streamdeck

A Node-RED node to interact with the Elgato Stream Deck products
Apache License 2.0
13 stars 4 forks source link

Installing on macOS Big Sur #11

Closed mountaindude closed 2 years ago

mountaindude commented 2 years ago

Has anyone had any luck using these nodes on macOS?

natcl commented 2 years ago

It did work for me although I didn't try with Big Sur yet, will give it a try. What errors are you getting ?

mountaindude commented 2 years ago

Meh, me bad. Long day. Sure, I am using a mac, but running Node-RED in a Docker container. So it's some flavour of Linux in that Docker image.

Seems to be node-hid that's causing issues, will see if I can bring it in via Node-RED's functionGlobalContext or similar. Guess I could run Node-RED native too... But containers are just so much cleaner when it comes to upgrading etc.

2021-09-24T13:07:03.111Z Install : node-red-contrib-streamdeck 1.0.2

2021-09-24T13:07:03.183Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-streamdeck@1.0.2
2021-09-24T13:08:17.513Z [out] 
2021-09-24T13:08:17.513Z [out] > node-hid@2.1.1 install /data/node_modules/node-hid
2021-09-24T13:08:17.513Z [out] > prebuild-install --runtime napi || node-gyp rebuild
2021-09-24T13:08:17.513Z [out] 
2021-09-24T13:08:18.899Z [err] prebuild-install 
2021-09-24T13:08:18.900Z [err] WARN install No prebuilt binaries found (target=3 runtime=napi arch=x64 libc=musl platform=linux)
2021-09-24T13:08:21.743Z [err] /bin/sh: pkg-config: not found
2021-09-24T13:08:21.743Z [err] gyp: Call to 'pkg-config libusb-1.0 --cflags-only-I | sed s/-I//g' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
2021-09-24T13:08:21.762Z [err] gyp ERR! configure error 
2021-09-24T13:08:21.763Z [err] gyp
2021-09-24T13:08:21.764Z [err]  ERR! 
2021-09-24T13:08:21.764Z [err] stack Error: `gyp` failed with exit code: 1
2021-09-24T13:08:21.764Z [err] gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
2021-09-24T13:08:21.764Z [err] gyp ERR! stack
2021-09-24T13:08:21.764Z [err]      at ChildProcess.emit (events.js:375:28)
2021-09-24T13:08:21.764Z [err] gyp ERR! 
2021-09-24T13:08:21.764Z [err] stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
2021-09-24T13:08:21.765Z [err] gyp ERR! System
2021-09-24T13:08:21.766Z [err]  Linux 5.10.47-linuxkit
2021-09-24T13:08:21.766Z [err] gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
2021-09-24T13:08:21.766Z [err] gyp ERR! cwd /data/node_modules/node-hid
2021-09-24T13:08:21.766Z [err] gyp ERR! node -v v14.17.3
2021-09-24T13:08:21.766Z [err] gyp ERR! node-gyp -v v5.1.0
2021-09-24T13:08:21.766Z [err] gyp ERR! not ok 
2021-09-24T13:08:22.364Z [err] npm 
2021-09-24T13:08:22.365Z [err] ERR! code ELIFECYCLE
2021-09-24T13:08:22.365Z [err] npm ERR! errno 1
2021-09-24T13:08:22.369Z [err] npm ERR! node-hid@2.1.1 install: `prebuild-install --runtime napi || node-gyp rebuild`
2021-09-24T13:08:22.369Z [err] npm ERR! Exit status 1
2021-09-24T13:08:22.369Z [err] npm ERR! 
2021-09-24T13:08:22.369Z [err] npm ERR! Failed at the node-hid@2.1.1 install script.
2021-09-24T13:08:22.369Z [err] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-09-24T13:08:22.414Z [err] 
2021-09-24T13:08:22.415Z [err] npm ERR! A complete log of this run can be found in:
2021-09-24T13:08:22.415Z [err] npm ERR!     /data/.npm/_logs/2021-09-24T13_08_22_394Z-debug.log
natcl commented 2 years ago

Hmm I'm not sure that'll be possible using Docker unless Docker for Mac has some passthrough for the hardware HID devices...

mountaindude commented 2 years ago

True. Testing a native install instead, the node installs fine, but still won't be recognised. Permissions?

You have these node working on macOS, correct?

24 Sep 17:48:17 - [info] Starting flows
Error opening Stream Deck device TypeError: cannot open device with path IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/XHC1@14/XHC1@14000000/HS07@14600000/Stream Deck XL@14600000/IOUSBHostInterface@0/AppleUserUSBHostHIDDevice
    at new HID (/Users/goran/.node-red/node_modules/node-hid/nodehid.js:49:17)
    at new StreamDeckBase (/Users/goran/.node-red/node_modules/elgato-stream-deck/dist/models/base.js:13:23)
    at new StreamDeckGen2Base (/Users/goran/.node-red/node_modules/elgato-stream-deck/dist/models/base-gen2.js:10:1)
    at new StreamDeckXL (/Users/goran/.node-red/node_modules/elgato-stream-deck/dist/models/xl.js:16:9)
    at openStreamDeck (/Users/goran/.node-red/node_modules/elgato-stream-deck/dist/index.js:79:12)
    at streamDeckInit (/Users/goran/.node-red/node_modules/node-red-contrib-streamdeck/streamdeck.js:9:22)
    at new StreamDeckIn (/Users/goran/.node-red/node_modules/node-red-contrib-streamdeck/streamdeck.js:25:5)
    at Object.createNode (/Users/goran/.nvm/versions/node/v14.17.6/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/util.js:86:27)
    at Flow.start (/Users/goran/.nvm/versions/node/v14.17.6/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:205:48)
    at start (/Users/goran/.nvm/versions/node/v14.17.6/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/index.js:371:33)
24 Sep 17:48:17 - [info] Started flows
natcl commented 2 years ago

Yes it works for me under OS X, did you try using sudo ? Also which version of Node is installed ?

mountaindude commented 2 years ago

yup, tried running Node-RED with and without sudo. Using node 14.17.6.

Ahhh... think I know what's going on. I had the Stream Deck config tool running when starting Node-RED. So the deck was already taken/used by the config tool. Exiting that tool, then restarting Node-RED made NR recognise the deck.

So it seems the first app to connect to the stream deck captures it, preventing other apps from accessing the deck. Which is pretty much how USB works in most cases..

mountaindude commented 2 years ago

That's a bummer though, I was kind of hoping to use the regular features of the deck and use NR to control a single sub-page of the keys (use as status indicators for various monitored metrics).

Looks like you've got to choose though - use the Stream Deck either with Node-RED or in the standard way (with Elgato's tool), but not both at the same time.

mountaindude commented 2 years ago

Maybe it's possible to create a plugin for Elgato's tool and have that plugin act as a proxy for the messages coming from/going to Node-RED.. Should be doable.

natcl commented 2 years ago

Sadly yes.... You can easily send button commands (via http requests) from the stream deck software to Node-RED but there's no way now to control the Elgato software from Node-RED. A plugin could work, last time I checked their SDK was quite terrible though :/

mountaindude commented 2 years ago

Yeah I took a quick look at it looks like it could use some love. Oh well, maybe it will be a late-night project for the coming months. Anyways - thanks for your feedback/help.