Init configuration for zigbee2mqtt

This commit is contained in:
Dirk Alders 2024-12-18 19:55:57 +01:00
parent 96a6c6c9db
commit 423b8c8af9
3 changed files with 55 additions and 0 deletions

30
bin/c2r.py Executable file
View File

@ -0,0 +1,30 @@
#!/bin/python3
#
import re
import sys
try:
src_file = sys.argv[1]
dst_file = sys.argv[2]
except IndexError:
print(sys.argv[0], "<src> <dst>")
sys.exit(17)
try:
with open(src_file, 'r') as fh:
s = fh.read()
except (PermissionError, FileNotFoundError) as e:
print("Unable to open", '"' + src_file + '"')
sys.exit(18)
n = re.sub('^.*server: .*', ' server: mqtt://{{ smart_sat_zigbee2mqtt_hostname }}', s, flags=re.MULTILINE)
n = re.sub('^.*user: .*', ' user: {{ smart_sat_zigbee2mqtt_username }}', n, flags=re.MULTILINE)
n = re.sub('^.*password: .*', ' password: {{ smart_sat_zigbee2mqtt_password }}', n, flags=re.MULTILINE)
n = re.sub('^.*auth_token: .*', ' auth_token: {{ smart_sat_zigbee2mqtt_auth_token }}', n, flags=re.MULTILINE)
try:
with open(dst_file, 'w') as fh:
fh.write(n)
except PermissionError:
print("Unable to write", '"' + dst_file + '"')
sys.exit(19)

0
config/.gitkeep Normal file
View File

View File

@ -0,0 +1,25 @@
homeassistant: false
permit_join: false
mqtt:
base_topic: zigbee_gfe
server: mqtt://{{ smart_sat_zigbee2mqtt_hostname }}
user: {{ smart_sat_zigbee2mqtt_username }}
password: {{ smart_sat_zigbee2mqtt_password }}
serial:
port: /dev/ttyttyUSB0
channel: 5
advanced:
# Let Zigbee2MQTT generate a network key on first start
network_key: GENERATE
# Let Zigbee2MQTT generate a pan_id on first start
pan_id: GENERATE
# Let Zigbee2MQTT generate a ext_pan_id on first start
ext_pan_id: GENERATE
frontend:
port: 8038
host: 0.0.0.0
auth_token: {{ smart_sat_zigbee2mqtt_auth_token }}
url: http://localhost
device_options:
legacy: false