浏览代码

initial commit for zigbee2mqtt ansible deployment

master
Dirk Alders 1年前
父节点
当前提交
4f5c34e95b
共有 6 个文件被更改,包括 178 次插入0 次删除
  1. 4
    0
      .gitignore
  2. 30
    0
      bin/c2r.py
  3. 46
    0
      config/coordinator_backup.json
  4. 5
    0
      config/database.db
  5. 48
    0
      config/state.json
  6. 45
    0
      config_example/configuration.yaml

+ 4
- 0
.gitignore 查看文件

@@ -1,3 +1,7 @@
1
+# Zigbee2MQTT repo rule
2
+config/configuration.yaml
3
+config/log
4
+
1 5
 # ---> Linux
2 6
 *~
3 7
 

+ 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://<mqtt_smarthome_hostname>', s, flags=re.MULTILINE)
21
+n = re.sub('^.*user: .*', '  user: <mqtt_smarthome_username>', n, flags=re.MULTILINE)
22
+n = re.sub('^.*password: .*', '  password: <mqtt_smarthome_password>', n, flags=re.MULTILINE)
23
+n = re.sub('^.*auth_token: .*', '  auth_token: <zigbee_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)

+ 46
- 0
config/coordinator_backup.json 查看文件

@@ -0,0 +1,46 @@
1
+{
2
+  "metadata": {
3
+    "format": "zigpy/open-coordinator-backup",
4
+    "version": 1,
5
+    "source": "zigbee-herdsman@0.14.83-hotfix.0",
6
+    "internal": {
7
+      "date": "2023-10-07T18:12:31.420Z",
8
+      "ezspVersion": 8
9
+    }
10
+  },
11
+  "stack_specific": {
12
+    "ezsp": {
13
+      "hashed_tclk": "4a833488e7c2b3b158939439e211dd07"
14
+    }
15
+  },
16
+  "coordinator_ieee": "e0798dfffe8f943f",
17
+  "pan_id": "1a62",
18
+  "extended_pan_id": "dddddddddddddddd",
19
+  "nwk_update_id": 0,
20
+  "security_level": 5,
21
+  "channel": 20,
22
+  "channel_mask": [
23
+    11,
24
+    12,
25
+    13,
26
+    14,
27
+    15,
28
+    16,
29
+    17,
30
+    18,
31
+    19,
32
+    20,
33
+    21,
34
+    22,
35
+    23,
36
+    24,
37
+    25,
38
+    26
39
+  ],
40
+  "network_key": {
41
+    "key": "fa5f8cde589bee50a38c63f60bb52aba",
42
+    "sequence_number": 0,
43
+    "frame_counter": 2400085
44
+  },
45
+  "devices": []
46
+}

+ 5
- 0
config/database.db 查看文件

@@ -0,0 +1,5 @@
1
+{"id":1,"type":"Coordinator","ieeeAddr":"0xe0798dfffe8f943f","nwkAddr":0,"manufId":0,"epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":48879,"inClusterList":[0,3,6,10,25,26,768],"outClusterList":[0,3,4,5,6,8,32,768,1024,1026,1029,1030,1280,2817,2819,2820,1794,4096,64513,64514],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"interviewCompleted":true,"meta":{},"lastSeen":1674656577828,"defaultSendRequestWhen":"immediate"}
2
+{"id":2,"type":"Router","ieeeAddr":"0x000b57fffedadf27","nwkAddr":58239,"manufId":4476,"manufName":"IKEA of Sweden","powerSource":"Mains (single phase)","modelId":"FLOALT panel WS 30x90","epList":[1],"endpoints":{"1":{"profId":49246,"epId":1,"devId":544,"inClusterList":[0,3,4,5,6,8,768,2821,4096],"outClusterList":[5,25,32,4096],"clusters":{"genBasic":{"attributes":{"modelId":"FLOALT panel WS 30x90","manufacturerName":"IKEA of Sweden","powerSource":1,"zclVersion":1,"appVersion":18,"stackVersion":87,"hwVersion":1,"dateCode":"20200107","swBuildId":"1.2.224"}},"lightingColorCtrl":{"attributes":{"colorCapabilities":16,"colorTempPhysicalMin":250,"colorTempPhysicalMax":454}},"genOnOff":{"attributes":{"onOff":1}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":18,"stackVersion":87,"hwVersion":1,"dateCode":"20200107","swBuildId":"1.2.224","zclVersion":1,"interviewCompleted":true,"meta":{"configured":2},"lastSeen":1696438822055,"defaultSendRequestWhen":"immediate"}
3
+{"id":3,"type":"Router","ieeeAddr":"0x943469fffea68993","nwkAddr":43056,"manufId":4476,"manufName":"IKEA of Sweden","powerSource":"Mains (single phase)","modelId":"TRADFRI bulb E27 WW 806lm","epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":257,"inClusterList":[0,3,4,5,6,8,4096,64636],"outClusterList":[5,25,32,4096],"clusters":{"genBasic":{"attributes":{"modelId":"TRADFRI bulb E27 WW 806lm","manufacturerName":"IKEA of Sweden","powerSource":1,"zclVersion":3,"appVersion":32,"stackVersion":99,"hwVersion":2,"dateCode":"20181203","swBuildId":"2.3.050"}}},"binds":[],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[33],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":32,"stackVersion":99,"hwVersion":2,"dateCode":"20181203","swBuildId":"2.3.050","zclVersion":3,"interviewCompleted":true,"meta":{"configured":2},"lastSeen":1696714159411,"defaultSendRequestWhen":"immediate"}
4
+{"id":4,"type":"Router","ieeeAddr":"0x000d6ffffe62221e","nwkAddr":62289,"manufId":4476,"manufName":"IKEA of Sweden","powerSource":"Mains (single phase)","modelId":"FLOALT panel WS 30x90","epList":[1],"endpoints":{"1":{"profId":49246,"epId":1,"devId":544,"inClusterList":[0,3,4,5,6,8,768,2821,4096],"outClusterList":[5,25,32,4096],"clusters":{"genBasic":{"attributes":{"modelId":"FLOALT panel WS 30x90","manufacturerName":"IKEA of Sweden","powerSource":1,"zclVersion":1,"appVersion":18,"stackVersion":87,"hwVersion":1,"dateCode":"20200107","swBuildId":"1.2.224"}},"lightingColorCtrl":{"attributes":{"colorCapabilities":16,"colorTempPhysicalMin":250,"colorTempPhysicalMax":454}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":18,"stackVersion":87,"hwVersion":1,"dateCode":"20200107","swBuildId":"1.2.224","zclVersion":1,"interviewCompleted":true,"meta":{"configured":2},"lastSeen":1696708661934,"defaultSendRequestWhen":"immediate"}
5
+{"id":5,"type":"EndDevice","ieeeAddr":"0x84ba20fffe82ed95","nwkAddr":14844,"manufId":4098,"manufName":"_TZE200_hhrtiq0x","powerSource":"Battery","modelId":"TS0601","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[0,4,5,61184],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"65503":"�J�,\u0011","65506":31,"65508":0,"modelId":"TS0601","manufacturerName":"_TZE200_hhrtiq0x","stackVersion":0,"appVersion":85,"dateCode":""}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":85,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":1696780913825,"defaultSendRequestWhen":"immediate"}

+ 48
- 0
config/state.json 查看文件

@@ -0,0 +1,48 @@
1
+{
2
+    "0x000d6ffffe62221e": {
3
+        "color_mode": "color_temp",
4
+        "state": "ON",
5
+        "brightness": 77,
6
+        "color_temp": 413,
7
+        "update": {
8
+            "state": "idle",
9
+            "installed_version": 304235891,
10
+            "latest_version": 304235891
11
+        },
12
+        "linkquality": 204
13
+    },
14
+    "0x000b57fffedadf27": {
15
+        "color_mode": "color_temp",
16
+        "state": "ON",
17
+        "brightness": 26,
18
+        "color_temp": 413.2,
19
+        "update": {
20
+            "state": "idle",
21
+            "installed_version": 304235891,
22
+            "latest_version": 304235891
23
+        },
24
+        "linkquality": 184
25
+    },
26
+    "0x943469fffea68993": {
27
+        "brightness": 128,
28
+        "state": "ON",
29
+        "update": {
30
+            "state": "idle",
31
+            "installed_version": 587531825,
32
+            "latest_version": 587531825
33
+        },
34
+        "linkquality": 188
35
+    },
36
+    "0x84ba20fffe82ed95": {
37
+        "preset": "manual",
38
+        "away_mode": "OFF",
39
+        "system_mode": "heat",
40
+        "current_heating_setpoint": 23,
41
+        "window_detection": "ON",
42
+        "valve_detection": "ON",
43
+        "child_lock": "UNLOCK",
44
+        "local_temperature": 24.9,
45
+        "battery": 5,
46
+        "linkquality": 144
47
+    }
48
+}

+ 45
- 0
config_example/configuration.yaml 查看文件

@@ -0,0 +1,45 @@
1
+homeassistant: false
2
+permit_join: false
3
+mqtt:
4
+  base_topic: zigbee/ffw
5
+  server: mqtt://<mqtt_smarthome_hostname>
6
+  user: <mqtt_smarthome_username>
7
+  password: <mqtt_smarthome_password>
8
+serial:
9
+  port: /dev/ttyACM0
10
+advanced:
11
+  network_key:
12
+    - 179
13
+    - 176
14
+    - 181
15
+    - 98
16
+    - 2
17
+    - 239
18
+    - 245
19
+    - 151
20
+    - 75
21
+    - 138
22
+    - 221
23
+    - 249
24
+    - 179
25
+    - 16
26
+    - 209
27
+    - 176
28
+  ikea_ota_use_test_url: true
29
+  legacy_api: false
30
+  log_level: debug
31
+  channel: 20
32
+frontend:
33
+  port: 8038
34
+  host: 0.0.0.0
35
+  auth_token: <zigbee_auth_token>
36
+  url: http://localhost
37
+devices:
38
+  '0x000b57fffedadf27':
39
+    friendly_name: julian/main_light
40
+  '0x943469fffea68993':
41
+    friendly_name: sleep/main_light
42
+  '0x000d6ffffe62221e':
43
+    friendly_name: livingroom/main_light
44
+  '0x84ba20fffe82ed95':
45
+    friendly_name: bath/heating_valve

正在加载...
取消
保存