[Tutorial] openHAB with serial gateway
-
I have a real noob question, and I am way better with the electronics that I am the software. I can see my motion detector show up in my gateway, and in the events.log, so I know that I am getting to the Raspberry Pi I deployed opneHAB on.
Here's some detail:
So I have build the MySensors.org motion detector (and a separate temp/humidity sensor), loaded up the NRF24l01+ and PIR.
I created a gateway out of a nano with NRF24l01+.
I followed the tutorial on how to do the serial bindings.
I see in the terminal window runtime.busevents that the motion detector is detecting movement, and later changing back to 0, along with the other sensor I have, which is the DHT11 for temp and humidity.2016-01-10 18:48:12 - Arduino state updated to 0;0;3;0;9;read: 4-4-0 s=1,c=1,t=0,pt=7,l=5:21.0
4;1;1;0;0;21.0
2016-01-10 18:48:12 - livingTemp01 state updated to 21.0
2016-01-10 18:49:32 - Arduino state updated to 0;0;3;0;9;read: 10-10-0 s=1,c=1,t=16,pt=0,l=1:1
10;1;1;0;16;1
2016-01-10 18:49:35 - Arduino state updated to 0;0;3;0;9;read: 10-10-0 s=1,c=1,t=16,pt=0,l=1:0
10;1;1;0;16;0My confusion is how this software all works to get just the information from the gateway to the screen.
I know you have to declare an item in the demo.items file, and that item needs to be in the sitemap to display. but I do not understand how you get the status from the gateway? Can someone point me to some simple examples that include the mysensor.org PIR sensor? How does the item declaration get the knowledge of the change that the gateway is receiving from the sensor? I have read through several documents and tutorials, but I am missing this bit of information. -
@poeml more precisely, the Nano's FTDI chip connects to the booting Raspberry, but instead of registering a single device there are 4 (!) log lines claiming registering 4 devices (very funny), and none of the devices are bound.
May 23 23:16:21 bramble kernel: [ 3.738087] usb 1-1.5: new full-speed USB device number 5 using dwc_otg May 23 23:16:21 bramble kernel: [ 4.283520] usb 1-1.5: new full-speed USB device number 6 using dwc_otg May 23 23:16:21 bramble kernel: [ 4.768136] usb 1-1.5: new full-speed USB device number 7 using dwc_otg May 23 23:16:21 bramble kernel: [ 5.268161] usb 1-1.5: new full-speed USB device number 8 using dwc_otgI don't find a way to trigger re-registering the device, or power-cycle the USB port, via software. I can only power-cycle the whole USB bridge, which means that the LED goes out (the Ethernet chip is switched off as well...) and LED goes on again, but with the same faulty registering as when booting.
# cat reset-usb #!/bin/bash echo 0 > /sys/bus/usb/devices/1-1/authorized sleep 1 echo 1 > /sys/bus/usb/devices/1-1/authorizedUnplugging and replugging always works.
For the record: Raspberry Pi version 2 with the 4 USB ports, just updated to Debian 8.0 (Jessie). I didn't check with Debian Wheezy if it worked then. The Nano was linked from MySensors store I believe and works great otherwise. I have two of them and both have the same problem (or the Raspi's USB stack has the problem, who knows).
-
It just took me 2 hours to realize that you should not use
import java.util.*when you want to use timer operations like
if (timer=! null) { ... }Without importing java.util.* , everything works as expected. Someone has an idea why this is the case? Can you reproduce my problem?
-
Can someone please assist me regarding this serial connection setup.
I can see in my event log that I receive updates of the Arduino state as below:Arduino state updated to 99;1;1;0;0;23.7 99;0;1;0;1;37.2And also in the openhab.log file I get the following types of messages:
[DEBUG] [b.serial.internal.SerialDevice:225 ] - Received message '99;0;1;0;1;37.6 ' on serial port /dev/ttyUSB99But the rule is for some reason not initiated I guess as the println and logInfo i I've added to the top of the rule is absent from the logs. I can see from the tutorial and your posts that you get log information like below but these I cant find in any log.
[INFO ] [runtime.busevents ]Possibly I'm missing something in my logback.xml settings or perhaps there is some other reason to this which also might explain why my rule is not started. Perhaps its because I'm using a newer binding for the serial connection? (org.openhab.binding.serial-1.8.3.jar)
Any help would be much appreciated!
Update 1: Perhaps I'll try the mysensors binding and if I'm more successful with that approach I'll skip this serial binding altogether.
Update 2: Ok, I will be using the mysensors binding for the serial connection. I tried it last night and it just worked! And this serial binding approach also demands some quite extensive rule handling of the incoming messages which is not the case with mysensors binding. I think I read somewhere that the mysensors binding will also be available for Openhab 2.0 so hopefully I can continue using it also in the future.
My recommendation for new users of the serial gateway (who also uses openhap as a controller) is to go for the mysensors binding!
-
This post is deleted!
-
@TimO is it possible to send commands to actuators with this method? I have a LED Dimmer Actuator and don't know what I have to do in OpenHAB to send commands to this actuator over the serial gateway..
-
@HenryWhite: Yes it is possible.
Look at this example: https://forum.mysensors.org/topic/655/serial-gateway-connection-to-openhab/70 -
@HenryWhite: Yes it is possible.
Look at this example: https://forum.mysensors.org/topic/655/serial-gateway-connection-to-openhab/70Great! Thank you!