Bpazy / blog

我的博客,欢迎关注和讨论
https://github.com/Bpazy/blog/issues
MIT License
41 stars 2 forks source link

Zigbee2MQTT #263

Open Bpazy opened 1 year ago

Bpazy commented 1 year ago

Zigbee2MQTT 是一款开源的用于接入 Zigbee 设备的软件,可将 Zigbee 设备接入后,并接受或发送消息到 MQTT Broker,进而与 Home Assistant 等平台去做处理。

Bpazy commented 1 year ago

安装配置

docker-compose:

version: '3.8'
services:
  zigbee2mqtt:
    container_name: zigbee2mqtt
    image: koenkk/zigbee2mqtt:1.32.2
    restart: unless-stopped
    volumes:
      - /home/ziyuan/zigbee2mqtt/data:/app/data
      - /run/udev:/run/udev:ro
    ports:
      # Frontend port
      - 7777:8080
    environment:
      - TZ=Asia/Shanghai
    # devices:
      # Make sure this matched your adapter location
      # - /dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B0018ED3DDF-if00:/dev/ttyACM0

下面编辑配置文件 /home/ziyuan/zigbee2mqtt/data/configuration.yaml:

homeassistant: true
permit_join: true
mqtt:
  base_topic: zigbee2mqtt
  server: mqtt://192.168.31.31:1885
serial:
        # port: tcp://192.168.31.200:8888
  adapter: ezsp
advanced:
  log_level: debug
frontend: true
external_converters:
  #  - TS0603.js

注意这里指定了 homeassistant: true 会导致 state 变为瞬时值,处理自动化时需要注意