home automation training -16-integrate device to home assistant by Zigbee2MQTT
- Add the repository URL under Supervisor->Add-on store->…->Manage add-on repositories:
https://github.com/zigbee2mqtt/hassio-zigbee2mqtt
2. Zigbee2mqtt add-on Configuration for home assistant
data_path: /config/zigbee2mqtt
external_converters: []
devices: devices.yaml
groups: groups.yaml
homeassistant: true
permit_join: false
mqtt:
base_topic: zigbee2mqtt
server: mqtt://192.168.1.96:1883
user: mqtt
password: ‘123’
serial:
port: /dev/ttyACM0
advanced:
log_level: info
pan_id: 6754
channel: 11
network_key:
– 1
– 3
– 5
– 7
– 9
– 11
– 13
– 15
– 0
– 2
– 4
– 6
– 8
– 10
– 12
– 13
availability_blocklist: []
availability_passlist: []
device_options: {}
blocklist: []
passlist: []
queue: {}
frontend:
port: 8099
experimental: {}
socat:
enabled: false
master: pty,raw,echo=0,link=/tmp/ttyZ2M,mode=777
slave: tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5
options: ‘-d -d’3. feedback click action mqtt message:
1: single
2: double
3: triple
4: quadruple
5: many4. Xiaomi zigbee switch configure for home assistant by Zigbee2mqtt
sensor:
– platform: mqtt
name: Voltage
state_topic: “zigbee2mqtt/0x00158d00067ec29e”
value_template: “{{ value_json.battery }}”
unit_of_measurement: “%”
availability_topic: “zigbee2mqtt/bridge/state”
payload_available: “online”
payload_not_available: “offline”
qos: 0
device_class: battery– platform: mqtt
name: signal
state_topic: “zigbee2mqtt/0x00158d00067ec29e”
value_template: “{{ value_json.linkquality }}”
availability_topic: “zigbee2mqtt/bridge/state”
payload_available: “online”
payload_not_available: “offline”
qos: 0
device_class: signal_strength– platform: mqtt
name: click
state_topic: “zigbee2mqtt/0x00158d00067ec29e”
value_template: “{{ value_json.click }}”
availability_topic: “zigbee2mqtt/bridge/state”
payload_available: “online”
payload_not_available: “offline”Note: ID need replace with your device. such as ‘0x00158d00067ec29e’
5. create a new automation:
Trigger type: State
Entity: sensor.click
To: singleActions:
Action type: Call service
Service: Switch:Toggle
+ Pick entity