Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
F

FlipFlap3

@FlipFlap3
About
Posts
14
Topics
1
Shares
0
Groups
0
Followers
1
Following
0

Posts

Recent Best Controversial

  • OpenHAB 2.5 MySensors Serial Gateway - How to install
    F FlipFlap3

    [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 htop

    Java 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-8

    MySensors:
    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.cpp

    Uncomment 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.service

    OpenHAB2:
    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.service

    Time for coffee again.......

    open web page select expert....

    sudo usermod -a -G dialout openhab
    sudo usermod -a -G tty openhab

    cd /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:tail

    sudo reboot

    Finally:
    web-> paperui/things add MySensors Serial Gateway
    settings:
    Serial Port: /dev/ttyUSB0
    Send Delay: 200
    Baudrate: 115200
    Skip startup connection check: true

    All 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>D

    For further reducing logs you can add them to logrotate

    OpenHAB

  • OpenHAB 2.5 MySensors Serial Gateway - How to install
    F FlipFlap3

    @nizoo91 Just found out myself as well that this was missing. Thanks!

    OpenHAB

  • OpenHAB 2.5 MySensors Serial Gateway - How to install
    F FlipFlap3

    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 again

    I added openhab to the tty group using "sudo usermod -a -G tty openhab"

    full reboot

    and it works!

    OpenHAB

  • OpenHAB 2.5 MySensors Serial Gateway - How to install
    F FlipFlap3

    @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.

    OpenHAB
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular