ybizeul / StreamDeckWS

A WebServices proxy to connect an Elgato Stream Deck to a Node-RED server
84 stars 11 forks source link

Cannot send event to different button from within a multi action #36

Open JackMoran1 opened 11 months ago

JackMoran1 commented 11 months ago

I have a WSProxy button inside a multi action and another outside of it on the same page. I want to send setImage to the button outside of my multi action button when pressing the multi action button. Any possible way to do this using node-red?

kenwarner commented 1 month ago

did you ever figure this out @JackMoran1? I'm interested in a similar scenario.

ybizeul commented 1 month ago

Or, soI was able to make it work.

In any case, you'll probably need the special nodes sd-input and sd-output from node-red-contrib-streamdeck-ws node-red plugin : https://github.com/ybizeul/StreamDeckWS/tree/main/Sources/node-red-contrib-streamdeck-ws

What it fixes for you is it caches the StreamDeck keys with their associated contexts.

A StreamDeck context is basically a reference generated by StreamDeck so it knows what device and key we're talking to

That way you're not limited to the context you know (sent by the current event) and you can use sd-output so send an event to any key, as long as node-red knows about it (i.e. it sent at least one event in the past, either while starting, or because the key has been pushed at some point).

I insist, because this is important : if you try to update your "outside" key but your StreamDeck initialized before node-red started or you never pushed that key, the node-red environment won't know how to address it.

So I recommend that during your test, you just push that key so node-red learns its context.

My test is, the function below :

const d = new Date()
msg = {"title": d.getSeconds().toString()}
return msg;

Sending to a sd-output node configured as : image

Let me know if you need further info