- Sonoff zigbee3.0 - P (https://www.amazon.es/dp/B09KXTCMSC)
- Coordinator firmware here from https://www.zigbee2mqtt.io/guide/adapters/#recommended
- Unzip all 3 files.
- Install the usb driver by right click over
silabser
file and click install. - Disassemble Sonoff dongle by unscrewing the 2 screws from the antenna side.
- Open the ZigStar GW Multi tool .
- Hold the 'boot' button from Sonoff dongle (the one closer the the usb connector) meanwhile you connect it to your computer. Unhold when plugged.
- Search for the COM port of the Sonoff dongle in Zigstar tool, upload the
coordinator firmware
already downloaded and check the ERASE, WRITE and Verify checkboxes and click Start and wait until is firmware is uploaded.
Run
/sbin/modprobe usbserial
/sbin/modprobe ftdi_sio
/sbin/modprobe cdc-acm
By running uname -a
or checking it in What kind of CPU does my NAS have
- Go to https://github.com/robertklep/dsm7-usb-serial-drivers and download the
cp210x
driver from themodules/
folder. For example in my case a DS920+ is a
, so it the file will be located here: https://github.com/robertklep/dsm7-usb-serial-drivers/blob/main/modules/geminilake/dsm-7.2/cp210x.ko
-
Copy the link from step 1 but replace the subfolder
/blob/
by/raw/
to have the link that will download the binary file (raw file) and not the html page. In that example will be: https://github.com/robertklep/dsm7-usb-serial-drivers/raw/main/modules/geminilake/dsm-7.2/cp210x.ko -
Go to /lib/modules folder from ssh:
cd /lib/modules
-
Run:
wget https://github.com/robertklep/dsm7-usb-serial-drivers/raw/main/modules/geminilake/dsm-7.2/cp210x.ko
to download the driver to the current /lib/modules folder. You can also runcat cp210x.ko
to check it doesn't print HTML code and it's an unreadable binary file.
WRONG file:
CORRECT file:
Now we download a script so that it always loads the driver when starting the system.
- Move to
cd /usr/local/etc/rc.d
. - Download the script with
wget https://github.com/robertklep/dsm7-usb-serial-drivers/raw/main/usb-serial-drivers.sh
. - Give execute permission to the script
chmod +x /usr/local/etc/rc.d/usb-serial-drivers.sh
. - Plug your Sonoff dongle if is not already connected and run the script
./usb-serial-drivers.sh start
. - Check if it's detected by running:
ls /dev/ttyU*
which it will show/dev/ttyUSB0
if it's detected.
- Create synology volume folders for the mqtt docker
/volume1/docker/mosquitto/config
/volume1/docker/mosquitto/data
/volume1/docker/mosquitto/log
- Create the file mosquitto.conf in the /volume1/docker/mosquitto/config folder already created before
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
allow_anonymous false
listener 1883
- docker-compose for the mqtt container to copy-paste to your new stack (in Portainer) and deploy it:
version: '3.8'
services:
mqtt:
container_name: mqtt
image: eclipse-mosquitto:latest
restart: always
volumes:
- "/volume1/docker/mosquitto/config:/mosquitto/config"
- "/volume1/docker/mosquitto/data:/mosquitto/data"
- "/volume1/docker/mosquitto/log:/mosquitto/log"
ports:
- "1883:1883"
- "9001:9001"
network_mode: host
- When docker is running, connect to the mqtt docker bash/console to create a user ('lluis' in this example) with password hashed in a file:
>> mosquitto_passwd -c /mosquitto/config/password.txt lluis
and then you will see a password.txt created in the same directory where you created the mosquitto.conf
- Modify the mosquitto.conf from step 2 with this (is the same but adding the password_file in last line):
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
allow_anonymous false
listener 1883
password_file /mosquitto/config/password.txt
- Restart mqtt container to apply the new config
- Create synology volume folder for the zigbee2mqtt docker
/volume1/docker/zigbee2mqtt
- docker-compose for the zigbee2mqtt container to copy-paste to your new stack (in Portainer) and deploy it:
version: '3.8'
services:
zigbee2mqtt:
container_name: zigbee2mqtt
restart: always
image: koenkk/zigbee2mqtt:latest
volumes:
- /volume1/docker/zigbee2mqtt:/app/data
- /run/udev:/run/udev:ro
ports:
- 8020:8020
environment:
- TZ=Europe/Madrid
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
(In my case I use port 8020 for the zigbee2mqtt web interface)
- Go to
/volume1/docker/zigbee2mqtt
and edit the configuration.yaml (easy way is to install synology text editor app)
homeassistant: true
permit_join: false
mqtt:
base_topic: zigbee2mqtt
server: mqtt://192.168.0.160 #your NAS ip
keepalive: 60
password: (mqtt password)
reject_unauthorized: true
user: (mqtt user)
serial:
port: /dev/ttyUSB0 #dongle usb sonoff
frontend:
port: 8020 #zigbee2mqtt web interface port
- Check http://19.168.0.160:8020 is working.
- Check zigbee2mqtt container logs to ensure all is working fine:
- Go to Settings - Integrations - Add integration and search for MQTT
- Use
127.0.0.1
as Broker adress and1883
as Port and finish.
-
Go to http://19.168.0.160:8020 (zigbee2mqtt)
-
Press 'Allow join (All)' button. This wil set to TRUE the permit_join property of the /volume1/docker/zigbee2mqtt/configuration.yaml
- Press 5 seconds your pairing button of your zigbee device (a sensor, a cover...) and in few seconds it will appear in the list
- Go to Home Assistant and it will be show in the settings - Integrations - mqtt:
Synology Security Advisor app it can warn to you that some unkown script is detected. Omit it because if you Resolve it by Security Advisor then the usb-serial-drivers.sh start
content will be commented with a # in each line and Sonff dongle won't work during a reboot. Also it can remove the execute permission, so you will need to give it again by chmod +x /usr/local/etc/rc.d/usb-serial-drivers.sh
Security Advisor app:
Commented script:
You can always check with cat /usr/local/etc/rc.d/usb-serial-drivers.sh
if all the script is commented and undo it:
- open the editor
sudo vi usb-serial-drivers.sh
. - press
i
to INSERT text. - Go line by line to delete only one # character per line (take into account that first line has ##!bin/sh and needs to be #!bin/sh).
- press ESC.
- write
:wq!
. - press ENTER.
- Check by
cat usb-serial-drivers.sh
that file its again ok.
Use an usb extender cable to put the zigbee dongle usb far from your NAS and also from cables like the ones that go to an external dock HDD. https://youtu.be/tHqZhNcFEvA
Check if 'ls /dev/ttyU*' shows the sonoff driver and the cp210x.ko file is still in '/lib/modules', if not download it again from the step "Download and install the driver" and start it again.
thank you lluis for this manual and for your time.