My node-red + HomeKit + OpenHAB setup

As I understand this setup doesn’t work for cameras…

Here’s some information - feel free to look through it, I’d be interested if you get this working…

I have read this topic with great interest.
I would like to use node-red + homekit for the first time
Installed on Raspberry + Openhab + Node-red, everything is ok

I installed node-red-contrib-homekit-bridged via Manage Palette, but I see a red triangle.
The service homekit-service and homekit-bridge are not green.
image
Who can help me ?

I’ve never seen this error but it seems like you might already have homekit installed in node red. It’s available from various developers - take a look at your “installed nodes” in the manage pallete screen to see if HomeKit is in there.

Also check your available nodes in case homekit is there and ready to use.

I had to reinstall everything, now it works
Openhab 2.4.0M5 + Node-red + node-red-contrib-homekit-bridged + Bindings Openwebnet
Node-Red … one word … fantastic !!!

Some questions :

  • How do I update my homekit after a change in the flow?
  • How do I create a button node (open Gate or garage pulse gate ON, after OFF)?
  • How to change name and pin code homekit?

Just hit “deploy” in nodered. See discussion above explaining “deploy all” vs “deploy modified flows”. Also HomeKit in node red has a few bugs, if it’s acting funny try:

sudo systemctl restart nodered.service

There should be plenty of ways to accomplish this, I don’t know your hardware setup so I can’t give specifics. If I understand right, you’re new to both openhab and nodered - I would recommend looking through openhab documentation about items, rules and bindings. If you want to do it on the nodered side you can check out the delay and trigger nodes.

A couple of examples - I use the expire binding for a switch that I only ever want “on” for 1 second. I use tasmota software to send “pulses” to a couple of relays attached to an esp8266. I’m sure there is no shortage of ways to accomplish a pulse button press on many pieces of hardware.

This is in your configuration node for homekit. Normally hidden, check in your hamburger menu (top right) to show configuration nodes.

Thanks for the tips

Questions:

  • You have an example of a timed light, it turns on and after 1 minute it goes out
    In node-red I failed in the rules of openhab yes

  • I used a Door node for Homekit, it works. Is there a parameter code (Characteristic Properties) to disable the notification without manually deactivating the ios app?

  • In node-red can you define the rooms that are broadcast in the app Home?

Thank you

After a reboot I no longer have the hap homekit on ios
I tried to delete Home on ios to create it but nothing, ios does not find.
I tried to restart the node-red servos but nothing.

sudo systemctl restart nodered.service

Welcome to Node-RED
===================

19 Nov 13:39:16 - [info] Node-RED version: v0.19.5
19 Nov 13:39:16 - [info] Node.js  version: v8.12.0
19 Nov 13:39:16 - [info] Linux 4.14.79-v7+ arm LE
19 Nov 13:39:17 - [info] Loading palette nodes
19 Nov 13:39:21 - [info] Settings file  : /home/openhabian/.node-red/settings.js
19 Nov 13:39:21 - [info] Context store  : 'default' [module=memory]
19 Nov 13:39:21 - [info] User directory : /home/openhabian/.node-red
19 Nov 13:39:21 - [warn] Projects disabled : editorTheme.projects.enabled=false
19 Nov 13:39:21 - [info] Flows file     : /home/openhabian/.node-red/flows_openHABianPi.json
19 Nov 13:39:21 - [info] Server now running at http://127.0.0.1:1880/
19 Nov 13:39:21 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

19 Nov 13:39:21 - [info] Starting flows
19 Nov 13:39:21 - [info] [openhab2-controller:Openhab] {"id":"c289d816.ca63a8","type":"openhab2-controller","z":"","name":"Openhab","protocol":"http","host":"localhost","port":"8080","path":"","username":"","password":"","_users":["9fde074c.779ea8","4f5ed617.c7efc8","696ea511.41f1dc","f0ed7363.ba51a","b92ad4a2.fee898","39ce4a43.52b2f6","3d89a64b.5aa31a","3a7b866e.15615a","7313525b.7fc0cc","b5f07847.1e3e68","3b85aacf.27aa56","f568eaff.48f2c8","7cd2b1b4.e4b15","b248573.2cd67a8","3a30013a.3abf1e","c2534b95.2677a8"]}
19 Nov 13:39:21 - [info] Started flows
  EventedHTTPServer Server listening on port 9124 +0ms
