I have Linux clients (Debian, Raspbian) and I want to turn their screen on and off from OH rule (maybe later shutdown, restart and other things can useful). How is this possible with the easiest approach?
I saw the there is a script for Windows to work as an MQTT client. Are there any similar thing for Linux? Or should I do it with the exec binding? If yes, how? The clients are in the same network, but every client is a seperate client, so it has to be done through network.
Install node red on the “remote” computer. Use instructions for windows, linux, mac, debian, raspberry pi - you name it from nodered.org.
Put an MQTT node and an exec node together. You’ll have to do a bit of configuring on the MQTT node - double click it to enter the IP address, authentication, etc. Default settings on the exec node should work for simple commands but you may have to tinker with the exec node configuration to get it just right. Looks like this:
Any string sent to that topic will be run in the command line.
I have another command line program (atvremote) that I use this way with a bit more code to watch the output of the exec node (runs in spawn mode) - then while the CLI program is running I get push updates from the apple TV to send back to openhab for all sorts of fun. More on that by special request.
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 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…
If you have time, I’m more interested in the HomeKit flow you have 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?