Openhab MQTT Example
-
Its not a broker????
"The MQTT gateway is basically a Ethernet Gateway with modified software which makes it act as a MQTT broker. "This text in the build instructions has to be fixed. In no minute i thought about installing mosquitto.
But i hope the installation of mosquitto will get it to work.
@Marcus It does act as a broker, only with very limited functions, you do not have to subscribe and also no QOS is done. But it is a broker.
Just try to connect an mqtt client to it, and you will see messages being received by the client. (for example mqtt.fx)
-
Hi Marcus, I have to confess I mingled up the names and got a little lack of information. I referred to something I tried several months ago - i didn't fit my needs, so I changed back to the serial Interface - which performed reasonably good and i lost contact to the MySensors-MQTT side via Ethernet.
To my surprise i read there shall be some basic broker functionality in the Gateway sketch - which sounds really good. It will take a while to reactivate my Ethernetshield and give it a try. Sadly my holidays are over tomorrow and there will be not much spare time to test it.
Nevertheless trying Mosquitto would be interesting, e.g. to talk to the MySensors broker directly and to check the OpenHab->Broker connectivity.
-
Hmm, now i am nearly at the beginning. It would be nice if i dont need mosquitto.
Maybe here are others who can help.
Thank u anyway for ur help.
Are we both the only who want to use openhab???
Is there no other way to check if openhab recieves the messages from the broker (ethernet gateway)?
-
I am also using openHab ;) but serial way
-
@Marcus it works fine for me
-
I to have had this same problem using openhab and MQTT Gateway. I could toggle relays and such but could not receive any information back from the gateway things such as sketch info or versions. So I decided to pull from that and try PiDome. I like the way PiDome works with the Serial Gateway. Everything seems to be more dynamic. I did try PiDome with the MQTT Gateway and got the same results as with Openhab I could publish information to the gateway but couldn't receive for some reason. Would like to find out what could be happening myself. However right now I'm waiting on parts.
-
@Marcus serial is working fine with piDome, openHab and Vera. No need for mosquito which i never installed and used before.
-
Good morning community.
Here is what i did now for installing mosquitto on my raspberry pi.
This infos are from here (http://jpmens.net/2013/09/01/installing-mosquitto-on-a-raspberry-pi/).
curl -O http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key sudo apt-key add mosquitto-repo.gpg.key rm mosquitto-repo.gpg.key cd /etc/apt/sources.list.d/ sudo curl -O http://repo.mosquitto.org/debian/mosquitto-repo.list sudo apt-get update sudo apt-get install mosquitto mosquitto-clients python-mosquittoNow mosquitto is running.
With:
sudo /etc/init.d/mosquitto stopI can stop it.
With
sudo /etc/init.d/mosquitto startI can start it.
But what to do now???
How do i connect mosquitto to my MQTT-Ethernet-Gateway?
How do i connect mosquitto to Openhab?Please help!
-
MQTT-Ethernet-Gateway is mqtt brocker, not client :(
to connect mosquitto try use MQTTClientGateway http://forum.mysensors.org/topic/524/mqtt-client-gateway
-
Thank u for your answers.
I love the look of openhab. So i will try the it with mosquitto.
If it will not work then i will try pidome and serial gateway.
If i have new infos i will post them here!
@Marcus PiDome also supports the mqtt gateway next to the serial gateway, so no need to switch. As far as i know, but i'm not an openhab expert, it should work fine as a mqtt client to connect to the mysensors mqtt gateway.
See this thread for some examples: http://forum.mysensors.org/topic/303/mqtt-broker-gateway
The developer of the MQTT gateway has posted some examples in the above thread on how you should be able to use it.
Cheers!
-
@b0rmann Please read the whole thread and tell me what to do now!!! I only want openhab and mysensors work together. But i want to use my mqtt-ethernet-gateway. Not the serial way.
-
@John Thank u very much. I think i will stop with Openhab and give PiDome a try. it seems to be better described what to do to get it run.
In the thread u mentioned i looked for some examples but didnt get them to work and no one could help.
-
@Marcus: Sorry I'm in a hurry so...
But what to do now??? -> is your broker really ok?-
open two terminal windows on your Raspberry.
-
one window:
mosquitto_sub -t /test -v
-
second window:
mosquitto_pub -t /test -m "test message"
If it's all fine, the test message should show up in the first window.
How do i connect mosquitto to Openhab?
OpenHab -> mosquitto
If your still got the OpenHab sitemap from above, the swtiches 1+3 should be functional like desribed, switch 2 will result in an errormessage in the log (as "intended").Reverse direction (mosquitto -> Openhab).
You may populate your broker with some messages for the given topic.
e.g. mosquitto_pub -t MyMQTT/20/255/V_SKETCH_NAME -m "fake sketch name"How do i connect mosquitto to Openhab?
I use the serial Gateway connected via USB to my Raspberry and a little Node.js script.
If you are interested - let me know. -