Updated to OpenHAB 2.5 with step-by-step instructions
switched to Zulu Java
Posts made by FlipFlap3
-
RE: OpenHAB 2.5 MySensors Serial Gateway - How to install
-
RE: OpenHAB 2.5 MySensors Serial Gateway - How to install
@nizoo91 Just found out myself as well that this was missing. Thanks!
-
RE: OpenHAB 2.5 MySensors Serial Gateway - How to install
I had to re-install myself and found my how to wasn't 100% correct for OpenHAB 2.4 so I updated it.
Works with OpenHAB 2.4 and @TimO 's 2.4 jar. Kudos to him for this!
-
RE: Beginner totally lost during installation of serial gateway
https://forum.mysensors.org/topic/6694/openhab-2-2-mysensors-serial-gateway-how-to-install
No need to have a 2nd arduino connected through usb. Just attach a nrf chip directly to your pi
-
RE: OpenHAB 2.5 MySensors Serial Gateway - How to install
@greymarvel said in OpenHAB 2.2 MySensors Serial Gateway - How to install:
@FlipFlap3
Firstly well done for the brilliant instructions . I too have been attempting to use Openhab with my sensors over the last year and to be honest although I've had relative success, because of the limited amount of, up to date and accurate tutorials its been a steep slope to climb. Currently I have Openhabian installed on a Raspberry pi with a Gateway connected to the I/O pins of the Pi and a couple of temp sensors connected ( all be it with difficulty ). It's setup as an Ethernet Gateway but I did try once to setup it up as a serial gateway, unsuccessfully I might add. Out of interest if I did re- install using your setup instructions, Is a serial Gateway better or easier in any way ? it does seem like the most supported option of the 3 for most people on the forum .Thanks
Sorry for late response (busy with anual reporting lately).
I have tried MTTQ first myself, but I didn't get things working smoothly. 2nd attempt was with serial gateway. Even though I had some problems at first, I did manage to get it working. I had a hard time finding a good tutorial though, so I wrote down the steps I took carefully. Reason for me to put it here was to have a personal backup for my notes and if it would be helpful for anyone else that would be an awesome bonus
I didn't try ethernet gateway yet cause I am happy with the current setup.
-
RE: OpenHAB 2.5 MySensors Serial Gateway - How to install
@frozenyack Sorry, I can't remember seeing an error like that before.
-
RE: What does a newbie need to integrate sensors with OpenHab?
A year ago I tried to get some sensors going for the first time. Tried mqtt 1st, but failed. 2nd was serial. That worked. In the end it doesnt matter. When it works, you don't have to look at it anymore. You can just power up new sensors and they will pop up in OpenHAB.
-
RE: What does a newbie need to integrate sensors with OpenHab?
Since you attached a nrf24 directly to your pi, I presume you have all your sensors connected eith nrf24 as well.
You could use a serial gateway. I updated my documentation yesterday on how I do it. You can find it on the same sub forum you posted this. -
RE: OpenHAB 2.5 MySensors Serial Gateway - How to install
2.3 snapshot doesn't work. 2.2 does
Updated opening post for step by step instruction on installing openhab2.2 with mysensors 2.2 serial gateway binding. If you have any questions, just post them here.
-
RE: OpenHAB 2.5 MySensors Serial Gateway - How to install
@jic Nope sry, BUT.. I am going to do a fresh install again today. Will check if I can get it to work and make updates to this howto where needed.
-
RE: OpenHAB 2.5 MySensors Serial Gateway - How to install
Made a reïnstall again and found that something was incomplete and that it didn't work anymore with the stable branche.
Missing in "initial config" is enabling SPI through raspi-config at the start
At installing MySensors replace:
git clone https://github.com/mysensors/MySensors.git --branch master
with:
git clone https://github.com/mysensors/MySensors.git --branch developmentecho 'deb http://dl.bintray.com/openhab/apt-repo2 stable main' | sudo tee /etc/apt/sources.list.d/openhab2.list
Now needs to be:
echo 'deb https://dl.bintray.com/openhab/apt-repo2 stable main' | sudo tee /etc/apt/sources.list.d/openhab2.listsudo wget http://www.oberfoell.com/openhab2/org.openhab.binding.mysensors-2.2.0-SNAPSHOT.jar
sudo chown openhab:openhab org.openhab.binding.mysensors-2.2.0-SNAPSHOT.jar
Somehow this next one always times-out the first time. 2nd attempt does give me a connection after a while
ssh -p 8101 openhab@localhost -
RE: OpenHAB 2.5 MySensors Serial Gateway - How to install
solved it
Inside "/home/pi/MySensors/example_linux/mysgw.cpp" or where you downloaded the "git clone https://github.com/mysensors/MySensors.git --branch master" there is this option:
// Grant access to the specified system group for the serial device
//#define MY_LINUX_SERIAL_GROUPNAME "tty"uncomment to
// Grant access to the specified system group for the serial device
#define MY_LINUX_SERIAL_GROUPNAME "tty"save file
stop mysgw with "sudo systemctl stop mysgw.service"
remove mysgw from auto start with "sudo systemctl disable mysgw.service"
uninstall with "sudo make uninstall"
installed againI added openhab to the tty group using "sudo usermod -a -G tty openhab"
full reboot
and it works!
-
RE: OpenHAB 2.5 MySensors Serial Gateway - How to install
Really grateful for your reply. Tried it and it didn't fix my problem unfortenately
09:43:21.396 [DEBUG] [col.serial.MySensorsSerialConnection] - Connecting to /dev/pts/1 [baudRate:115200] 09:43:21.398 [DEBUG] [col.serial.MySensorsSerialConnection] - Final port list: /dev/pts/1 09:43:21.402 [ERROR] [col.serial.MySensorsSerialConnection] - Can't connect to serial port. Wrong port? 09:43:21.405 [ERROR] [col.serial.MySensorsSerialConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:17) 09:43:21.407 [DEBUG] [col.serial.MySensorsSerialConnection] - Shutting down serial connection!
09:45:14.726 [DEBUG] [col.serial.MySensorsSerialConnection] - Connecting to /dev/ttyMySensorsGateway [baudRate:115200] 09:45:14.728 [DEBUG] [col.serial.MySensorsSerialConnection] - Final port list: /dev/ttyMySensorsGateway 09:45:14.732 [ERROR] [col.serial.MySensorsSerialConnection] - Can't connect to serial port. Wrong port? 09:45:14.735 [ERROR] [col.serial.MySensorsSerialConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:1) 09:45:14.737 [DEBUG] [col.serial.MySensorsSerialConnection] - Shutting down serial connection!
lrwxrwxrwx 1 root root 10 apr 23 09:35 ttyMySensorsGateway -> /dev/pts/1 .... pi@Controller:/dev/pts $ ls -l totaal 0 crw--w---- 1 pi tty 136, 0 apr 23 2017 0 crw--w---- 1 root tty 136, 1 apr 23 09:35 1 crw--w---- 1 pi tty 136, 2 apr 23 09:41 2 c--------- 1 root root 5, 2 jan 1 1970 ptmx
In my /etc/group I have this (filtered out some stuff this noob thinks is obsolete )
root:x:0:openhab daemon:x:1: bin:x:2: sys:x:3: adm:x:4:pi tty:x:5: dialout:x:20:pi,openhab sudo:x:27:pi www-data:x:33: pi:x:1000: spi:x:999:pi i2c:x:998:pi gpio:x:997:pi openhab:x:119:```
-
OpenHAB 2.5 MySensors Serial Gateway - How to install
[update 2018-03-03 for version 2.2]
[update 2019-01-05 for version 2.4]
[updates 2019-04 add esh-io-transport-mqtt (needed even for serial gateway) and stop debug mysensors]
[updates 2020-02-25 update for zulu openjdk implementation and other minor adjustments]Preparing your raspberry with clean install:
Download RASPBIAN STRETCH LITE from https://www.raspberrypi.org/downloads/raspbian/
Flash to SD-Card with etcher (https://etcher.io/) or any other flash tool you like
create empty "ssh" file in root on SD-Card
Insert SD-Card into raspberry PI, connect with UTP cable to your router and power on.
Go get some coffee
Get IP address by pinging raspberrypi.local from commandprompt on your pc
Start SSH session with putty to the raspberry pi
Login as "pi" with password "raspberry"Initial configuration:
sudo raspi-config
Change your password
Network options\Hostname Change hostname to "openhabpi" or what you want
[optional: add wifi settings]
Interfacing Options\SPI enable
Advanced options\Expand the file system
Advanced options\Memory split change the memory split for the GPU from "64" to “16”
Finish + reboot
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install screen mc vim git htopJava installation: (updated 2020-02-25)
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | sudo tee -a /etc/apt/sources.list.d/webupd8team-java.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default
wget -q -O - http://repos.azulsystems.com/RPM-GPG-KEY-azulsystems | sudo tee /etc/apt/trusted.gpg.d/zulu.asc
sudo echo 'deb http://repos.azulsystems.com/debian stable main' | sudo tee /etc/apt/sources.list.d/zulu.list
sudo apt-get update
sudo apt-get install zulu-embedded-8MySensors:
git clone https://github.com/mysensors/MySensors.git --branch master
cd MySensors[edit update 2019-01-05]
sudo nano /home/pi/MySensors/examples_linux/mysgw.cppUncomment the where needed to make it look like this:
// Config file #define MY_LINUX_CONFIG_FILE "/etc/mysensors.conf" // How many clients should be able to connect to this gateway (default 1) #define MY_GATEWAY_MAX_CLIENTS 10 // Serial config // Enable this if you are using an Arduino connected to the USB #define MY_LINUX_SERIAL_PORT "/dev/ttyUSB0" // Enable this if you need to connect to a controller running on the same device // You also need to define MY_LINUX_SERIAL_PORT above with the symlink name for the PTY device #define MY_LINUX_SERIAL_IS_PTY // Grant access to the specified system group for the serial device #define MY_LINUX_SERIAL_GROUPNAME "tty"
Save & close mysgw.cpp
note: I have chosen channel 69 for the rf24 network. You can choose your own, but remember to use the same channel in your arduino sketches as you do here.
./configure --my-gateway=serial --my-serial-is-pty --my-rf24-channel=69 --my-transport=rf24 --my-serial-groupname=tty
make
sudo ./bin/mysgw --config-file /etc/mysensors.dat --daemon
sudo make install
sudo systemctl daemon-reload
sudo systemctl enable mysgw.service
sudo systemctl start mysgw.serviceOpenHAB2:
wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key add -
echo 'deb http://dl.bintray.com/openhab/apt-repo2 stable main' | sudo tee /etc/apt/sources.list.d/openhab2.list
sudo apt-get update
sudo apt-get install openhab2
sudo apt-get install openhab2-addons
sudo systemctl start openhab2.service
sudo systemctl status openhab2.service
sudo systemctl daemon-reload
sudo systemctl enable openhab2.serviceTime for coffee again.......
open web page select expert....
sudo usermod -a -G dialout openhab
sudo usermod -a -G tty openhabcd /usr/share/openhab2/addons/
sudo wget http://www.oberfoell.com/openhab2/org.openhab.binding.mysensors-2.5.0-SNAPSHOT.jar
sudo chown openhab:openhab org.openhab.binding.mysensors-2.5.0-SNAPSHOT.jar
ssh -p 8101 openhab@localhost (used to fail the first time, but works now at the first attempt)
pw:habopen
feature:install openhab-transport-serial
feature:install openhab-core-io-transport-mqtt
log:set DEBUG org.openhab.binding.mysensors
log:tailsudo reboot
Finally:
web-> paperui/things add MySensors Serial Gateway
settings:
Serial Port: /dev/ttyUSB0
Send Delay: 200
Baudrate: 115200
Skip startup connection check: trueAll done. Good luck!
When all is working well, you can stop debugging mysensors this will help to reduce the log files.
//start karaf
ssh -p 8101 openhab@localhost
//enter password
habopen
// stop debugging mysensors and switch to only registring events
log:set INFO org.openhab.binding.mysensors
// close karaf
<ctrl>DFor further reducing logs you can add them to logrotate