Have used openHAB for a number of years to control lights around my house and have them integrated with Alexa via HUE Emulation. (Great for those with mobility issues.)
Recently I had an HVAC issue which resulted in the purchase of new thermostats (Honeywell T6 Pro z-wave) had difficulty integrating with openHAB so I took a look at Home Assistant (HA).
It seems that to get the best of both worlds I will need to run both openHAB and HA.
I would like to control the devices associated with openHAB through the HA interface. It seems that MQTT is the likely solution.
Rather then reinventing the wheel I am looking for a simple step by step instructions or to be guided by a learned sage.
I have read a number posts and have set up mosquitto on both openHAB and HA.
On openHAB have set up mqtt thing, channels and have linked devices to them.
At this point I am unclear how to communicate between openHAB and HA or if I should have mosquitto on openHAB and both openHAB and HA publish and subscribe to it.
The Marketplace wasnât introduced until June of 2021 which puts it past OH 3.0. Youâll need to upgrade to at least 3.2 (I think) though you may as well upgrade to 3.4.
Yep⊠after a re-read I discovered I need 3.2 or newer. I will need to make a updated clone of my openHAB before I update to a newer version of openHAB.
Going to read over the information you provided a few times before I âexperimentâ anymore.
I do have one other questions.
From a command line on HA I am attempting to turn on light on openHAB with the following command:
Iâm no expert, but if you are sending state from HA to:
I donât think your linked item (you donât show that but I assume it is there) will change. Try sending to:
homeassistant/switch/nook_entrance/state
That is the subscribed topic.
Also, take a look at HA MQTT Statestream. Automatically sends all HA activity to MQTT in prescribed format (you can filter what you want or donât want).
To elaborate a bit on @kjknauss answer, The topic you put for the âState Topicâ on the MQTT Thing is the topic that OH subscribes to. âCommand Topicâ is the topic that OH publishes to. You are sending a message to the cmd topic so of course OH wonât receive anything.
KJ and @rlkoshak I downloaded the MQTT Explorer and I am able to issues MQTT statements that turn the light on and off but I still cannot from the command line of Home Assistant.
Anything I should be look at within the Explorer app with regards to additional setting or info that it might be sending to the MQTT host?
FYI I tried the same TOPIC on the command line but no such luck.
Pedantry: the mosquitto_pub command you show is one bundled with your Mosquitto MQTT broker. When you say âthe command line of Home Assistantâ do you just mean âfrom the device running Home Assistantâ?
This is a good question. We may be leaking into a HA configuration discussion on an OH forum. Are you looking to control an OH integrated light with an HA UI? I run both OH and HA to integrate some equipment (HVAC and Fans) where there wasnât an existing OH binding. But I never originate actions from HA. Perhaps you are just testing, but from your original post you had been using OH for years, so keep it that way and control from OH, but use HA to handle the few items that arenât available in OH.
This is the opposite of what I am suggesting, I know. But if you an experienced OH user, do the opposite (unless of course you really like the HA UI).
To control devices the way you want, you will have to look into the concept of what HA calls helper items (i.e., similar to a proxy item in OH).
Also, are you able to control the Honeywell thermostat with HA?
I donât know anything about Home Assistant but I do know openHAB. And what I know, based on what youâve shown so far, is that your publish command is to the topic youâve configure openHAB to only publish to. OH will never see any messages sent to that topic. If you want OH to see it, you have to publish to the State Topic. Thatâs the only topic OH subscribes to.
If you want that message to be sent to the linked Item as a command, thereâs a checkbox on the Channel config to treat state updates as commands.
But unless youâve changed your config since posting above, the only messages OH will see are those published to homeassistant/switch/garage_entrance/state
I would suggest that you need to decide to use either OpenHAB or HomeAssistant for your automation system. Iâve used both system, they each have their pros and cons. If youâre planning to run the two systems simultaneously I think youâre going to make maintaining the systems challenging. Youâll have twice of everything to maintain and learn, from versions, upgrades, different programming styles, etc., and youâll be asking questions on multiple forums; OpenHAB on this one and HA on another.
I tried the integration but unfortunately it does not support dimmer switches and the switch toggles do not update or stay synced the physical switches without the constant reloading of the integration.
In my experience this will be another automation. My solution looks like this (for a thermostat):
When changed in OH UI/sitemap
OH channel cmd topicâMQTT brokerâHA automation (change temp from payload)âthermostat
or Changed at thermostat
thermostatâHA publish changes via StatestreamâMQTT brokerâOH channel state topic/linked item
Also Changed in HA UI works (I donât control from HA though)
HA changes thermostat and publishes changes via StatestreamâMQTT brokerâOH channel state topic/linked itemâ(now goes back) OH channel cmd topicâMQTT brokerâHA automation (change temp from payload, which does nothing based on conditions in the automation since the thermostat temp already equals the payload).
Everything stays in sync, including state and cmd topics (you can watch in MQTT Explorer).