Homekit-bridged partially works, what am I missing here? [UPDATE]

#1

I'm new to node-red, but I like and I'm trying to move my home automation stuff to it from Home Assistant. And so..

I installed the node-red-contrib-homekit-bridged module, and I have it working enough that I can see an accessory in my Home app on iOS (it's a switch), and if I click it in the app it displays "on: true" or "on: false" below the node in the pallette. Awesome.

I want this switch to trigger a complex scene/automation/whatever, and I've wired a Hue bulb node to it for testing purposes. If I wire an inject node sending a boolean to the hue node I can turn the physical light on and off, so that much works. But I want to have the HomeKit node send the message to the hue node to turn on or off. Maybe I have a fundamental misunderstanding of how this is supposed to work -- but no messages are coming out of the HomeKit node with I click the switch in the app (despite the fact that the node is reporting a state change), so the bulb I've wired it's output to does nothing. I've wired a debug msg node to the same output on the HomeKit node, but nothing appears in the debug window when I click in the app. I've tried putting some jason ({"on": 1}) in the characteristics properties area, and in the output area of the node settings.. and a few other things.. but nothing gets a message out of the HomeKit node.

Some decent examples would help, but after lots of searching I really can't find any. Should I just do mqtt to homebridge and give up on the homekit-bridged module?

[UPDATE]

I found a tutorial that mentioned using the function node to debug messages, so I tried using it and I found the problem: the homekit node is capitalizing the keys, but the accessories (tested with Hue and LIFX bulbs) want lowercase keys, so in other words it's sending "On": true instead of "on":true. That's it. That's the problem.

So.. I don't want to have to add an extra node to adjust the message every single time I use one of these nodes, so I'm going to attempt to fork the code and fix it at the source, I guess.

0 Likes

#2

Why not discuss it with the author of the node to see if they would accept a pull request to have an option to “always make lower case”?

0 Likes

#3

Yeah, that's part of the process. I'm trying the other bridged homekit node module first to see if maybe it does the right thing first.

0 Likes

#4

Nope, it does the same thing :frowning:

0 Likes

#5

Because that is what is defined in the Homekit specification see https://github.com/KhaosT/HAP-NodeJS/blob/master/lib/gen/HomeKitTypes.js

1 Like

#6

Have a look here:

Characteristic.On also On not on

0 Likes

#7

Y'all are responding at the same speed I'm finding these things, lol.

Yeah, I'm not sure how this isn't causing problems for everyone else. I have a Hue bridge controlling a bunch of Hue and Ikea bulbs, and also an LIFX light. So I'm using a Hue module and an LIFX module, both of which have seen development in the past 6 months, both of which require lowercase for all the keys.

So, I'm not sure who's fault the lack of consistency. Perhaps I just happened to grab the only two accessory modules that use lowercase? In which case I should write to the Hue and LIFX module maintainers and mention that the homekit modules output uppercase, and would they like to switch, or what are they using, if anything, to talk to homekit stuff. In the meantime I need to either edit both modules (fork, pull request, etc.) and/or create a transformer node to copy around all over the place as I create flows. I'm guessing figuring out how to create a custom node is going to be easier than figuring out how to package an edited npm module and successfully get it to install, so that's probably what I'll do for now. I wish there was a way to contact several project owners at once on GitHub to say "hey, y'all's stuff should totally work together but it totally doesn't because of this one small thing".

0 Likes