Tag: ZigBee

  • Install Z-Stick & ConBee II on RPI/Openhabian

    Here is how to configure properly an Aeotec Z-Stick Gen5 and a Conbee II stick on a RPI 4 installed with Openhabian (running OpenHab 3)

    Click to Read More

    First, be sure that openhabian can access the serial ports. The easiest is to configure that via openhabian-config > System Settings > Serial Port:

    sudo openhabian-config 

    You can also do it with raspi-config > Interfacing Options > Serial :

    sudo apt-get install raspi-config
    sudo raspi-config

    > Would you like a login shell accessible over serial? → No
    > Would you like the serial port hardware to be enabled? → Yes

     

    Next, check that the sticks are well plugged with the command:

    lsusb

    You should see something like

    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 011: ID 1cf1:0030 Dresden Elektronik ZigBee gateway [ConBee II]
    Bus 001 Device 005: ID 0658:0200 Sigma Designs, Inc. Aeotec Z-Stick Gen5 (ZW090) – UZB
    Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

    In order to always have the USB sticks mounted on the same “port”, instead of being assigned once on /dev/ttyACM0, once on /dev/ttyACM1, … create a UDEV Rule file:

    sudo nano /etc/udev/rules.d/99-usb-serial.rules

    Type the following, using the ID of the USB sticks found above, in this file:

    SUBSYSTEM==”tty”, ATTRS{idVendor}==”0658“, ATTRS{idProduct}==”0200“, SYMLINK+=”ttyUSB-ZWave”, GROUP=”dialout”, MODE=”0666″
    SUBSYSTEM==”tty”, ATTRS{idVendor}==”1cf1“, ATTRS{idProduct}==”0030“, SYMLINK+=”ttyUSB-ZigBee”, GROUP=”dialout”, MODE=”0666″

    If you didn’t prepare openhabian for ZigBee via sudo openhabian-config > System Settings > Serial Port, grant the following access for openhab :

    sudo adduser openhab dialout
    sudo adduser openhab tty

    Now, reboot (sudo reboot) and test if symlink was created with the command :

    ls /dev/tty*

    You should see

    /dev/ttyUSB-ZigBee
    /dev/ttyUSB-ZWave

    Add edit openhab config file to add the symlinks to the PATH variable for Java (NB: for openhab 2, the file is namge openhab2 !!):

    sudo nano /etc/default/openhab

    Search the line with EXTRA_JAVE_OPTS and modify accordingly to complete the parameter ‘Dgnu.io.rxtx.SerialPorts’:

    EXTRA_JAVA_OPTS=”-Xms192m -Xmx320m -Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB-ZWave:/dev/ttyUSB-ZigBee

    Now, reboot again (sudo reboot) and install Phoscon, the application to manage the ZigBee devices. The easiest is to install it (on port 8081 as recommended) via openhabian-config > Optional Components > deCONZ:

    sudo openhabian-config

    You can also look here on the phoscon website for a manual setup

    If you have a RPI 4B, also update the WiringPI like this:

    cd /tmp
    wget https://project-downloads.drogon.net/wiringpi-latest.deb
    sudo dpkg -i wiringpi-latest.deb

    You can now open phoscon to login and search for ZigBee devices on http://<your RPI IP>:8081

    If after a reboot, this UI is not available, then enable manually the service:

    sudo systemctl enable deconz

    If you want to change the port of Phoscon, edit the parameter ‘http-port’ in this file:

    sudo nano /lib/systemd/system/deconz.service

     

    Finally, install the following addons (Bindings) in OpenHab :

    • “Dresden Elektronik deCONZ Binding”
    • “Z-Wave Binding”

    The ConBee gateway will be detected automatically by OpenHab and appear twice in the ‘Inbox’: once as Deconz and once as Hue (indeed, it emulates a Philips Hue Bridge). If it was not detected automatically, open the Phoscon UI > Gateway > Advanced (Gear Icon at the bottom of the page) and CLick on “Authenticat App”. Then add the Thing manually into OpenHab using the Scan button of:

    OpenHab UI > Administration > Parameters > Things > + (Add Thing) > Dresden Elektronik deCONZ Binding

     

    The Zwave gateway will only appear if you add it explicitly into OpenHab:

    OpenHab UI > Administration > Parameters > Things > + (Add Thing) > Z-Wave Binding > Z-Wave Serial Controller

    In the field Serial Port, type manually ‘/dev/ttyUSB-ZWave’ (without the quotes) and click ‘Create Thing’

    Wait for about 10 seconds and the gateway will soon become online.

    Et voilà.

    Loading

  • Xiamo Aqara and Openhab on Raspberry Pi

    A few notes on using Xiaomi Aqara Sensors and Switches with Openhab 3.

    Click to Read More

    I am using a Zigbee USB key Conbee II from Dresen Eletronik.

    It is plugged into the Raspberry Pi with a USB cable extension to put it away from the other keys used on this RPi, like my Sigma Z-Wave controller.

    I am sing OpenHab 3 (previously OpenHab 2).

    Opposite to the Sigma Z-Wave USB key, there is not mount issue after a reboot due to the usb port id increasing… (See also a solution in French).

    I am using the Phoscon App to connect and manage devices via the Conbee II key. The App is accessible on the http port 80 of the Raspberry.

    To connect a new Xiaomi Aqara device,

    1. “Add a Sensor” or a “Add a Switch” within Phoscon. Pick the type “Other”.
    2. Press the reset button for 5 sec. The blue led should turn on and start blinking after 5 sec. Release the button immediately when it starts blinking. The led will then turn on for 2 or 3 sec and then blink 3 times. It means that the connection is established.
    3. A few second later, the device will appear in Phoscon.

    To get the Things into Openhab, Add the Binding “Dresen Eletronik DeCONZ Binding” and “Scan” for devices.

    I am using with success:

    • Multi Sensors : with values for Temperature, Humidity and Pressure
    • Door and Window Sensors: with Status Opened / Closed
    • A Cube : with events Pushed (various direction), Rotation, Shacked
    • Wireless Mini Switch : One Button Control with 4 events: Single Press, Double Press, Long Press and Long Press Release

     

    Notice: 

    • after a few month using the Door Sensors on my Garage Door, it stopped to send events… The problem was that the captor part was attached on a metal upright which ended to be magnetized by the magnet part moving around…

    Loading