19 Nov 13:39:26 - [info] [openhab2-controller:Openhab] getStateOfItems : config = {"id":"c289d816.ca63a8","type":"openhab2-controller","z":"","name":"Openhab","protocol":"http","host":"localhost","port":"8080","path":"","username":"","password":"","_users":["9fde074c.779ea8","4f5ed617.c7efc8","696ea511.41f1dc","f0ed7363.ba51a","b92ad4a2.fee898","39ce4a43.52b2f6","3d89a64b.5aa31a","3a7b866e.15615a","7313525b.7fc0cc","b5f07847.1e3e68","3b85aacf.27aa56","f568eaff.48f2c8","7cd2b1b4.e4b15","b248573.2cd67a8","3a30013a.3abf1e","c2534b95.2677a8"]}
19 Nov 13:39:49 - [info] Stopping flows
19 Nov 13:39:49 - [info] [openhab2-controller:Openhab] close
19 Nov 13:39:49 - [info] [openhab2-in:Cucina] close
19 Nov 13:39:49 - [info] [openhab2-out:Cucina] close
19 Nov 13:39:49 - [info] [openhab2-in:Tapparella Sala] close
19 Nov 13:39:49 - [info] [openhab2-out:Tapparella Sala] close
19 Nov 13:39:49 - [info] [openhab2-in:Entrata] close
19 Nov 13:39:49 - [info] [openhab2-out:Entrata] close
19 Nov 13:39:49 - [info] [openhab2-in:Sala] close
19 Nov 13:39:49 - [info] [openhab2-out:Sala] close
19 Nov 13:39:49 - [info] [openhab2-out:Prova] close
19 Nov 13:39:49 - [info] [openhab2-in:Prova] close
19 Nov 13:39:49 - [info] [openhab2-out:Cancelletto] close
19 Nov 13:39:49 - [info] [openhab2-in:Cancelletto] close
19 Nov 13:39:49 - [info] [openhab2-out:Cancello] close
19 Nov 13:39:49 - [info] [openhab2-in:Cancello] close
19 Nov 13:39:49 - [info] [openhab2-out:Garage] close
19 Nov 13:39:49 - [info] [openhab2-in:Garage] close
19 Nov 13:39:49 - [info] Stopped flows
19 Nov 13:39:49 - [info] Starting flows
19 Nov 13:39:49 - [info] [openhab2-controller:Openhab] {"id":"c289d816.ca63a8","type":"openhab2-controller","z":"","name":"Openhab","protocol":"http","host":"localhost","port":"8080","path":"","username":"","password":"","_users":["9fde074c.779ea8","4f5ed617.c7efc8","696ea511.41f1dc","f0ed7363.ba51a","b92ad4a2.fee898","39ce4a43.52b2f6","3d89a64b.5aa31a","3a7b866e.15615a","7313525b.7fc0cc","b5f07847.1e3e68","3b85aacf.27aa56","f568eaff.48f2c8","7cd2b1b4.e4b15","b248573.2cd67a8","3a30013a.3abf1e","c2534b95.2677a8"]}
19 Nov 13:39:49 - [info] Started flows
19 Nov 13:39:49 - [red] Uncaught Exception:
19 Nov 13:39:49 - Error: listen EADDRINUSE :::9124
    at Server.setupListenHandle [as _listen2] (net.js:1360:14)
    at listenInCluster (net.js:1401:12)
    at Server.listen (net.js:1485:7)
    at EventedHTTPServer.listen (/home/openhabian/.node-red/node_modules/hap-nodejs/lib/util/eventedhttp.js:60:19)
    at HAPServer.listen (/home/openhabian/.node-red/node_modules/hap-nodejs/lib/HAPServer.js:158:20)
    at Accessory.publish (/home/openhabian/.node-red/node_modules/hap-nodejs/lib/Accessory.js:607:16)
    at new HAPServiceNode (/home/openhabian/.node-red/node_modules/node-red-contrib-homekit/homekit.js:79:17)
    at createNode (/usr/lib/node_modules/node-red/red/runtime/nodes/flows/Flow.js:305:18)
    at Flow.start (/usr/lib/node_modules/node-red/red/runtime/nodes/flows/Flow.js:89:35)
    at start (/usr/lib/node_modules/node-red/red/runtime/nodes/flows/index.js:328:29)

