Some questions before I start ordering parts.
-
I’m running Openhab2 a raspberry pi 3b and I recently found out about mysensors. After reading a lot, I’m still not quite sure about some things.
I want to build a temperature sensor and use it in openhab. So here’s what I think I need to do:- Since I’m running Openhab on a raspberry pi 3b already, I think I can use the same pi for the gateway as well? So I will follow this guide https://www.mysensors.org/build/raspberry and buy a NRF24L01+ radio modul for the pi. So can I run the gateway and openhab at the same time on the same raspberry?
- I want a waterproof temperature sensor, so I want to build this sensor: https://www.mysensors.org/build/temp, so I will buy an arduino, another NRF24L01+ radio modul and the temperature sensor.
When I look at the example code for the temperature sensor, I’m a bit confused. How can the sensor communicate with the gateway? Do I need to make some modifications first?
Is this list of items enough for me to make it all work?
2x NRF24L01+ (one for the gateway on the pi and one for the temperature sensor)
1x Arduino nano
1x DS18B20 Waterproof Dallas Temperature SensorsSorry, for all the questions, I’m new to this and I only recently integrated all my smart devices in openhab. I just want to make sure, before I start ordering things. Thank you very much in advance!
-
@atzohy welcome to the MySensors forum.
You are correct, except that you need 2x 47uF capacitors (one for eachnrf24l01+) and a 4.7kohm resistor (for the dallas temperature sensor). You'll need some wires as well.
There is no need to modify the temperature sketch.
-
@mfalkvidd said in Some questions before I start ordering parts.:
@atzohy welcome to the MySensors forum.
You are correct, except that you need 2x 47uF capacitors (one for eachnrf24l01+) and a 4.7kohm resistor (for the dallas temperature sensor). You'll need some wires as well.
There is no need to modify the temperature sketch.
Thank you very much for clearing up my questions! I will start to order the parts now and I hope I will be successful.
-
@atzohy great!
If you haven't already, you can also look at the generic buying guide https://www.mysensors.org/store/buying_guide
-
@mfalkvidd said in Some questions before I start ordering parts.:
@atzohy great!
If you haven't already, you can also look at the generic buying guide https://www.mysensors.org/store/buying_guideYes, I used that one. It was very helpful. Now I'm waiting for the parts to arrive. Thank you again!
It's really amazing how cheap the sensors can be, if you build them by yourself.
-
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?
-
Try to add
#define MY_NODE_ID 2
(or another node number) in your dallas temperature sketch BEFORE including the mysensors library
-
@momo90 said in Some questions before I start ordering parts.:
Try to add
#define MY_NODE_ID 2
(or another node number) in your dallas temperature sketch BEFORE including the mysensors library
Thanks for the reply, I forgot to mention that I tried that already. I get this message when I change the node id to 2:
Cannot automatic discover thing node: 2, child: 255 please insert it manually
edit: I've redone all my wiring and now it works! Now I am a big step closer to my project. Thanks to everyone!
-
@atzohy said in Some questions before I start ordering parts.:
Cannot automatic discover thing node
I'm not using the mysensors binding in openhab, i followed this https://www.smarthomeblog.net/diy-home-automation-sensors/ excellent tutorial and everything is working.
I didnt realise, that the warning was in the openhab log. Have you tried to define the node id in the sketch and add the sensor manually in openhab via a .thing and .item file like here described?
https://github.com/tobof/openhab2-addons/wiki/Examples
-
@momo90 said in Some questions before I start ordering parts.:
@atzohy said in Some questions before I start ordering parts.:
Cannot automatic discover thing node
I'm not using the mysensors binding in openhab, i followed this https://www.smarthomeblog.net/diy-home-automation-sensors/ excellent tutorial and everything is working.
I didnt realise, that the warning was in the openhab log. Have you tried to define the node id in the sketch and add the sensor manually in openhab via a .thing and .item file like here described?
https://github.com/tobof/openhab2-addons/wiki/ExamplesHi, thanks for your reply. I've redone all the wiring and now everything works for me, even automatic discovery. I had edited my previous post, maybe you haven't seen it. But I still appreciate your help!