Compare commits
No commits in common. "docs" and "main" have entirely different histories.
11
.gitignore
vendored
Normal file
11
.gitignore
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
# ---> Ansible
|
||||
*.retry
|
||||
plugins
|
||||
library
|
||||
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
7
.markdownlint.yml
Normal file
7
.markdownlint.yml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
default: True
|
||||
MD013: False
|
||||
MD041: False
|
||||
MD024: False
|
||||
MD004:
|
||||
style: dash
|
1
.prettierignore
Normal file
1
.prettierignore
Normal file
@ -0,0 +1 @@
|
||||
LICENSE
|
47
.woodpecker/docs.yaml
Normal file
47
.woodpecker/docs.yaml
Normal file
@ -0,0 +1,47 @@
|
||||
---
|
||||
when:
|
||||
- event: [pull_request]
|
||||
- event: [push, manual]
|
||||
branch:
|
||||
- ${CI_REPO_DEFAULT_BRANCH}
|
||||
|
||||
steps:
|
||||
- name: generate
|
||||
image: quay.io/thegeeklab/ansible-doctor
|
||||
environment:
|
||||
ANSIBLE_DOCTOR_EXCLUDE_FILES: "['molecule/']"
|
||||
ANSIBLE_DOCTOR_RENDERER__FORCE_OVERWRITE: "true"
|
||||
ANSIBLE_DOCTOR_LOGGING__LEVEL: info
|
||||
ANSIBLE_DOCTOR_ROLE__NAME: ${CI_REPO_NAME}
|
||||
ANSIBLE_DOCTOR_TEMPLATE__NAME: readme
|
||||
|
||||
- name: format
|
||||
image: quay.io/thegeeklab/alpine-tools
|
||||
commands:
|
||||
- prettier -w README.md
|
||||
|
||||
- name: diff
|
||||
image: quay.io/thegeeklab/alpine-tools
|
||||
commands:
|
||||
- git diff --color=always README.md
|
||||
|
||||
- name: publish
|
||||
image: quay.io/thegeeklab/wp-git-action
|
||||
settings:
|
||||
action:
|
||||
- commit
|
||||
- push
|
||||
author_email: ci-bot@rknet.org
|
||||
author_name: ci-bot
|
||||
branch: main
|
||||
message: "[skip ci] automated docs update"
|
||||
netrc_machine: gitea.rknet.org
|
||||
netrc_password:
|
||||
from_secret: gitea_token
|
||||
when:
|
||||
- event: [push, manual]
|
||||
branch:
|
||||
- ${CI_REPO_DEFAULT_BRANCH}
|
||||
|
||||
depends_on:
|
||||
- test
|
30
.woodpecker/lint.yaml
Normal file
30
.woodpecker/lint.yaml
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
when:
|
||||
- event: [pull_request, tag]
|
||||
- event: [push, manual]
|
||||
branch:
|
||||
- ${CI_REPO_DEFAULT_BRANCH}
|
||||
|
||||
steps:
|
||||
- name: ansible-lint
|
||||
image: quay.io/thegeeklab/ansible-dev-tools:1
|
||||
commands:
|
||||
- ansible-lint
|
||||
environment:
|
||||
FORCE_COLOR: "1"
|
||||
|
||||
- name: python-format
|
||||
image: docker.io/python:3.12
|
||||
commands:
|
||||
- pip install -qq ruff
|
||||
- ruff format --check --diff .
|
||||
environment:
|
||||
PY_COLORS: "1"
|
||||
|
||||
- name: python-lint
|
||||
image: docker.io/python:3.12
|
||||
commands:
|
||||
- pip install -qq ruff
|
||||
- ruff check .
|
||||
environment:
|
||||
PY_COLORS: "1"
|
26
.woodpecker/notify.yml
Normal file
26
.woodpecker/notify.yml
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
when:
|
||||
- event: [tag]
|
||||
- event: [push, manual]
|
||||
branch:
|
||||
- ${CI_REPO_DEFAULT_BRANCH}
|
||||
|
||||
runs_on: [success, failure]
|
||||
|
||||
steps:
|
||||
- name: matrix
|
||||
image: quay.io/thegeeklab/wp-matrix
|
||||
settings:
|
||||
homeserver:
|
||||
from_secret: matrix_homeserver
|
||||
room_id:
|
||||
from_secret: matrix_room_id
|
||||
user_id:
|
||||
from_secret: matrix_user_id
|
||||
access_token:
|
||||
from_secret: matrix_access_token
|
||||
when:
|
||||
- status: [failure]
|
||||
|
||||
depends_on:
|
||||
- docs
|
24
.woodpecker/test.yaml
Normal file
24
.woodpecker/test.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
---
|
||||
when:
|
||||
- event: [pull_request, tag]
|
||||
- event: [push, manual]
|
||||
branch:
|
||||
- ${CI_REPO_DEFAULT_BRANCH}
|
||||
|
||||
variables:
|
||||
- &molecule_base
|
||||
image: quay.io/thegeeklab/ansible-dev-tools:1
|
||||
group: molecule
|
||||
environment:
|
||||
PY_COLORS: "1"
|
||||
HCLOUD_TOKEN:
|
||||
from_secret: molecule_hcloud_token
|
||||
|
||||
steps:
|
||||
- name: molecule-default
|
||||
<<: *molecule_base
|
||||
commands:
|
||||
- molecule test -s default
|
||||
|
||||
depends_on:
|
||||
- lint
|
20
.yamllint
Normal file
20
.yamllint
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
extends: default
|
||||
|
||||
rules:
|
||||
truthy:
|
||||
allowed-values: ["True", "False"]
|
||||
comments:
|
||||
min-spaces-from-content: 1
|
||||
comments-indentation: False
|
||||
line-length: disable
|
||||
braces:
|
||||
min-spaces-inside: 0
|
||||
max-spaces-inside: 1
|
||||
brackets:
|
||||
min-spaces-inside: 0
|
||||
max-spaces-inside: 0
|
||||
indentation: enable
|
||||
octal-values:
|
||||
forbid-implicit-octal: True
|
||||
forbid-explicit-octal: True
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Robert Kaussow <mail@thegeeklab.de>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
||||
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -1,30 +1,29 @@
|
||||
---
|
||||
title: zigbee2mqtt_docker
|
||||
type: docs
|
||||
---
|
||||
# xoxys.zigbee2mqtt
|
||||
|
||||
[![Source Code](https://img.shields.io/badge/gitea-source%20code-blue?logo=gitea&logoColor=white)](https://gitea.rknet.org/ansible/xoxys.zigbee2mqtt) [![Build Status](https://img.shields.io/drone/build/ansible/xoxys.zigbee2mqtt?logo=drone&server=https%3A%2F%2Fdrone.rknet.org)](https://drone.rknet.org/ansible/xoxys.zigbee2mqtt) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitea.rknet.org/ansible/xoxys.zigbee2mqtt/src/branch/main/LICENSE)
|
||||
[![Build Status](https://ci.rknet.org/api/badges/ansible/xoxys.zigbee2mqtt/status.svg)](https://ci.rknet.org/repos/ansible/xoxys.zigbee2mqtt)
|
||||
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?label=license)](https://gitea.rknet.org/ansible/xoxys.zigbee2mqtt/src/branch/main/LICENSE)
|
||||
|
||||
Setup [zigbee2mqtt](https://github.com/Koenkk/zigbee2mqtt). Zigbee2mqtt allows you to use your Zigbee devices without the vendors bridge or gateway. It bridges events and allows you to control your Zigbee devices via MQTT.
|
||||
Setup [zigbee2mqtt](https://github.com/Koenkk/zigbee2mqtt). Zigbee2mqtt allows you to use your
|
||||
Zigbee devices without the vendors bridge or gateway. It bridges events and allows you to control
|
||||
your Zigbee devices via MQTT.
|
||||
|
||||
<!--more-->
|
||||
## Table of content
|
||||
|
||||
- [Requirements](#requirements)
|
||||
- [Default Variables](#default-variables)
|
||||
- [zigbee2mqtt_cache_state](#zigbee2mqtt_cache_state)
|
||||
- [zigbee2mqtt_cap_add](#zigbee2mqtt_cap_add)
|
||||
- [zigbee2mqtt_cap_drop](#zigbee2mqtt_cap_drop)
|
||||
- [zigbee2mqtt_channel](#zigbee2mqtt_channel)
|
||||
- [zigbee2mqtt_container_name](#zigbee2mqtt_container_name)
|
||||
- [zigbee2mqtt_cpu_shares](#zigbee2mqtt_cpu_shares)
|
||||
- [zigbee2mqtt_data_volume](#zigbee2mqtt_data_volume)
|
||||
- [zigbee2mqtt_device_options](#zigbee2mqtt_device_options)
|
||||
- [zigbee2mqtt_devices](#zigbee2mqtt_devices)
|
||||
- [zigbee2mqtt_devices_ban](#zigbee2mqtt_devices_ban)
|
||||
- [zigbee2mqtt_devices_whitelist](#zigbee2mqtt_devices_whitelist)
|
||||
- [zigbee2mqtt_docker_args](#zigbee2mqtt_docker_args)
|
||||
- [zigbee2mqtt_elapsed](#zigbee2mqtt_elapsed)
|
||||
- [zigbee2mqtt_exposed_ports](#zigbee2mqtt_exposed_ports)
|
||||
- [zigbee2mqtt_ext_pan_id](#zigbee2mqtt_ext_pan_id)
|
||||
- [zigbee2mqtt_extra_hosts](#zigbee2mqtt_extra_hosts)
|
||||
- [zigbee2mqtt_homeassistant_discovery_topic](#zigbee2mqtt_homeassistant_discovery_topic)
|
||||
- [zigbee2mqtt_homeassistant_enabled](#zigbee2mqtt_homeassistant_enabled)
|
||||
- [zigbee2mqtt_homeassistant_legacy_entity_attributes](#zigbee2mqtt_homeassistant_legacy_entity_attributes)
|
||||
@ -33,8 +32,6 @@ Setup [zigbee2mqtt](https://github.com/Koenkk/zigbee2mqtt). Zigbee2mqtt allows y
|
||||
- [zigbee2mqtt_image](#zigbee2mqtt_image)
|
||||
- [zigbee2mqtt_last_seen](#zigbee2mqtt_last_seen)
|
||||
- [zigbee2mqtt_log_level](#zigbee2mqtt_log_level)
|
||||
- [zigbee2mqtt_memory_limit](#zigbee2mqtt_memory_limit)
|
||||
- [zigbee2mqtt_memory_reservation](#zigbee2mqtt_memory_reservation)
|
||||
- [zigbee2mqtt_mqtt_base_topic](#zigbee2mqtt_mqtt_base_topic)
|
||||
- [zigbee2mqtt_mqtt_client_id](#zigbee2mqtt_mqtt_client_id)
|
||||
- [zigbee2mqtt_mqtt_include_device_information](#zigbee2mqtt_mqtt_include_device_information)
|
||||
@ -42,25 +39,26 @@ Setup [zigbee2mqtt](https://github.com/Koenkk/zigbee2mqtt). Zigbee2mqtt allows y
|
||||
- [zigbee2mqtt_mqtt_reject_unauthorized](#zigbee2mqtt_mqtt_reject_unauthorized)
|
||||
- [zigbee2mqtt_mqtt_server](#zigbee2mqtt_mqtt_server)
|
||||
- [zigbee2mqtt_mqtt_user](#zigbee2mqtt_mqtt_user)
|
||||
- [zigbee2mqtt_network](#zigbee2mqtt_network)
|
||||
- [zigbee2mqtt_network_key](#zigbee2mqtt_network_key)
|
||||
- [zigbee2mqtt_networks](#zigbee2mqtt_networks)
|
||||
- [zigbee2mqtt_networks_applied](#zigbee2mqtt_networks_applied)
|
||||
- [zigbee2mqtt_pan_id](#zigbee2mqtt_pan_id)
|
||||
- [zigbee2mqtt_permit_join](#zigbee2mqtt_permit_join)
|
||||
- [zigbee2mqtt_pids_limit](#zigbee2mqtt_pids_limit)
|
||||
- [zigbee2mqtt_restart_policy](#zigbee2mqtt_restart_policy)
|
||||
- [zigbee2mqtt_security_opt](#zigbee2mqtt_security_opt)
|
||||
- [zigbee2mqtt_security_opts](#zigbee2mqtt_security_opts)
|
||||
- [zigbee2mqtt_serial_disable_led](#zigbee2mqtt_serial_disable_led)
|
||||
- [zigbee2mqtt_serial_port](#zigbee2mqtt_serial_port)
|
||||
- [zigbee2mqtt_service_directory](#zigbee2mqtt_service_directory)
|
||||
- [zigbee2mqtt_service_stopped](#zigbee2mqtt_service_stopped)
|
||||
- [zigbee2mqtt_service_started](#zigbee2mqtt_service_started)
|
||||
- [zigbee2mqtt_timezone](#zigbee2mqtt_timezone)
|
||||
- [zigbee2mqtt_version](#zigbee2mqtt_version)
|
||||
- [zigbee2mqtt_volumes](#zigbee2mqtt_volumes)
|
||||
- [Dependencies](#dependencies)
|
||||
- [License](#license)
|
||||
- [Author](#author)
|
||||
|
||||
---
|
||||
|
||||
## Requirements
|
||||
|
||||
- Minimum Ansible version: `2.10`
|
||||
|
||||
## Default Variables
|
||||
|
||||
### zigbee2mqtt_cache_state
|
||||
@ -95,34 +93,12 @@ zigbee2mqtt_cap_drop: []
|
||||
zigbee2mqtt_channel: 11
|
||||
```
|
||||
|
||||
### zigbee2mqtt_container_name
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_container_name: zigbee2mqtt
|
||||
```
|
||||
|
||||
### zigbee2mqtt_cpu_shares
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_cpu_shares: _unset_
|
||||
```
|
||||
|
||||
#### Example usage
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_cpu_shares: '1024'
|
||||
```
|
||||
|
||||
### zigbee2mqtt_data_volume
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_data_volume: /opt/zigbee2mqtt/data
|
||||
zigbee2mqtt_data_volume: zigbee2mqtt-data
|
||||
```
|
||||
|
||||
### zigbee2mqtt_device_options
|
||||
@ -145,6 +121,12 @@ zigbee2mqtt_device_options:
|
||||
|
||||
Define required devices e.g. `/dev/ttyACM0`.
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_devices: []
|
||||
```
|
||||
|
||||
#### Example usage
|
||||
|
||||
```YAML
|
||||
@ -170,6 +152,15 @@ zigbee2mqtt_devices_ban: []
|
||||
zigbee2mqtt_devices_whitelist: []
|
||||
```
|
||||
|
||||
### zigbee2mqtt_docker_args
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_docker_args:
|
||||
- --pids-limit=-1
|
||||
```
|
||||
|
||||
### zigbee2mqtt_elapsed
|
||||
|
||||
#### Default value
|
||||
@ -180,6 +171,8 @@ zigbee2mqtt_elapsed: false
|
||||
|
||||
### zigbee2mqtt_exposed_ports
|
||||
|
||||
Ports you want to publish outside of docker.
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
@ -194,14 +187,6 @@ zigbee2mqtt_exposed_ports: []
|
||||
zigbee2mqtt_ext_pan_id: '[0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD]'
|
||||
```
|
||||
|
||||
### zigbee2mqtt_extra_hosts
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_extra_hosts: []
|
||||
```
|
||||
|
||||
### zigbee2mqtt_homeassistant_discovery_topic
|
||||
|
||||
#### Default value
|
||||
@ -247,7 +232,7 @@ zigbee2mqtt_homeassistant_status_topic: hass/status
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_image: koenkk/zigbee2mqtt:{{ zigbee2mqtt_version }}
|
||||
zigbee2mqtt_image: docker.io/koenkk/zigbee2mqtt:latest
|
||||
```
|
||||
|
||||
### zigbee2mqtt_last_seen
|
||||
@ -266,34 +251,6 @@ zigbee2mqtt_last_seen: disable
|
||||
zigbee2mqtt_log_level: info
|
||||
```
|
||||
|
||||
### zigbee2mqtt_memory_limit
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_memory_limit: _unset_
|
||||
```
|
||||
|
||||
#### Example usage
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_memory_limit: 512m
|
||||
```
|
||||
|
||||
### zigbee2mqtt_memory_reservation
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_memory_reservation: _unset_
|
||||
```
|
||||
|
||||
#### Example usage
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_memory_reservation: 256m
|
||||
```
|
||||
|
||||
### zigbee2mqtt_mqtt_base_topic
|
||||
|
||||
#### Default value
|
||||
@ -350,6 +307,16 @@ zigbee2mqtt_mqtt_server: mqtt://localhost:1883
|
||||
zigbee2mqtt_mqtt_user: _unset_
|
||||
```
|
||||
|
||||
### zigbee2mqtt_network
|
||||
|
||||
Use a custom docker network for grafana.
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_network: _unset_
|
||||
```
|
||||
|
||||
### zigbee2mqtt_network_key
|
||||
|
||||
#### Default value
|
||||
@ -364,34 +331,6 @@ zigbee2mqtt_network_key: _unset_
|
||||
zigbee2mqtt_network_key: '[1, 3, 5, 7, 9, 11, 13, 15, 0, 2, 4, 6, 8, 10, 12, 13]'
|
||||
```
|
||||
|
||||
### zigbee2mqtt_networks
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_networks:
|
||||
- name: default
|
||||
```
|
||||
|
||||
#### Example usage
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_networks:
|
||||
- name: default
|
||||
# optional network driver, defaults to 'bride'
|
||||
driver: host
|
||||
external: false
|
||||
```
|
||||
|
||||
### zigbee2mqtt_networks_applied
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_networks_applied:
|
||||
- default
|
||||
```
|
||||
|
||||
### zigbee2mqtt_pan_id
|
||||
|
||||
#### Default value
|
||||
@ -408,28 +347,12 @@ zigbee2mqtt_pan_id: '0x1a62'
|
||||
zigbee2mqtt_permit_join: true
|
||||
```
|
||||
|
||||
### zigbee2mqtt_pids_limit
|
||||
### zigbee2mqtt_security_opts
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_pids_limit: _unset_
|
||||
```
|
||||
|
||||
### zigbee2mqtt_restart_policy
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_restart_policy: always
|
||||
```
|
||||
|
||||
### zigbee2mqtt_security_opt
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_security_opt: []
|
||||
zigbee2mqtt_security_opts: []
|
||||
```
|
||||
|
||||
### zigbee2mqtt_serial_disable_led
|
||||
@ -454,20 +377,12 @@ zigbee2mqtt_serial_port: _unset_
|
||||
zigbee2mqtt_serial_port: ''
|
||||
```
|
||||
|
||||
### zigbee2mqtt_service_directory
|
||||
### zigbee2mqtt_service_started
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_service_directory: /var/lib/docker/services/zigbee2mqtt
|
||||
```
|
||||
|
||||
### zigbee2mqtt_service_stopped
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_service_stopped: false
|
||||
zigbee2mqtt_service_started: true
|
||||
```
|
||||
|
||||
### zigbee2mqtt_timezone
|
||||
@ -478,14 +393,6 @@ zigbee2mqtt_service_stopped: false
|
||||
zigbee2mqtt_timezone: Europe/Berlin
|
||||
```
|
||||
|
||||
### zigbee2mqtt_version
|
||||
|
||||
#### Default value
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_version: latest
|
||||
```
|
||||
|
||||
### zigbee2mqtt_volumes
|
||||
|
||||
Define required docker volumes.
|
||||
@ -496,27 +403,16 @@ Define required docker volumes.
|
||||
zigbee2mqtt_volumes:
|
||||
- name: '{{ zigbee2mqtt_data_volume }}'
|
||||
dest: /app/data
|
||||
bind: true
|
||||
```
|
||||
|
||||
#### Example usage
|
||||
|
||||
```YAML
|
||||
zigbee2mqtt_volumes:
|
||||
# Instead of the name you could specify a path on the container host system,
|
||||
# but you also have to enable bind mount for this volume
|
||||
- name: data
|
||||
# target location inside the container
|
||||
dest: /var/www/app/data
|
||||
# enable bind mount, if false volume will be configured as named volume
|
||||
# keep in mind you MUST set bind in any case
|
||||
bind: True
|
||||
# Options for bind mounts
|
||||
bind_opt: "ro,z"
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Dependencies
|
||||
|
||||
None.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
## Author
|
||||
|
||||
[Robert Kaussow](https://gitea.rknet.org/xoxys)
|
77
defaults/main.yml
Normal file
77
defaults/main.yml
Normal file
@ -0,0 +1,77 @@
|
||||
---
|
||||
zigbee2mqtt_image: "docker.io/koenkk/zigbee2mqtt:latest"
|
||||
|
||||
zigbee2mqtt_service_started: True
|
||||
|
||||
zigbee2mqtt_data_volume: zigbee2mqtt-data
|
||||
|
||||
# @var zigbee2mqtt_volumes:description: Define required docker volumes.
|
||||
zigbee2mqtt_volumes:
|
||||
- name: "{{ zigbee2mqtt_data_volume }}"
|
||||
dest: /app/data
|
||||
|
||||
# @var zigbee2mqtt_network:description: Use a custom docker network for grafana.
|
||||
# @var zigbee2mqtt_network:value: $ "_unset_"
|
||||
|
||||
# @var zigbee2mqtt_exposed_ports:description: Ports you want to publish outside of docker.
|
||||
zigbee2mqtt_exposed_ports: []
|
||||
|
||||
zigbee2mqtt_cap_add: []
|
||||
zigbee2mqtt_cap_drop: []
|
||||
zigbee2mqtt_security_opts: []
|
||||
|
||||
zigbee2mqtt_docker_args:
|
||||
- --pids-limit=-1
|
||||
|
||||
# @var zigbee2mqtt_devices:description: Define required devices e.g. `/dev/ttyACM0`.
|
||||
# @var zigbee2mqtt_devices:example: >
|
||||
# zigbee2mqtt_devices:
|
||||
# - src: "{{ zigbee2mqtt_serial_port }}"
|
||||
# dest: "{{ zigbee2mqtt_serial_port }}"
|
||||
# opt: z
|
||||
# @end
|
||||
zigbee2mqtt_devices: []
|
||||
|
||||
zigbee2mqtt_log_level: info
|
||||
|
||||
zigbee2mqtt_homeassistant_enabled: False
|
||||
zigbee2mqtt_permit_join: True
|
||||
|
||||
zigbee2mqtt_mqtt_base_topic: zigbee2mqtt
|
||||
zigbee2mqtt_mqtt_server: "mqtt://localhost:1883"
|
||||
# @var zigbee2mqtt_mqtt_user: $ "_unset_"
|
||||
# @var zigbee2mqtt_mqtt_password: $ "_unset_"
|
||||
zigbee2mqtt_mqtt_client_id: zigbee2mqtt
|
||||
zigbee2mqtt_mqtt_reject_unauthorized: False
|
||||
zigbee2mqtt_mqtt_include_device_information: False
|
||||
|
||||
# @var zigbee2mqtt_serial_port: $ "_unset_"
|
||||
# @var zigbee2mqtt_serial_port:example: $ ""
|
||||
zigbee2mqtt_serial_disable_led: False
|
||||
|
||||
zigbee2mqtt_pan_id: "0x1a62"
|
||||
zigbee2mqtt_ext_pan_id: "[0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD]"
|
||||
zigbee2mqtt_channel: 11
|
||||
zigbee2mqtt_cache_state: True
|
||||
|
||||
# @var zigbee2mqtt_network_key: $ "_unset_"
|
||||
# @var zigbee2mqtt_network_key:example: $ "[1, 3, 5, 7, 9, 11, 13, 15, 0, 2, 4, 6, 8, 10, 12, 13]"
|
||||
zigbee2mqtt_last_seen: "disable"
|
||||
zigbee2mqtt_elapsed: False
|
||||
|
||||
zigbee2mqtt_homeassistant_discovery_topic: homeassistant
|
||||
zigbee2mqtt_homeassistant_status_topic: "hass/status"
|
||||
zigbee2mqtt_homeassistant_legacy_entity_attributes: False
|
||||
zigbee2mqtt_homeassistant_legacy_triggers: False
|
||||
|
||||
zigbee2mqtt_devices_ban: []
|
||||
zigbee2mqtt_devices_whitelist: []
|
||||
|
||||
# @var zigbee2mqtt_device_options: $ "_unset"
|
||||
# @var zigbee2mqtt_device_options:example: >
|
||||
# zigbee2mqtt_device_options:
|
||||
# occupancy_timeout: 130
|
||||
# temperature_precision: 1
|
||||
# @end
|
||||
|
||||
zigbee2mqtt_timezone: Europe/Berlin
|
7
handlers/main.yml
Normal file
7
handlers/main.yml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
- name: Restart zigbee2mqtt
|
||||
ansible.builtin.service:
|
||||
name: "zigbee2mqtt.service"
|
||||
state: "{{ zigbee2mqtt_service_started | ternary('restarted', 'stopped', 'restarted') }}"
|
||||
daemon_reload: True
|
||||
listen: __zigbee2mqtt_restart
|
26
meta/main.yml
Normal file
26
meta/main.yml
Normal file
@ -0,0 +1,26 @@
|
||||
# Standards: 0.2
|
||||
---
|
||||
galaxy_info:
|
||||
# @meta author:value: [Robert Kaussow](https://gitea.rknet.org/xoxys)
|
||||
author: Robert Kaussow <mail@thegeeklab.de>
|
||||
namespace: xoxys
|
||||
role_name: zigbee2mqtt
|
||||
# @meta description: >
|
||||
# [![Build Status](https://ci.rknet.org/api/badges/ansible/xoxys.zigbee2mqtt/status.svg)](https://ci.rknet.org/repos/ansible/xoxys.zigbee2mqtt)
|
||||
# [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?label=license)](https://gitea.rknet.org/ansible/xoxys.zigbee2mqtt/src/branch/main/LICENSE)
|
||||
#
|
||||
# Setup [zigbee2mqtt](https://github.com/Koenkk/zigbee2mqtt). Zigbee2mqtt allows you to use your
|
||||
# Zigbee devices without the vendors bridge or gateway. It bridges events and allows you to control
|
||||
# your Zigbee devices via MQTT.
|
||||
# @end
|
||||
description: Setup zigbee2mqtt
|
||||
license: MIT
|
||||
min_ansible_version: "2.10"
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- "9"
|
||||
galaxy_tags:
|
||||
- zigbee
|
||||
- zigbee2mqtt
|
||||
dependencies: []
|
8
molecule/default/converge.yml
Normal file
8
molecule/default/converge.yml
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
vars:
|
||||
zigbee2mqtt_service_started: False
|
||||
roles:
|
||||
- role: xoxys.dockerengine
|
||||
- role: xoxys.zigbee2mqtt
|
17
molecule/default/molecule.yml
Normal file
17
molecule/default/molecule.yml
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
driver:
|
||||
name: molecule_hetznercloud
|
||||
dependency:
|
||||
name: galaxy
|
||||
options:
|
||||
role-file: requirements.yml
|
||||
requirements-file: requirements.yml
|
||||
platforms:
|
||||
- name: "rocky9-zigbee2mqtt"
|
||||
server_type: "cx22"
|
||||
image: "rocky-9"
|
||||
provisioner:
|
||||
name: ansible
|
||||
log: False
|
||||
verifier:
|
||||
name: testinfra
|
11
molecule/default/prepare.yml
Normal file
11
molecule/default/prepare.yml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
- name: Prepare
|
||||
hosts: all
|
||||
gather_facts: False
|
||||
tasks:
|
||||
- name: Bootstrap Python for Ansible
|
||||
ansible.builtin.raw: |
|
||||
command -v python3 python ||
|
||||
((test -e /usr/bin/apt && (apt -y update && apt install -y python-minimal)) ||
|
||||
echo "Warning: Python not boostrapped due to unknown platform.")
|
||||
changed_when: False
|
12
molecule/default/tests/test_default.py
Normal file
12
molecule/default/tests/test_default.py
Normal file
@ -0,0 +1,12 @@
|
||||
import os
|
||||
|
||||
import testinfra.utils.ansible_runner
|
||||
|
||||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||||
os.environ["MOLECULE_INVENTORY_FILE"]
|
||||
).get_hosts("all")
|
||||
|
||||
|
||||
def test_service_file(host):
|
||||
f = host.file("/etc/systemd/system/zigbee2mqtt.service")
|
||||
assert f.exists
|
17
pyproject.toml
Normal file
17
pyproject.toml
Normal file
@ -0,0 +1,17 @@
|
||||
[tool.ruff]
|
||||
exclude = [".git", "__pycache__"]
|
||||
|
||||
line-length = 99
|
||||
indent-width = 4
|
||||
|
||||
[tool.ruff.lint]
|
||||
ignore = ["W191", "E111", "E114", "E117", "S101", "S105"]
|
||||
select = ["F", "E", "I", "W", "S"]
|
||||
|
||||
[tool.ruff.format]
|
||||
quote-style = "double"
|
||||
indent-style = "space"
|
||||
line-ending = "lf"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
filterwarnings = ["ignore::FutureWarning", "ignore::DeprecationWarning"]
|
9
requirements.yml
Normal file
9
requirements.yml
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
collections:
|
||||
- name: community.docker
|
||||
|
||||
roles:
|
||||
- src: https://gitea.rknet.org/ansible/xoxys.dockerengine.git
|
||||
name: xoxys.dockerengine
|
||||
scm: git
|
||||
version: main
|
58
tasks/main.yml
Normal file
58
tasks/main.yml
Normal file
@ -0,0 +1,58 @@
|
||||
---
|
||||
- name: Create container volumes
|
||||
community.docker.docker_volume:
|
||||
name: "{{ item.name }}"
|
||||
driver_options: "{{ item.options | default(omit) }}"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
loop: "{{ zigbee2mqtt_volumes }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
when: item.type | default("volume") | lower == "volume"
|
||||
register: __zigbee2mqtt_volumes_raw
|
||||
|
||||
- name: Register container volumes map
|
||||
ansible.builtin.set_fact:
|
||||
__zigbee2mqtt_volumes_map: "{{ __zigbee2mqtt_volumes_raw.results | json_query('[].volume') | items2dict(key_name='Name', value_name='Mountpoint') }}"
|
||||
|
||||
- name: Deploy env file
|
||||
ansible.builtin.template:
|
||||
src: etc/sysconfig/zigbee2mqtt.j2
|
||||
dest: "/etc/sysconfig/zigbee2mqtt"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
notify: __zigbee2mqtt_restart
|
||||
|
||||
- name: Create container specs
|
||||
ansible.builtin.template:
|
||||
src: etc/systemd/system/zigbee2mqtt.service.j2
|
||||
dest: "/etc/systemd/system/zigbee2mqtt.service"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0640"
|
||||
notify: __zigbee2mqtt_restart
|
||||
|
||||
- name: Deploy configuration file
|
||||
ansible.builtin.template:
|
||||
src: "zigbee2mqtt/configuration.yaml.j2"
|
||||
dest: "{{ __zigbee2mqtt_volumes_map[zigbee2mqtt_data_volume] }}/configuration.yaml"
|
||||
mode: "0600"
|
||||
notify: __zigbee2mqtt_restart
|
||||
|
||||
- name: Ensure device files exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
mode: "0640"
|
||||
state: touch
|
||||
access_time: preserve
|
||||
modification_time: preserve
|
||||
loop:
|
||||
- "{{ __zigbee2mqtt_volumes_map[zigbee2mqtt_data_volume] }}/devices.yaml"
|
||||
- "{{ __zigbee2mqtt_volumes_map[zigbee2mqtt_data_volume] }}/groups.yaml"
|
||||
|
||||
- name: Ensure service state
|
||||
ansible.builtin.service:
|
||||
name: "zigbee2mqtt.service"
|
||||
state: "{{ zigbee2mqtt_service_started | ternary('started', 'stopped', 'started') }}"
|
||||
daemon_reload: True
|
||||
enabled: True
|
3
templates/etc/sysconfig/zigbee2mqtt.j2
Normal file
3
templates/etc/sysconfig/zigbee2mqtt.j2
Normal file
@ -0,0 +1,3 @@
|
||||
#jinja2: lstrip_blocks: True
|
||||
{{ ansible_managed | comment }}
|
||||
TZ={{ zigbee2mqtt_timezone }}
|
55
templates/etc/systemd/system/zigbee2mqtt.service.j2
Normal file
55
templates/etc/systemd/system/zigbee2mqtt.service.j2
Normal file
@ -0,0 +1,55 @@
|
||||
#jinja2: lstrip_blocks: True
|
||||
{{ ansible_managed | comment }}
|
||||
[Unit]
|
||||
Description=Zigbee2mqtt
|
||||
|
||||
Wants=docker.service
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
EnvironmentFile=/etc/environment
|
||||
|
||||
ExecStop=/usr/bin/docker pull {{ zigbee2mqtt_image }}
|
||||
ExecStop=/bin/sh -c '/usr/bin/docker ps | /bin/grep %p 1> /dev/null && /usr/bin/docker stop %p || true'
|
||||
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/docker ps | /bin/grep %p 1> /dev/null && /usr/bin/docker kill %p || true'
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/docker ps -a | /bin/grep %p 1> /dev/null && /usr/bin/docker rm %p || true'
|
||||
ExecStartPre=/usr/bin/docker pull {{ zigbee2mqtt_image }}
|
||||
|
||||
ExecStart=/usr/bin/docker run --rm \
|
||||
--name %p \
|
||||
--hostname %p \
|
||||
--env-file /etc/sysconfig/zigbee2mqtt \
|
||||
{% if zigbee2mqtt_network is defined and zigbee2mqtt_network %}
|
||||
--network {{ zigbee2mqtt_network }} \
|
||||
{% endif %}
|
||||
{% for cap in zigbee2mqtt_cap_add %}
|
||||
--cap-add {{ cap }} \
|
||||
{% endfor %}
|
||||
{% for cap in zigbee2mqtt_cap_drop %}
|
||||
--cap-drop {{ cap }} \
|
||||
{% endfor %}
|
||||
{% for opt in zigbee2mqtt_security_opts %}
|
||||
--security-opt "{{ opt }}" \
|
||||
{% endfor %}
|
||||
{% for volume in zigbee2mqtt_volumes %}
|
||||
--mount '{{ "type=bind," if (volume.type | default(False) | lower == "bind") else "" }}src={{ volume.name }},target={{ volume.dest }}' \
|
||||
{% endfor %}
|
||||
{% for device in zigbee2mqtt_devices %}
|
||||
--device "{{ device.src }}:{{ device.dest }}{% if device.opt is defined %}:{{ device.opt }}{% endif %}" \
|
||||
{% endfor %}
|
||||
{% for port in zigbee2mqtt_exposed_ports %}
|
||||
--publish {{ port }} \
|
||||
{% endfor %}
|
||||
{% for item in inst.docker_args | default(zigbee2mqtt_docker_args) %}
|
||||
{{ item }} \
|
||||
{% endfor %}
|
||||
--health-interval 5s \
|
||||
--health-retries 5 \
|
||||
--health-timeout 10s \
|
||||
{{ zigbee2mqtt_image }}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
67
templates/zigbee2mqtt/configuration.yaml.j2
Normal file
67
templates/zigbee2mqtt/configuration.yaml.j2
Normal file
@ -0,0 +1,67 @@
|
||||
#jinja2:lstrip_blocks: True
|
||||
---
|
||||
{{ ansible_managed | comment }}
|
||||
permit_join: {{ zigbee2mqtt_permit_join }}
|
||||
{% if zigbee2mqtt_homeassistant_enabled | bool %}
|
||||
|
||||
homeassistant:
|
||||
discovery_topic: "{{ zigbee2mqtt_homeassistant_discovery_topic }}"
|
||||
status_topic: "{{ zigbee2mqtt_homeassistant_status_topic }}"
|
||||
legacy_entity_attributes: {{ zigbee2mqtt_homeassistant_legacy_entity_attributes | bool }}
|
||||
legacy_triggers: {{ zigbee2mqtt_homeassistant_legacy_triggers | bool }}
|
||||
|
||||
{% endif %}
|
||||
mqtt:
|
||||
base_topic: "{{ zigbee2mqtt_mqtt_base_topic }}"
|
||||
server: "{{ zigbee2mqtt_mqtt_server }}"
|
||||
{% if zigbee2mqtt_mqtt_user is defined and zigbee2mqtt_mqtt_user and zigbee2mqtt_mqtt_password is defined and zigbee2mqtt_mqtt_password %}
|
||||
user: "{{ zigbee2mqtt_mqtt_user }}"
|
||||
password: "{{ zigbee2mqtt_mqtt_password }}"
|
||||
{% endif %}
|
||||
client_id: "{{ zigbee2mqtt_mqtt_client_id }}"
|
||||
reject_unauthorized: {{ zigbee2mqtt_mqtt_reject_unauthorized }}
|
||||
include_device_information: {{ zigbee2mqtt_mqtt_include_device_information }}
|
||||
{% if zigbee2mqtt_serial_port is defined and zigbee2mqtt_serial_port %}
|
||||
|
||||
serial:
|
||||
port: "{{ zigbee2mqtt_serial_port }}"
|
||||
disable_led: {{ zigbee2mqtt_serial_disable_led }}
|
||||
{% endif %}
|
||||
{% if zigbee2mqtt_devices_ban %}
|
||||
|
||||
# Ban devices from the network (by ieeeAddr)
|
||||
ban:
|
||||
{% for item in zigbee2mqtt_devices_ban %}
|
||||
- "{{ item }}"
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if zigbee2mqtt_devices_whitelist %}
|
||||
|
||||
# Whitelist devices from the network (by ieeeAddr)
|
||||
whitelist:
|
||||
{% for item in zigbee2mqtt_devices_whitelist %}
|
||||
- "{{ item }}"
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
advanced:
|
||||
pan_id: {{ zigbee2mqtt_pan_id }}
|
||||
ext_pan_id: {{ zigbee2mqtt_ext_pan_id }}
|
||||
{% if zigbee2mqtt_network_key is defined and zigbee2mqtt_network_key %}
|
||||
network_key: {{ zigbee2mqtt_network_key }}
|
||||
{% endif %}
|
||||
channel: {{ zigbee2mqtt_channel }}
|
||||
cache_state: {{ zigbee2mqtt_cache_state }}
|
||||
log_level: "{{ zigbee2mqtt_log_level }}"
|
||||
log_output:
|
||||
- console
|
||||
last_seen: "{{ zigbee2mqtt_last_seen }}"
|
||||
elapsed: {{ zigbee2mqtt_elapsed }}
|
||||
|
||||
{% if zigbee2mqtt_device_options is defined %}
|
||||
device_options:
|
||||
{{ zigbee2mqtt_device_options | to_nice_yaml | indent(2) }}
|
||||
|
||||
{% endif %}
|
||||
devices: "devices.yaml"
|
||||
groups: "groups.yaml"
|
Loading…
Reference in New Issue
Block a user