Some idea

The port specified for HomeKit is in use. Try using a different port.

I solved the problem like this:

  • deleted all the flow
  • destroy
  • built-in node-red-contrib-homekit-bridged
  • installed node-red-contrib-homekit-bridged
  • imported flow

I set port 9124
Or better not to set any door?

Mine is set to automatic (no port specified). It can cause problems like this. If not specified, Node-RED will add a port which is not in use (dynamic port).

@rkrisi

Thanks for the suggestion, I immediately remove the door
Do you have any suggestions for my post 41?

I would just do this in an openHab rule. You mean when you turn on via a switch, it should turn off after 1 min? If yes, create a proxy switch, expose it to HomeKit and create a rule like this in openHab:

rule "Turn on auto lamp"
when
     Item HomeKit_ProxyLight changed to ON
then
      your_light.sendCommand(ON)
end

If you don’t know how to turn off a light after a specified time, look for the Expire binding. If you do it like this, you also have to send a command ON to the timer.

I can’t really understand this. Also I’m not using the Door node because it is for motorized doors. Do you have a motorized door, or you just want to view the state on a Contact sensor?

I don’t think you can specify or view (take actions) from the Rooms specified in Home app. It just a view in iOS, which seems internal for me.

Yes motorized door

If it’s there then when you press the Home icon in the app (left top) there is a sensor section where you can turn ON/OFF notifications for each sensor.

Yes in Home iOs seen …
I was wondering if there was a code in node-red to disable the notifications …

No - notifications are only changeable in homekit. I have to disable mine on my phone, iPad, and computer separately.

This is much easier with the openhab expire binding. Just search paper UI bindings for expire and add it.
Expire binding

Could probably also accomplish this with a trigger node in nodered.

No again this is a homekit setting.

Hi Garrett!

So after your advice on my other thread, I’ve been digging around node-red.
Still trying to get my head around it, but what you’ve posted here really helps, so thank you!

In you final comments you mention using Homekit’s presence detection to report back to OpenHAB, that’s really interesting, but I’ve been unable to figure out how to do it.
Also trying to use the “Break:Homekit” tip to see what’s available but I’m doing something wrong. Can you elaborate on these, or post some code?

Thank you!

For this one I have “dummy switches” in my homekit setup. I have one for myself and one for if anyone is home the HOMEKIT rules are like this set as follows:

  • When the first person gets home → turn “anyone home” on
  • When the last person leaves → turn “anyone home” off
  • When Garrett gets home → turn “Garrett Home” on
  • When Garrett leaves → turn “Garrett Home” off

These are linked to switches in openhab which I then use to check rules with “if” statements. if garrettHome.state == "ON".

For your other question, I think you’re missing some quotes. The input into the homekit node needs to be "word":"word" - you put quotes around the whole thing - the : needs to be between the two sets of quotes. There should be an error in the debug tab of nodered explaining available options.

Hi,
is it possible to have a Homekit “Switch” ( Stand alone ) for e.g triggering a timer?
06

Tried this and get the following error every time i tab on the switch-icon in Homekit
52