[SOLVED] Controlling Linux client with MQTT (or other possibilities)

I just clicked on your profile and saw you also use HomeKit…

If you come to like node red, it has a homekit bridge node that has now become my go-to for all devices homekit. I have my light switches, dimmers, outlets, curtains, fans, and sprinklers all linked between openhab and homekit with node red. It works MUCH better than anything I’ve ever tried with openhab’s homekit functionality.

As a bonus - all of these items show as their proper device type in homekit! I used to call my window a “switch”…

I’m happy to share my setup, feel free to flag me in another topic if you’d like to see any of it.

Thanks, this seems really cool! I have had several problems with HomeKit (you can see it in my profile, I was the one who started the “No response” error). However it now works okay, all devices are light switches. I don’t have any specific devices yet (like roller shutter), but it would be great to have specific device types.
So you expose your items to Node-RED and that takes care of HomeKit?

It’s a more complicated setup than your exec node above. The “flow” in node red goes like this:

-Starts with an openhab node (locally or on local network)
-Goes to a javascript function node to “translate” commands from openhab terms to homekit homes
-Goes into a homekit node
-Next is another function to “translate” from homekit back to openhab
-Finally goes back to openhab (in the case you command an item from homekit)

Then you’ll add a homekit bridge on your home app pointed at node red and be running. My bridge has about 50 devices right now (oh I forgot my smoke detector earlier! It’s wired to a pi GPIO pin). I’ve had no errors or issues with this setup in the past few months.

I went to this setup because I had issues with my dimmers sending “double commands” which is another common complaint of the openhab/homekit integration.

Honestly node red has made many of my rules much easier for me to set up. I still have tons of rules and items in openhab - but node red is becoming my choice more and more often…

I would like to learn more. Getting a atv 4k will it work ?

Yeah let’s not hijack this thread too much - start a new one and I’ll show you how I use my ATV (4 and 4k) like this.

Thanks, I’m also interested in it.

Thank you. Then back to node red controll. If i have a ads1115 that gets anolg from sensors can i also do it this way aswell.to send the info to openHAB?

What’s the ADS1115 plugged in to?

If it’s plugged into a pi then yes there’s a node-red plugin for it (under “manage pallet”).

If it’s connected to something that runs MQTT (publish the ADS1115 data to MQTT) then again, yes - just pull the data off MQTT topics and send it into OpenHAB.

I don’t have that hardware but it appears to be supported in node-red.

Thanks!

I have already tried out the mqtt with exec… it seems working I can send commands as string and it will execute!

1 Like

If you have time, I’m more interested in the HomeKit flow you have :slight_smile: How you can choose which elements are should be exposed to HomeKit, how you transform the item from openHab into HomeKit, you you deploy inputs from HomeKit to openHab, etc…

Ps.: I have already installed the OH and HomeKit extension for Node-RED, I will migrate everything if I have time (thus I will have more item, because I can include things which I was unable before). You have this flow for every item you have exposed to HomeKit or can you make it ‘general’ for similar items?

You’re hooked. I like it. I’ll to put together some examples for you.

The way homekit works is you connect a bridge to your phone then add devices in node red that all point to that bridge. Similar to how your mqtt nodes point to your mqtt broker.

Give me a bit, I need to add comments to some code. I’ll pick one of each item type I have - should be a good addition to the forums.

Yes, it is similar in OH HomeKit addon, first you have to add a ‘Bridge’.
Thanks, I’m really waiting for it :slight_smile: Yes I’m hooked I already love this thing. Setting up to control through mqtt and even get responses on different topics took me 10 minutes or so…

And seeing in the HomeKit addon that I can add my AirPurifier and other things to HomeKit and have it more stable is what I’m waiting for :slight_smile: Anyway if you could include in the example, where you can find that which device type accepts what kind of data (for example.: Air Quality Sensor accepts Number formats? Air Purifier accepts ON/OFF switch or also a Number with the RPM?)

Thank you!

Hint for seeing what is available for any item:

Make an inject node that looks like this and send it right into a homekit item:

Then check out the “debug” in node-red where it will list all items available for that item (air purifier for your example).

This will make more sense in a little bit when I get my examples loaded.

…standby…

I have just changed a couple of pi-zeros from python scripts to node-red. Easy to maintain. Reliable…

Good idea…

2 Likes

Here’s one of each of my item types.

I actually am at 50 HomeKit items in node red these days…

The ads1115 is connected to the pi via i2c

So yes - go to “manage pallet” in node-red on that pi and search for ads1115.

This is the result I get - I can’t try it but you should be able to install this flow in node-red and be running pretty quick.

the other question . would I be able to read rs 485 and send the information to my MQTT and then to openHAB . this is the unit I am looking at .

Seems like yes? Node-red can read serial input/output on a pi. You’d only be limited on your ability to program node-red to read the data.

You’ll need the “Serial” input node in node-red.

I don’t have any serial devices so I’d be useless in figuring that out. The node-red forums may be a good place to start - just have to find someone who has used one of those devices…

Thank you alot.

Regards
Allen