Hi, yesterday I received some parts and I started putting everything together and setting it up in my openhab with mqtt. After many hours, I finally got the gateway to work. Here's what I did:
So I have a raspberry pi 3b and it's running openhab 2.4 and I wanted to use the gateway on the same raspberry pi.
I was using this tutorial: https://forum.mysensors.org/topic/9346/getting-mysensors-mqtt-gateway-working-on-openhab-2-2-stable by Jet, so all credits go to him!
But I had to do some things differently, because my gateway runs on the same rpi.
- Since I have openhab already running, go to step6 and install Mosquitto.
- Step 7 is a bit different, because I'm using openhab 2.4:
cd /srv/openhab2-conf/services
sudo nano org.eclipse.smarthome.mqttbroker.cfg
add:
name=mosquitto
host=192.168.2.3 (ip of your rpi)
port=1883
secure=false
username=openhabian
password=secret (password you set when installing mosquitto)
retain=false
save and exit
sudo nano mqtt-eventbus.cfg
add
broker=mosquitto
save and exit file
sudo chown openhab:openhabian org.eclipse.smarthome.mqttbroker.cfg mqtt-eventbus.cfg
Remove the backup files:
cd /var/lib/openhab2/config/org/openhab
rm mqtt-eventbus.config
cd ../eclipse/smarthome
rm mqtt.config
sudo reboot
- Now I set up the gateway on the raspberry pi:
git clone https://github.com/mysensors/MySensors.git --branch development
cd MySensors
./configure --my-gateway=mqtt --my-controller-ip-address=192.168.0.123 --my-port=1883 --my-mqtt-user=openhabian --my-mqtt-password=openhabian --my-mqtt-publish-topic-prefix=mygateway1-out --my-mqtt-subscribe-topic-prefix=mygateway1-in --my-mqtt-client-id=mygateway1 --my-transport=rf24
You need to adjust the ip address to the one on your raspberry pi and of course the user/pw if it's different for you. Also you need to change the radio in the parameter --my-transport=, if you're using a different one. For more informations read here: https://www.mysensors.org/build/raspberry
sudo make
Now you can test it with:
sudo ./bin/mysgw
if successful continue with:
sudo make install
sudo systemctl enable mysgw.service
sudo reboot
openhab-cli console
feature:install openhab-transport-serial
feature:install esh-io-transport-mqtt
CTRL+D
cd /srv/openhab2-addons
sudo wget http://www.oberfoell.com/openhab2/org.openhab.binding.mysensors-2.4.0-SNAPSHOT.jar
sudo chown openhab:openhabian org.openhab.binding.mysensors-2.4.0-SNAPSHOT.jar
openhab-cli console
Check the features and services we need are active:
feature:list | grep openhab-transport-serial (Should say Started)
feature:list | grep esh-io-transport-mqtt (Should say Started)
bundle:list | grep MySensors (Should say Active)
bundle:list | grep nrjavaserial (Should say Active)
CTRL-D
sudo reboot
Now you can continue to use the tutorial from Jet (Step 10). Again, all credits go to Jet!
I have 2 sensors, the waterproof Dallas DS18B20 and the Soil Moisture Sensor. The Soil Moisture Sensor works fine and gets discovered automatically in the PaperUI Indox, but the temperature sensor doesn't work for me unfortunately. I don't know what I'm doing wrong.
I flashed the example from https://www.mysensors.org/build/temp and when I power it up, I get this in my openhab log:
2019-01-06 12:15:19.391 [WARN ] [.discovery.MySensorsDiscoveryService] - Cannot automatic discover thing node: 1, child: 255 please insert it manually
If I manually add it, it doesn't work though. And the childid seems weird too.
Has anyone gotten the Temperature sensor to work with Openhab?