소스 검색

Init configuration for zigbee2mqtt

master
Dirk Alders 4 일 전
부모
커밋
423b8c8af9
3개의 변경된 파일55개의 추가작업 그리고 0개의 파일을 삭제
  1. 30
    0
      bin/c2r.py
  2. 0
    0
      config/.gitkeep
  3. 25
    0
      config_example/configuration.j2

+ 30
- 0
bin/c2r.py 파일 보기

@@ -0,0 +1,30 @@
1
+#!/bin/python3
2
+#
3
+import re
4
+import sys
5
+
6
+try:
7
+    src_file = sys.argv[1]
8
+    dst_file = sys.argv[2]
9
+except IndexError:
10
+    print(sys.argv[0], "<src> <dst>")
11
+    sys.exit(17)
12
+
13
+try:
14
+    with open(src_file, 'r') as fh:
15
+        s = fh.read()
16
+except (PermissionError, FileNotFoundError) as e:
17
+    print("Unable to open", '"' + src_file + '"')
18
+    sys.exit(18)
19
+
20
+n = re.sub('^.*server: .*', '  server: mqtt://{{ smart_sat_zigbee2mqtt_hostname }}', s, flags=re.MULTILINE)
21
+n = re.sub('^.*user: .*', '  user: {{ smart_sat_zigbee2mqtt_username }}', n, flags=re.MULTILINE)
22
+n = re.sub('^.*password: .*', '  password: {{ smart_sat_zigbee2mqtt_password  }}', n, flags=re.MULTILINE)
23
+n = re.sub('^.*auth_token: .*', '  auth_token: {{ smart_sat_zigbee2mqtt_auth_token }}', n, flags=re.MULTILINE)
24
+
25
+try:
26
+    with open(dst_file, 'w') as fh:
27
+        fh.write(n)
28
+except PermissionError:
29
+    print("Unable to write", '"' + dst_file + '"')
30
+    sys.exit(19)

+ 0
- 0
config/.gitkeep 파일 보기


+ 25
- 0
config_example/configuration.j2 파일 보기

@@ -0,0 +1,25 @@
1
+homeassistant: false
2
+permit_join: false
3
+mqtt:
4
+  base_topic: zigbee_gfe
5
+  server: mqtt://{{ smart_sat_zigbee2mqtt_hostname }}
6
+  user: {{ smart_sat_zigbee2mqtt_username }}
7
+  password: {{ smart_sat_zigbee2mqtt_password  }}
8
+serial:
9
+  port: /dev/ttyttyUSB0
10
+  channel: 5
11
+advanced:
12
+    # Let Zigbee2MQTT generate a network key on first start
13
+    network_key: GENERATE
14
+    # Let Zigbee2MQTT generate a pan_id on first start
15
+    pan_id: GENERATE
16
+    # Let Zigbee2MQTT generate a ext_pan_id on first start
17
+    ext_pan_id: GENERATE
18
+frontend:
19
+  port: 8038
20
+  host: 0.0.0.0
21
+  auth_token: {{ smart_sat_zigbee2mqtt_auth_token }}
22
+  url: http://localhost
23
+device_options:
24
+  legacy: false
25
+

Loading…
취소
저장