Bridge Openhab to HA

Hello folks is there a way to bridge openhab items to HA so one can access their items on HA. Note node red openhab pallet doesn’t really work for me. I was thinking if there is an easy way to convert my items to mqtt dimmers and switches?

With mqtt v1 it was via the mqtt event bus. With mqtt v2 I believe you can doing it by publishing commands

If HA means Home Assistant you are on the wrong forum. Their forum should better answer your question.
I know there are many people like me who moved to OpenHAB from Home Assistant and found it superior.

I have posted there too, personally I think the best case scenario is to be able to run both platforms parallel to each other. Some integrations run better on Openhab and some better on HomeAssistnat. However, there is no solid solution to bridge these two platform together.

On OH side I have not encountered any such ‘need’ to connect a technology through HA (or FWIW any other home automation controller).
That’s horribly inefficient to run two complex systems und developers know that, that’s why I guess no such bridge exist.
It’s like a company to have two CEOs. You can make it work somehow but it just doesn’t work out.

2 Likes

What integrations run better on HA? Unlike HA where one person has the ultimate decision on features, this is more community driven with contributors from all over the world. There are no paid developers. All are volunteers.

If somebody wants a new binding and they are not a developer it is usually recommended to set up a bounty on bountysource to encourage a developer to work on it.

The main complaint here would be the free myopenhab cloud server. The non-profit Foundation cannot charge for services so they have had to remove the featire to add Items for IFTT because people were adding all their Items and overloading the server.

Unlike HA though, the cloud server is freely available so you can host your own server. I think they would like somebody to host a server and charge others for access but nobody has done that yet

When I considered moving to OH, the skilled Z-Wave binding developer was right there helping be to get all my devices properly discovered and working.

Unlike HA, users here can add new devices to the Z-Wave database and usually have the update available to use within a week. I even spent several months improving database entries in appreciation for the awesome work here.

1 Like

This shows how to set up an MQTT event bus using the 2.5 binding using both Rules DSL or Scripted Automation.

The MQTT binding also supports automatic discovery of devices that follow the HA MQTT standard, though I don’t know if that is of any help here.

To the rest, I share a lot of your opinions. I have the same opinion for those who use Node Red instead of the Rules engine and Node Red is even part of openHABian. But everyone has their own requirements and needs. If running OH and HA solves this user’s needs, I don’t think it is our place to withhold help on the OH side at least. The OP is not unique in running both.

4 Likes

Defintely not unique…It was so easy for me to reply to this with a way forward, as it is exactly as I run. OpenHAB has it’s strengths and so does Home Assistant and for that matter node-red, Home Assistants AppDaemon and Homebridge.

Thank you so much for your understanding. This is exactly what I need. To be able to receive the status of my items on ongoing bases on node red. Trying to subscribe to event bus using html didn’t work for me on node red. But I am sure mqtt is very promising.

It really depends, if you manage the same devices or services by both platforms, that is definitely inefficient. In my case the CEO of my company is Node Red. Openhab is one of my department managers and Home assistant is the other manager. The only thing is it takes more resources to run both platforms on one device and if someone can avoid it. I highly recommend it. But it is not really the case for me.

Well HA also functions some what the same. There is a separate company that offers paid cloud services call NabuCasa and they sponsor HA by hiring a dedicated programmer to develop the platform. This is in addition of free solutions such as IFTTT or duckdns. Anyone in HA can contribute in developing integration however the approval process for it to show as official integration i heard is lengthy due to the scrutiny and testing it has to go through. But still user have access and can add unofficial custom integrations and test them before they become official through custom integration store.

Putting requirements and needs aside, sometimes it’s just a case of doing something because you feel like seeing how it turns out. Particularly if it’s a hobby.

@fxcoolby, I’d suggest that we not get into a debate about the merits of OH and HA and their respective approaches. Suffice to say that if you want help figuring out the OH side, the folks here are very willing to assist! :wink:

Completely agree, I wasn’t trying to getting into a debate just wanted to explain my situation. :grinning:

1 Like

I thank you in advance for your help. So I have tired to implement your solution. I created and item file <bridge.item> and placed the group line there. I also created a rule file <bridge.rules> and only saved status rule in there since I am only interested in the status of my items. Going to my things page on paper UI I retrieved the mqtt broker id mqtt:broker:… image
and replaced it with the one in the status rule. However subscribing to openHAB-main/out/ topic from node red doesn’t produce any output. Am I missing something?

or perhaps can we modify the output rule so it publish the status to a HTTP post instead of MQTT?

