pi@raspberry:/ $ ls -l /dev/serial/by-id
total 0
lrwxrwxrwx. 1 root root 13 Oct 19 19:26 usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B0018ED3DDF-if00 -> ../../ttyACM0
2.安装
# 设置node.js库
sudo curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
# 注意:如果你看到下面的信息,请按该方法操作: https://gist.github.com/Koenkk/11fe6d4845f5275a2a8791d04ea223cb.
# ## You appear to be running on ARMv6 hardware. Unfortunately this is not currently supported by the NodeSource Linux distributions. Please use the 'linux-armv6l' binary tarballs available directly from nodejs.org for Node.js 4 and later.
# 重点:在这种情况下,安装Node.js请使用如下方法:sudo apt-get install -y git make g++ gcc
# 安装 Node.js;
sudo apt-get install -y nodejs git make g++ gcc
# 验证正确的nodejs和npm(自动安装nodejs)
#版本已安装
node --version # 应该输出 v12.X or v10.X
npm --version # 应该输出 6.X
# 克隆zigbee2mqtt库
sudo git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt
sudo chown -R pi:pi /opt/zigbee2mqtt
# 安装依赖项(作为用户“pi”)
cd /opt/zigbee2mqtt
npm install
zigbee2mqtt:info 2019-11-09T13:04:01: Logging to directory: '/opt/zigbee2mqtt/data/log/2019-11-09.14-04-01'
zigbee2mqtt:info 2019-11-09T13:04:01: Starting zigbee2mqtt version 1.6.0 (commit #720e393)
zigbee2mqtt:info 2019-11-09T13:04:01: Starting zigbee-herdsman...
zigbee2mqtt:info 2019-11-09T13:04:03: zigbee-herdsman started
zigbee2mqtt:info 2019-11-09T13:04:03: Coordinator firmware version: '{"type":"zStack30x","meta":{"transportrev":2,"product":2,"majorrel":2,"minorrel":7,"maintrel":2,"revision":20190425}}'
zigbee2mqtt:info 2019-11-09T13:04:03: Currently 0 devices are joined:
zigbee2mqtt:warn 2019-11-09T13:04:03: `permit_join` set to `true` in configuration.yaml.
zigbee2mqtt:warn 2019-11-09T13:04:03: Allowing new devices to join.
zigbee2mqtt:warn 2019-11-09T13:04:03: Set `permit_join` to `false` once you joined all devices.
zigbee2mqtt:info 2019-11-09T13:04:03: Zigbee: allowing new devices to join.
zigbee2mqtt:info 2019-11-09T13:04:03: Connecting to MQTT server at mqtt://localhost
zigbee2mqtt:info 2019-11-09T13:04:03: Connected to MQTT server