Just a short walkthrough of all steps which are necessary:
1.) insert the usbstick and check if this special device is there: /dev/ttyACM0
if this device is not showing up, it might be, that your kernel does not support usbserial. In my case i had to downgrade from ubuntu server 21.10 to 21.04.
2.) follow these steps: https://www.zigbee2mqtt.io/guide/installation/01_linux.html#installing
apt-get install -y nodejs git make g++ gcc npm
git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt
cd /opt/zigbee2mqtt
npm ci
if you get
prebuild-install WARN install EACCES: permission denied, access '/root/.npm/_cacache'
then you should not use root for running this command.
cd /opt/zigbee2mqtt
chown -R ubuntu node_modules
rm node_modules/*
npm ci
3.) install mqtt
apt install mosquitto mosquitto-clients
4.) add to /etc/mosquitto/mosqitto.conf the line
and restart mosquitto (systemctl restart mosquitto)listener 1883 127.0.0.1
5.) then start the zigbee2mqtt:
cd /opt/zigbee2mqtt
npm start
if you get
Zigbee2MQTT:error 2021-11-06 09:05:23: Error: Error while opening serialport 'Error: Error: No such device or address, cannot open /dev/ttyACM0'
then you did not really check step 1.): please check that /dev/ttyACM0 is missing - if yes: for me the kernel module (to list: lsmod) usbserial was missing. It seems, that ubuntu missed that on 21.10 - so i reinstalled 21.04....
if you get
zigbee2MQTT:error 2021-11-06 14:54:11: MQTT failed to connect: connect ECONNREFUSED 127.0.0.1:1883
then you did not get mosquitto running. Check with systemctl status mosquitto and follow step 3 and 4.
6.) configure telegraf, so that the data from mosquitto is transferred to influxdb. So you have to add to telegraf.conf:
[[inputs.mqtt_consumer]]
servers = ["tcp://127.0.0.1:1883"]
topics = [
"zigbee2mqtt/sensor/#",
]
data_format = "json"
[[outputs.influxdb]]
urls = ["unix:///var/run/influxdb/influxdb.sock"]
username = "admin"
password = "XXXXX"
7.) add this user to influxdb:
influx -ssl -unsafeSsl (only influx if you have not enabled SSL)
create user admin with password 'XXXXXXX' with all privileges
8.) if you have joined a device this the zigbee2mqtt, then you have to give a friendy name inside /opt/zigbee2mqtt/data/configuration.yaml
friendly_name: 'sensor/t1'
No comments:
Post a Comment