Quellcode durchsuchen

Initial data for ansible added

master
Dirk Alders vor 1 Monat
Ursprung
Commit
f11a8f42c9
3 geänderte Dateien mit 61 neuen und 6 gelöschten Zeilen
  1. 10
    6
      .gitignore
  2. 30
    0
      bin/c2r.py
  3. 21
    0
      config_example/configuration.j2

+ 10
- 6
.gitignore Datei anzeigen

@@ -1,9 +1,6 @@
1
-# ---> Backup
2
-*.bak
3
-*.gho
4
-*.ori
5
-*.orig
6
-*.tmp
1
+# Zigbee2MQTT repo rule
2
+config/configuration.yaml
3
+config/log
7 4
 
8 5
 # ---> Linux
9 6
 *~
@@ -20,3 +17,10 @@
20 17
 # .nfs files are created when an open file is removed but is still being accessed
21 18
 .nfs*
22 19
 
20
+# ---> Backup
21
+*.bak
22
+*.gho
23
+*.ori
24
+*.orig
25
+*.tmp
26
+

+ 30
- 0
bin/c2r.py Datei anzeigen

@@ -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)

+ 21
- 0
config_example/configuration.j2 Datei anzeigen

@@ -0,0 +1,21 @@
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/ttyACM0
10
+advanced:
11
+  network_key: GENERATE
12
+  ikea_ota_use_test_url: true
13
+  legacy_api: false
14
+  channel: 25
15
+  homeassistant_legacy_entity_attributes: false
16
+  legacy_availability_payload: false
17
+frontend:
18
+  port: 8038
19
+  host: 0.0.0.0
20
+  auth_token: {{ smart_sat_zigbee2mqtt_auth_token }}
21
+  url: http://localhost

Laden…
Abbrechen
Speichern