Closed GogoVega closed 2 years ago
Hello and welcome!
Yes this is possible but a little bit hidden. Have a dig into the messages coming from your homekit nodes. You are looking for msg.hap.session
- if this exists, the command originated within apple's ecosystem (home app, siri, automation from homekit, etc) ... if this doesn't exist then the message is a pass-through message from some input.
A hint to see it: put a debug node on "complete message object" instead of just the default "msg.payload"
Some more reading on this available on our wiki here: https://nrchkb.github.io/wiki/introduction/output-messages/
Thank you for your reply. Something like that in function node
?
var Write = parseInt((msg.payload.On) ? 1 : 0);
if (msg.hap.session != undefined) { msg.WRITE = Write; }else{ msg = null; } return msg;
Yes!
You could even put the return inside the if statement... something like this:
if (msg.hap.session) {
// Do stuff if it's from homekit
return msg;
} else {
// Do different stuff if it's not from homekit
return;
}
Thank you so much.
No problem! I will let you try it out.
Feel free to come back here if you have more questions about this topic.
In a couple of days I'll assume you're all set and close this issue
Hello, that's all good for me. You can close the discussion, I have no more questions. Thanks again for your work.
Your Current NRCHKB Plugin Version
1.4.2
Operating System
Raspberry Pi 3
What is your idea?
Hello, first of all thank you for your work! Next, is there a way to differentiate between the state change of node input and application? One output would be the commands coming from the Home app and another output would be the commands coming from the input of the node. Example of a lamp : I am using a node which reads the value of an address on the PLC and transmits the msg {Active: true or false} to the homekit node to know the state of my lamp in Home app. At the exit of the node I have another node which writes the value on the PLC. If I turn on / off from the Home app, I have no problems but if I do it from the pushbutton (in my room)connected to the PLC , the node will detect the change and "re-write" the value to the plc. Re-write because the first came from the pushbutton and the second from node-red. I hope I was clear. Thanks for your answers.
Any more details?
If this is specific to some hardware or specific software version, please explain here.
Additional comments?
Additional comments here, if any.
Any code or functions to add?
No response