Update: apparently no rule is running I have set up a rule where if one of my lights turn on the other one is also turns on but didn’t work. Please note this is my first time ever creating rules in openhab. Here is my rule:

rule "Publish to NodeRed"
when
    Member of PubItems received update
then
    //sendHttpPostRequest(String "http://192.168.1.12:1880/endpoint/oh/items/status", String "text", String "Testing")
    sendCommand(String mainpatio, String "ON")
    //val mqttActions = getActions("mqtt","mqtt:broker:mqttbroker")
    //mqttActions.publishMQTT("OH/out/"+triggeringItem.name+"/state",triggeringItem.state.toString)
end

Here is my item file:

Group:String PubItems
Switch frontyard "Front Yard" { insteonplm="4A.92.80:0x000045#broadcastonoff,group=9"}
Switch backface "Back Face" { insteonplm="4A.92.80:0x000045#broadcastonoff,group=0x19"}
Switch basement "Basement" { insteonplm="4A.92.80:0x000045#broadcastonoff,group=0x18"}
Switch sidegarden "Side Garden" { insteonplm="4A.92.80:0x000045#broadcastonoff,group=0x1A"}
Switch midbalcony "Middle Baclcony" { insteonplm="4A.92.80:0x000045#broadcastonoff,group=0x20"}
Switch stairs "Stairs" { insteonplm="4A.92.80:0x000045#broadcastonoff,group=0x21"}
Switch mainpatio "Main Patio" { insteonplm="4A.92.80:0x000045#broadcastonoff,group=0x22"}
Switch nightlight "Night Light" { insteonplm="46.80.0A:F00.00.1A#switch"}
Dimmer familyroom "Family Room" { insteonplm="49.65.68:F00.00.01#dimmer"}
Switch garage "Garage" { insteonplm="3B.DE.F5:F00.00.1A#switch"}
Switch garagedoor "Garage Door" {insteonplm="39.5D.C0:0x00001A#switch", autoupdate="false"}

Now I know in home assitant for your scripts to take affect you have to restart HA is this the case here in Openhab?

The rules should start running as soon as you load them.

If you tail -f /var/log/openhab2/openhab.log you’ll see entries as your rule file is loaded, checked and deployed.

With really useful errors if needed.

That said, I’m still curious why the openHAB.v2 NodeRed nodes aren’t working for you.
I’ve setup multiple systems and never had an issue with it.

I’m happy for you to connect to my demo rig to test with.

If NodeRed is your overlord, then those openHAB nodes would be your easiest way forward.

No, OH automatically sees and loads them. But perhaps you are not putting them in the right folder? Maybe there is a fatal syntax error? What do you see in openhab.log when you save the .rules files?

1 Like

Not really. If you create automations via the Automation Editor, they are available immediately. If you create them using a text editor, you need to click ‘Reload Automations’. Restarting Home Assistant is not required.

To your original point, I currently run three home automation systems and use MQTT to integrate them (for about two years now).

  1. The system I’ve used since 2008 is Premise. It continues to be used for running automation logic and integrating, what some may now call, “legacy” devices. However, its user-interface is outdated and, compared to modern UI’s, difficult to modify and maintain. That’s where openHAB came into the picture.

  2. I added openHAB to serve as the new UI for Premise, to leverage its many bindings, and to provide secure remote-access. The two systems communicate via MQTT. After about 6 months of use, I transitioned to Home Assistant because I preferred its Lovelace UI (and the way it models devices). Eventually I will be decommissioning my openHAB server.

  3. I’m now using Home Assistant to serve as the UI for Premise and to leverage its many integrations, especially its support for HomeKit (both to expose existing non-HomeKit devices as HomeKit accessories and to communicate directly with native HomeKit accessories).

I also use Node-Red for miscellaneous purposes. It runs on the openHAB server (openhabian).

Regarding which one is better than the other, I too feel that depends on one’s requirements. Both are highly capable home automation solutions. Sometimes the choice is not a matter of functional superiority but ‘comfort and familiarity’. I found aspects of HA to be more in line with my years of experience with Premise, so it was a more natural fit for me. For others, openHAB may be the better fit.

FWIW, I’m not using MQTT discovery. For each object in Premise, I manually defined a matching item in openHAB and matching entity in Home Assistant. For the benefit of other Premise users, I created an export function, from Premise objects to openHAB items, to save them time. When it came time to export from Premise to Home Assistant, I skipped creating an export function and just defined them manually.

Good luck with integrating your systems.


EDIT
Fixed typos.

1 Like