MySensors --> MQTT --> OpenHab 2.5
-
I second this. I went the mqtt route as well. Auto discovery is cool, but i wanted some additional control. My openhab 2.5 I don't use the UI at all. I just all flat files. This is a preference for me. I also use the VSCode extension for openhab and it works BEAUTIFULLY!
-
Thank you for your comments, it sounds like it's worth trying to get the native OH MQTT working (I don't mind not having auto-discovery - I won't be adding things so regular, once I get it figured out I'm OK with adding things manually).
I've managed to setup PaperUI sufficiently to get the temperature from my sensor to display on PaperUI's control screen (although I'm not sure I understand quite how it works yet, still a little unclear on Items, Channels, etc)
@CrankyCoder : I don't suppose you'd mind sharing some snippets of your config files (or point me at some good examples) to get me started - maybe showing a broker and something like a temperature sensor?
-
@P72endragon
I also use MQTT instead of the binding. Major reason: when I started, it wasn't out and I had the serialGW connected. Once realized I want the controller in a different place, I switched to MQTT and never regret. I feel I have more control with the text files than I have with the UI-driven way.First of all, I highly recommend you download MQTT-spy or similar, this will help a lot in figuring out the right notation in OpenHAB. It will just listen to the traffic and log it. You could also use it to send test messages etc.
Example:
Gateway configuration// Set this node's subscribe and publish topic prefix #define MY_MQTT_PUBLISH_TOPIC_PREFIX "hefti-out" #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "hefti-in" // Set MQTT client id #define MY_MQTT_CLIENT_ID "hefti-1"Node configuration (temperature sensor)
#define CHILD_ID_TEMP 1 MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); present(CHILD_ID_TEMP, S_TEMP);OH example.items
Number roofTemp01 "Temperature roof [%.1f °C]" <temperature> (Temperature, Outdoor) {mqtt="<[mosquitto:hefti-out/101/1/1/0/0:state:default]"}MQTT spy of a recent message:

That is basically it. Depending on how you want to display the result (sitemap, PaperUI etc). As you see, the item is displayed in Temperature and Outdoor but you could also specify it directly in the sitemap but I guess this is going too far here.
Hope that helped. -
That's great, thank you, I'll have a play and see how far I can get... (yeah, I've already been using MQTT Explorer to understand the message structure)
-
@P72endragon
I also use MQTT instead of the binding. Major reason: when I started, it wasn't out and I had the serialGW connected. Once realized I want the controller in a different place, I switched to MQTT and never regret. I feel I have more control with the text files than I have with the UI-driven way.First of all, I highly recommend you download MQTT-spy or similar, this will help a lot in figuring out the right notation in OpenHAB. It will just listen to the traffic and log it. You could also use it to send test messages etc.
Example:
Gateway configuration// Set this node's subscribe and publish topic prefix #define MY_MQTT_PUBLISH_TOPIC_PREFIX "hefti-out" #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "hefti-in" // Set MQTT client id #define MY_MQTT_CLIENT_ID "hefti-1"Node configuration (temperature sensor)
#define CHILD_ID_TEMP 1 MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); present(CHILD_ID_TEMP, S_TEMP);OH example.items
Number roofTemp01 "Temperature roof [%.1f °C]" <temperature> (Temperature, Outdoor) {mqtt="<[mosquitto:hefti-out/101/1/1/0/0:state:default]"}MQTT spy of a recent message:

That is basically it. Depending on how you want to display the result (sitemap, PaperUI etc). As you see, the item is displayed in Temperature and Outdoor but you could also specify it directly in the sitemap but I guess this is going too far here.
Hope that helped.Not sure how you are making out @P72endragon, I just came across this thread and noticed something I wanted to point out to you (and others):
@parachutesj said in MySensors --> MQTT --> OpenHab 2.5:
OH example.items
Number roofTemp01 "Temperature roof [%.1f °C]" <temperature> (Temperature, Outdoor) {mqtt="<[mosquitto:hefti-out/101/1/1/0/0:state:default]"}This looks to me like MQTT v1 binding (and you will find a lot of examples like this on the Internet, unfortunately). The v2 binding looks a bit different (and you will find less examples of). I can post some working ones if anyone is interested.
-
Not sure how you are making out @P72endragon, I just came across this thread and noticed something I wanted to point out to you (and others):
@parachutesj said in MySensors --> MQTT --> OpenHab 2.5:
OH example.items
Number roofTemp01 "Temperature roof [%.1f °C]" <temperature> (Temperature, Outdoor) {mqtt="<[mosquitto:hefti-out/101/1/1/0/0:state:default]"}This looks to me like MQTT v1 binding (and you will find a lot of examples like this on the Internet, unfortunately). The v2 binding looks a bit different (and you will find less examples of). I can post some working ones if anyone is interested.
@TRS-80 true, MQTT v1. The updated binding sucks IMHO
EDIT: I should have been more specific. The MQTT binding was not migrated to 2.x for a long time and over time I got a lot of connected things via MQTT. Once 2.x was released it wasn't really stable in the beginning and later it was just not worth to do the upgrade IMHO. Once OH 3.x comes out and we have to adapt again, I might think about a migration but until then, I am happy with MQTT 1 -
@TRS-80 true, MQTT v1. The updated binding sucks IMHO
EDIT: I should have been more specific. The MQTT binding was not migrated to 2.x for a long time and over time I got a lot of connected things via MQTT. Once 2.x was released it wasn't really stable in the beginning and later it was just not worth to do the upgrade IMHO. Once OH 3.x comes out and we have to adapt again, I might think about a migration but until then, I am happy with MQTT 1@parachutesj said in MySensors --> MQTT --> OpenHab 2.5:
The updated binding sucks IMHO
I guess if it sucks, it is largely because there are very few (good, working) examples of it around the net, but very many v1 examples.
I am not necessarily disagreeing with you, but in my case the only suck was the initial setup, now that I have got over that hump it has worked flawless. It might even be more organized (maybe it is growing on me)? :)
But I did not work with MQTT v1 a lot, I was on MySensors Binding + Serial gateway before. Which would always drop out and other problems, totally unreliable. It could have been that I was on old version of Armbian and therefore stuck with old version of OpenHAB so maybe not a fair assessment, although I read of others with a lot of problems, too.
Anyway, now I am starting over from scratch with more powerful SBC (ODROID-XU4 instead of Cubietruck), latest Stable Armbian and OpenHAB, with MQTT v2 binding, an Ethernet (MQTT) gateway and armed with new insights into radio propagation and testing methods... And with putting all that together now it has been rock solid so far! Although admittedly only a few nodes, and only for maybe few weeks so far...
So, fingers crossed! :D
Are you perchance using MySensors binding with MQTT v2, or just straight MQTT v2 without the MySensors binding? I would love your feedback in my other thread in either case.
-
@parachutesj said in MySensors --> MQTT --> OpenHab 2.5:
The updated binding sucks IMHO
I guess if it sucks, it is largely because there are very few (good, working) examples of it around the net, but very many v1 examples.
I am not necessarily disagreeing with you, but in my case the only suck was the initial setup, now that I have got over that hump it has worked flawless. It might even be more organized (maybe it is growing on me)? :)
But I did not work with MQTT v1 a lot, I was on MySensors Binding + Serial gateway before. Which would always drop out and other problems, totally unreliable. It could have been that I was on old version of Armbian and therefore stuck with old version of OpenHAB so maybe not a fair assessment, although I read of others with a lot of problems, too.
Anyway, now I am starting over from scratch with more powerful SBC (ODROID-XU4 instead of Cubietruck), latest Stable Armbian and OpenHAB, with MQTT v2 binding, an Ethernet (MQTT) gateway and armed with new insights into radio propagation and testing methods... And with putting all that together now it has been rock solid so far! Although admittedly only a few nodes, and only for maybe few weeks so far...
So, fingers crossed! :D
Are you perchance using MySensors binding with MQTT v2, or just straight MQTT v2 without the MySensors binding? I would love your feedback in my other thread in either case.
@TRS-80 sorry should have been more specific and edited my post above. I don't know if it still sucks but in the beginning it wasn't working very well and I didn't want to change all my configuration just to have exactly the same. Still a question of time.
So I stick with MQTT 1 without MySensors binding - same, just what you have started with, stick with it until there is a real need. -
@TRS-80 said in MySensors --> MQTT --> OpenHab 2.5:
Not sure how you are making out @P72endragon
I got as far as making my proof-of-concept work. I've put the software side of things on hold for the time being while I do some hardware work. Once I get back to the software, I'll take another look at the binding version.
Thanks for the additional information :)
-
Thank you for your comments, it sounds like it's worth trying to get the native OH MQTT working (I don't mind not having auto-discovery - I won't be adding things so regular, once I get it figured out I'm OK with adding things manually).
I've managed to setup PaperUI sufficiently to get the temperature from my sensor to display on PaperUI's control screen (although I'm not sure I understand quite how it works yet, still a little unclear on Items, Channels, etc)
@CrankyCoder : I don't suppose you'd mind sharing some snippets of your config files (or point me at some good examples) to get me started - maybe showing a broker and something like a temperature sensor?
@P72endragon said in MySensors --> MQTT --> OpenHab 2.5:
Thanks for the additional information
Well since you replied I took another scan over the thread. ;)
@P72endragon said in MySensors --> MQTT --> OpenHab 2.5:
native OH MQTT
I have been fairly involved over at OpenHAB forums (on and off; and I read a great deal in general) and the consensus amongst those in the know (last time I checked) seemed to be to use independent, outside MQTT broker.
Personally I subscribe to "Unix philosophy" and since going the MQTT route have always run Mosquitto, but it was nice to see others confirming what I had suspected all along (that OpenHAB was trying to "do too much" with their built-in broker).
@P72endragon said in MySensors --> MQTT --> OpenHab 2.5:
I don't mind not having auto-discovery
[...]
(although I'm not sure I understand quite how it works yet, still a little unclear on Items, Channels, etc)Getting your head around theOpenHAB concepts is one thing. Just try to imagine what it would take if you were designing a system from the ground up to abstract away a bunch of different incompatible systems into one unified control system, and you will be well on your way to understanding it. Thankfully their docs are very good and their forums are very active, including lots of examples.
But main thing I wanted to touch on was config in text files vs. PaperUI. If you don't care about auto-discovery I can highly recommend the former. IMO, the PaperUI hides too much stuff from you, and I don't like that. All entries in there actually go into some internal database which you cannot edit (other than through PaperUI) and exists in parallell to your text files (which you can have in addition).
So, what happens 2 years from now when you go to upgrade or install on a new system? Yeah good luck remembering what you did in PaperUI that you now need to re-do, in addition to all your text files which you already have. I read a lot of forum threads along such lines, and/or broken stuff after upgrades, etc...
So for me, this time around, I spent the extra time doing complete text file configuration from scratch. And now I have a completely reproducible set of text files that I keep in version control and backed up. I could wipe the system and re-install no problem.
As another upside, you really get to know the ins and outs of the system that way.
In closing I will say that my MySensors Ethernet/MQTT gateway -> OpenHAB has been working flawless, and so to me appears to be the way to go. Come on in, the water is fine! :D
I actually even run the Mosquitto broker on a separate box from OpenHAB, it was designed from the ground up to be a network based architecture, so it really doesn't matter. In fact I don't even use MySensors binding in OpenHAB at all. Once you get over initial config (which is the challenging part) I believe it is actually the much better way to go. Which is another reason why I wanted to post this, as there is too much conflicting, old, and bad information out there on the Internet about this subject.
That way no more relying on an outside party (MySensors binding developer(s)) for anything. They seem to me a bit overwhelmed (at least in the past). Not knocking them in the least, in fact I applaud their efforts. However personally I decided to remove that dependency from my system and it has proven to be a good decision.
I would love to hear back from someone who is happy with their MySensors 2.5.x binding in OpenHAB. So if that is you, please speak up (and tell us your secrets! :) )! I personally haven't seen any of those posts though, unfortunately...
Anyway, post back whenever you get to that point, and I will be happy to share some up to date config snippets (or anyone else reading along). I was going to post mine but I just looked at them and realized they need some cleaning up first. Sorry!
-
Hi, sorry for the delay in replying, I got caught up on other things...
I (think?) I'm using the MQTT2 binding in OH. In the PaperUI --> Add-ons --> Bindings, the only one showing as installed is "MQTT Binding (binding-mqtt - 2.5.4)".
I'm running separate Docker containers for MySensors Gateway, Mosquitto and OpenHab.
Since people seem to be using text files for configuration successfully, I'm going that route too (version control, scripted/automated builds, etc). These are the configuration files I've got so far (sanitised as appropriate):
$ cat openhab/conf/things/mysensors.things Bridge mqtt:broker:Mosquitto "Mosquitto" [ host="192.168.10.114", port="1883", secure=false, clientID="OpenHAB", username="mqtt_user", password="mqtt_password" ] { Thing topic nodePrototype1 "Prototype Node" @ "Portable" { Channels: Type number : temp "Temperature" [ stateTopic="mysensors-out/1/0/1/0/0", unit="°C" ] } } $ cat openhab/conf/items/mysensors.items Number Prototype_Temp "Temperature" <temperature> {channel="mqtt:topic:Mosquitto:nodePrototype1:temp"}OH is successfully displaying the temperature in PaperUI, but I haven't tried to do anything with it yet...