MySensor Gateway für openHAB 2 auf Raspberry 3 mit OpenHABian / Jessie
OpenHAB 2 bietet die Möglichkeit MySesnors einzubinden.
Bevor man MySensors auf dem raspberry verwenden kann, muss man vorab ein paar Dinge installieren.
Kritisch ist die NR24 library. Nach mehreren Versuchen hat nur die unten stehende funkioniert.
WiringPi
http://wiringpi.com/download-and-install/
cd $HOME/src
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build
gpio readall
SPI
# https://github.com/raspberrypi/linux/issues/1547
sudo nano /boot/config.txt
#add to the bottom of /boot/config.txt
device_tree_param=spi=on
dtoverlay=spi-bcm2708
sudo reboot
ls /dev/spi*
/dev/spidev0.0 /dev/spidev0.1
RF24 lib for raspberry
cd $HOME/src
git clone https://github.com/jscrane/RF24-rpi
cd RF24-rpi
make
sudo make install
cd examples
nano pingtest.cpp
# add: #include <unistd.h>
nano pingtest.cpp
# add: #include <unistd.h>
make
sudo make install
sudo pingtest
pi@raspberrypi:~ $ sudo pingtest
RF24/examples/pingtest/
ROLE: Ping out
================ SPI Configuration ================
CSN Pin = Custom GPIO7 (CE1) Software Driven
CE Pin = Custom GPIO22
Clock Speed = 8 Mhz
================ NRF Configuration ================
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xf0f0f0f0e1 0xf0f0f0f0d2
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0xf0f0f0f0e1
RX_PW_P0-6 = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x07
CONFIG = 0x3f
DYNPD/FEATURE = 0x3f 0x06
Data Rate = 1MBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MAX
Now sending 126…failed.
Failed, response timed out.
MySensor
https://www.mysensors.org/build/raspberry
cd $HOME/src
# git clone https://github.com/mysensors/MySensors.git –branch master
git clone https://github.com/mysensors/MySensors.git –branch development
cd MySensors
./configure –my-transport=nrf24 –my-gateway=ethernet –my-port=5003 –my-rf24-irq-pin=15 –my-leds-err-pin=12 –my-leds-rx-pin=16 –my-leds-tx-pin=18
make
sudo ./bin/mysgw -d
make install
sudo systemctl enable mysgw.service
sudo systemctl start mysgw.service