NRCHKB / node-red-contrib-homekit-bridged

Node-RED Contribution - HomeKit Bridged : Node-RED nodes to simulate Apple HomeKit devices.
https://nrchkb.github.io
MIT License
412 stars 52 forks source link

[Feature]: Block Input Message #464

Closed BigBang0502 closed 2 years ago

BigBang0502 commented 2 years ago

Your Current NRCHKB Plugin Version

No response

Operating System

No response

What is your idea?

Hey guys, thanks for the great work. I still have one wish. Currently, the incoming messages are passed through, can you please create a possibility here that these adjustable do not go through, or at the output one of the node only what goes out if you send something via IOS and at output two just everything always goes through? Background: more than one visualization is running. Means currently if, for example, the brightness value of a lamp changes somewhere in the system, this is passed on.

Any more details?

No response

Additional comments?

No response

Any code or functions to add?

No response

djiwondee commented 2 years ago

@BigBang0502

can you please create a possibility here that these adjustable do not go through

As far as I understood, the feature is available since a long time. On bridge level you have the option:

image

Which should be enabled by default. With that any message provided on input is passed through the output

On the output you can deal with the hap.session payload:

image

On output no. 1 the msg.hap.session payload is not null, if an interaction took place initiated by the home app. If the message is provided by an input message msg.hap.sessionis not set.

On output no. 2 the input message is always passed through.

@Shaquu will probably explain this from his perspective much better...

BigBang0502 commented 2 years ago

Thank you this was the trick

crxporter commented 2 years ago

If you want to do this inside a function node rather than with a switch node - it will look like this:

if('session' in msg.hap) {
    // message is NOT a pass-through
} else {
    // message is a pass-through
}

It's just checking for msg.hap.session which exists when the message originated from Home app.

Closing for now, feel free to reopen if more help is needed!