Closed Supergiovane closed 2 years ago
@Supergiovane thanks for the input!
Look at our current msg:
{
"payload": {
"On": false
},
"hap": {
"session": {
"sessionID": "",
"username": "",
"remoteAddress": "",
"localAddress": "",
"httpPort": 123456
},
"context": {},
"allChars": {
"Name": "Bedroom Main Light Switch",
"On": false
},
"newValue": false
},
"name": "Bedroom Main Light Switch",
"topic": "",
"_msgid": "8daed9c20a34f5d3"
}
msg
. One as node-red value typed by user (msg.name
) and another is value from Characteristic (msg.hap.allChars.Name
) which is not mandatory.msg.hap
allChars
but got removedIn short, @Supergiovane if you could tell at each field separately why you need it? Maybe we can find easier solution not involving more code in nrchkb node and being just simplier?
Hi Yes, you are right, but... you must already know, what msg to pass to the node. In your sample, it's msg.payload.On.
Imagine that: 1) You put a service node into the flow. I cannot open that node to view their properties, so i don't know what service name you've set. It's a light? It's a contact sensor? I don't know.
If i send a random msg to your node, it simply throws a debug message. No msg is output to the flow. So i'm totally blind. I don't know what msg your node does accept.
So, i send msg.ident to it and... voilà... your node responds "Hey, i'm a lightbulb". Then, after knowing that your node is a lightbulb, i know i must pass msg.payload.on = true to lit the light.
I hope i'm clear now.
I’ll do in another way. Pull reuest closed
By passing msg.ident = true to a service node, it emits a list of useful properties. This is useful for the other linked node, to know the service name of the homekit node and to dinamically adapt the input/output property names of the flow msg.
Output from msg.ident = true: