Browse Source

initial commit for zigbee2mqtt ansible deployment

master
Dirk Alders 1 year ago
parent
commit
e972258e83
7 changed files with 226 additions and 0 deletions
  1. 3
    0
      .gitignore
  2. 47
    0
      bin/c2r.py
  3. 46
    0
      config/coordinator_backup.json
  4. 9
    0
      config/database.db
  5. 79
    0
      config/state.json
  6. 0
    0
      config_example/.gitkeep
  7. 42
    0
      config_example/configuration.yaml

+ 3
- 0
.gitignore View File

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

+ 47
- 0
bin/c2r.py View File

@@ -0,0 +1,47 @@
1
+#!/bin/python3
2
+#
3
+import re
4
+import sys
5
+
6
+s = """homeassistant: false
7
+permit_join: false
8
+mqtt:
9
+  base_topic: zigbee/gfw
10
+  server: mqtt://mqtt
11
+  user: smarthome
12
+  password: Tc1IsZENNnSldRu8CGA6
13
+serial:
14
+  port: /dev/ttyACM0
15
+advanced:
16
+  ikea_ota_use_test_url: true
17
+  legacy_api: false
18
+  log_level: debug
19
+  channel: 15
20
+  homeassistant_legacy_entity_attributes: false
21
+  legacy_availability_payload: false
22
+"""
23
+try:
24
+    src_file = sys.argv[1]
25
+    dst_file = sys.argv[2]
26
+except IndexError:
27
+    print(sys.argv[0], "<src> <dst>")
28
+    sys.exit(17)
29
+
30
+try:
31
+    with open(src_file, 'r') as fh:
32
+        s = fh.read()
33
+except (PermissionError, FileNotFoundError) as e:
34
+    print("Unable to open", '"' + src_file + '"')
35
+    sys.exit(18)
36
+
37
+n = re.sub('^.*server: .*', '  server: <mqtt_smarthome_hostname>', s, flags=re.MULTILINE)
38
+n = re.sub('^.*user: .*', '  user: <mqtt_smarthome_username>', n, flags=re.MULTILINE)
39
+n = re.sub('^.*password: .*', '  password: <mqtt_smarthome_password>', n, flags=re.MULTILINE)
40
+n = re.sub('^.*auth_token: .*', '  auth_token: <zigbee_auth_token>', n, flags=re.MULTILINE)
41
+
42
+try:
43
+    with open(dst_file, 'w') as fh:
44
+        fh.write(n)
45
+except PermissionError:
46
+    print("Unable to write", '"' + dst_file + '"')
47
+    sys.exit(19)

+ 46
- 0
config/coordinator_backup.json View File

@@ -0,0 +1,46 @@
1
+{
2
+  "metadata": {
3
+    "format": "zigpy/open-coordinator-backup",
4
+    "version": 1,
5
+    "source": "zigbee-herdsman@0.16.0",
6
+    "internal": {
7
+      "date": "2023-10-07T17:24:28.826Z",
8
+      "ezspVersion": 8
9
+    }
10
+  },
11
+  "stack_specific": {
12
+    "ezsp": {
13
+      "hashed_tclk": "3efc7b979ea73a945f94929a94c0b116"
14
+    }
15
+  },
16
+  "coordinator_ieee": "e0798dfffe718d5d",
17
+  "pan_id": "1a62",
18
+  "extended_pan_id": "dddddddddddddddd",
19
+  "nwk_update_id": 0,
20
+  "security_level": 5,
21
+  "channel": 15,
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": "0c9cdb83d43567de1ce0dc36a08f07e7",
42
+    "sequence_number": 0,
43
+    "frame_counter": 12830023
44
+  },
45
+  "devices": []
46
+}

+ 9
- 0
config/database.db View File

@@ -0,0 +1,9 @@
1
+{"id":1,"type":"Coordinator","ieeeAddr":"0xe0798dfffe718d5d","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":1690531391508,"defaultSendRequestWhen":"immediate"}
2
+{"id":2,"type":"Router","ieeeAddr":"0x003c84fffe42092a","nwkAddr":34671,"manufId":4476,"manufName":"IKEA of Sweden","powerSource":"Mains (single phase)","modelId":"TRADFRI bulb E14 WS globe 470lm","epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":268,"inClusterList":[0,3,4,5,6,8,768,4096,64599],"outClusterList":[25],"clusters":{"genBasic":{"attributes":{"modelId":"TRADFRI bulb E14 WS globe 470lm","manufacturerName":"IKEA of Sweden","powerSource":1,"zclVersion":8,"appVersion":17,"stackVersion":106,"hwVersion":1,"dateCode":"20211201","swBuildId":"1.1.003"}},"lightingColorCtrl":{"attributes":{"colorCapabilities":16,"colorTempPhysicalMin":250,"colorTempPhysicalMax":454}}},"binds":[],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[33],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":17,"stackVersion":106,"hwVersion":1,"dateCode":"20211201","swBuildId":"1.1.003","zclVersion":8,"interviewCompleted":true,"meta":{"configured":88764544},"lastSeen":1696410662038,"defaultSendRequestWhen":"immediate"}
3
+{"id":3,"type":"EndDevice","ieeeAddr":"0x000b57fffec5c877","nwkAddr":53251,"manufId":4476,"manufName":"IKEA of Sweden","powerSource":"Battery","modelId":"TRADFRI remote control","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":2080,"inClusterList":[0,1,3,32,4096,64636],"outClusterList":[3,4,5,6,8,25,4096],"clusters":{"genPollCtrl":{"attributes":{"checkinInterval":172800}},"genPowerCfg":{"attributes":{"batteryPercentageRemaining":60}}},"binds":[{"cluster":32,"type":"endpoint","deviceIeeeAddress":"0xe0798dfffe718d5d","endpointID":1},{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0xe0798dfffe718d5d","endpointID":1},{"cluster":1,"type":"endpoint","deviceIeeeAddress":"0xe0798dfffe718d5d","endpointID":1}],"configuredReportings":[{"cluster":1,"attrId":33,"minRepIntval":3600,"maxRepIntval":62000,"repChange":0}],"meta":{}}},"appVersion":33,"stackVersion":98,"hwVersion":1,"dateCode":"20210727","swBuildId":"2.3.080","zclVersion":3,"interviewCompleted":true,"meta":{"configured":2040954255},"lastSeen":1696745953351,"defaultSendRequestWhen":"active","checkinInterval":43200}
4
+{"id":4,"type":"EndDevice","ieeeAddr":"0x84ba20fffe82ed8c","nwkAddr":35866,"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":"B\n�,\u0011�\n�,\u0011","65506":31,"65508":0,"modelId":"TS0601","manufacturerName":"_TZE200_hhrtiq0x","powerSource":3,"zclVersion":3,"appVersion":85,"stackVersion":0,"hwVersion":1,"dateCode":""}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":85,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":1696745702404,"defaultSendRequestWhen":"immediate"}
5
+{"id":5,"type":"Router","ieeeAddr":"0x000b57fffeb2332c","nwkAddr":8884,"manufId":4476,"manufName":"IKEA of Sweden","powerSource":"Mains (single phase)","modelId":"FLOALT panel WS 30x30","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 30x30","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":88764544},"lastSeen":1696531443856,"defaultSendRequestWhen":"immediate"}
6
+{"id":6,"type":"EndDevice","ieeeAddr":"0x84ba20fffe82ea89","nwkAddr":45098,"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":"w\n�,\u0011�\n�,\u0011","65506":31,"65508":0,"modelId":"TS0601","manufacturerName":"_TZE200_hhrtiq0x","powerSource":3,"zclVersion":3,"appVersion":85,"stackVersion":0,"hwVersion":1,"dateCode":""}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":85,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":1696746106229,"defaultSendRequestWhen":"immediate"}
7
+{"id":7,"type":"EndDevice","ieeeAddr":"0xcc86ecfffea41814","nwkAddr":50175,"manufId":4619,"manufName":"_TZ1800_fcdjzz3s","powerSource":"Battery","modelId":"TY0202","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":1026,"inClusterList":[0,1,3,1280,2821],"outClusterList":[25],"clusters":{"genBasic":{"attributes":{"modelId":"TY0202","manufacturerName":"_TZ1800_fcdjzz3s","powerSource":3,"zclVersion":1,"appVersion":67,"stackVersion":2,"hwVersion":1,"dateCode":"2021.1.5"}},"ssIasZone":{"attributes":{"iasCieAddr":"0xe0798dfffe718d5d","zoneState":1}},"genPowerCfg":{"attributes":{"batteryPercentageRemaining":190,"batteryVoltage":29}}},"binds":[{"cluster":1,"type":"endpoint","deviceIeeeAddress":"0xe0798dfffe718d5d","endpointID":1}],"configuredReportings":[{"cluster":1,"attrId":32,"minRepIntval":3600,"maxRepIntval":62000,"repChange":0},{"cluster":1,"attrId":33,"minRepIntval":3600,"maxRepIntval":62000,"repChange":0}],"meta":{}}},"appVersion":67,"stackVersion":2,"hwVersion":1,"dateCode":"2021.1.5","zclVersion":1,"interviewCompleted":true,"meta":{"configured":172811876},"lastSeen":1696744975177,"defaultSendRequestWhen":"immediate"}
8
+{"id":8,"type":"Router","ieeeAddr":"0xb4e3f9fffe08e0e9","nwkAddr":24345,"manufId":4098,"manufName":"_TZ3210_p9ao60da","powerSource":"Mains (single phase)","modelId":"TS0505B","epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":269,"inClusterList":[0,3,4,5,6,4096,8,768,61184],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"modelId":"TS0505B","manufacturerName":"_TZ3210_p9ao60da","powerSource":1,"zclVersion":3,"appVersion":64,"stackVersion":0,"hwVersion":1,"dateCode":""}},"lightingColorCtrl":{"attributes":{"colorCapabilities":29}},"genOnOff":{"attributes":{"onOff":1}}},"binds":[],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":64,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{"configured":1842547789},"lastSeen":1696702355547,"defaultSendRequestWhen":"immediate"}
9
+{"id":9,"type":"Router","ieeeAddr":"0x540f57fffe9411c5","nwkAddr":11732,"manufId":4098,"manufName":"_TZ3210_p9ao60da","powerSource":"Mains (single phase)","modelId":"TS0505B","epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":269,"inClusterList":[0,3,4,5,6,4096,8,768,61184],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"modelId":"TS0505B","manufacturerName":"_TZ3210_p9ao60da","powerSource":1,"zclVersion":3,"appVersion":64,"stackVersion":0,"hwVersion":1,"dateCode":""}},"lightingColorCtrl":{"attributes":{"colorCapabilities":29}},"genOnOff":{"attributes":{"onOff":1}}},"binds":[],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":64,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{"configured":1842547789},"lastSeen":1696702355600,"defaultSendRequestWhen":"immediate"}

+ 79
- 0
config/state.json View File

@@ -0,0 +1,79 @@
1
+{
2
+    "0x003c84fffe42092a": {
3
+        "color_mode": "color_temp",
4
+        "update": {
5
+            "state": "idle"
6
+        },
7
+        "brightness": 178,
8
+        "state": "ON",
9
+        "color_temp": 413,
10
+        "linkquality": 248
11
+    },
12
+    "0x84ba20fffe82ed8c": {
13
+        "battery": 5,
14
+        "local_temperature": 25.1,
15
+        "linkquality": 216,
16
+        "window_detection": "ON",
17
+        "current_heating_setpoint": 25,
18
+        "preset": "manual",
19
+        "away_mode": "OFF",
20
+        "system_mode": "heat",
21
+        "valve_detection": "ON",
22
+        "child_lock": "UNLOCK"
23
+    },
24
+    "0x000b57fffeb2332c": {
25
+        "color_mode": "color_temp",
26
+        "update": {
27
+            "state": "idle",
28
+            "installed_version": 304235891,
29
+            "latest_version": 304235891
30
+        },
31
+        "linkquality": 240,
32
+        "brightness": 107,
33
+        "state": "ON",
34
+        "color_temp": 413
35
+    },
36
+    "0xcc86ecfffea41814": {
37
+        "battery": 95,
38
+        "voltage": 2900,
39
+        "occupancy": false,
40
+        "tamper": false,
41
+        "battery_low": false,
42
+        "linkquality": 156
43
+    },
44
+    "0x84ba20fffe82ea89": {
45
+        "battery": 5,
46
+        "linkquality": 168,
47
+        "local_temperature": 22.8,
48
+        "window_detection": "ON",
49
+        "current_heating_setpoint": 23,
50
+        "preset": "manual",
51
+        "away_mode": "OFF",
52
+        "system_mode": "heat",
53
+        "valve_detection": "ON",
54
+        "child_lock": "UNLOCK"
55
+    },
56
+    "0x540f57fffe9411c5": {
57
+        "brightness": 19,
58
+        "state": "ON",
59
+        "color_mode": "color_temp",
60
+        "color_temp": 413,
61
+        "linkquality": 116
62
+    },
63
+    "0xb4e3f9fffe08e0e9": {
64
+        "brightness": 19,
65
+        "state": "ON",
66
+        "color_mode": "color_temp",
67
+        "color_temp": 413,
68
+        "linkquality": 60
69
+    },
70
+    "0x000b57fffec5c877": {
71
+        "battery": 60,
72
+        "linkquality": 196,
73
+        "update": {
74
+            "state": "idle",
75
+            "installed_version": 587728433,
76
+            "latest_version": 587286065
77
+        }
78
+    }
79
+}

+ 0
- 0
config_example/.gitkeep View File


+ 42
- 0
config_example/configuration.yaml View File

@@ -0,0 +1,42 @@
1
+homeassistant: false
2
+permit_join: false
3
+mqtt:
4
+  base_topic: zigbee/gfw
5
+  server: <mqtt_smarthome_hostname>
6
+  user: <mqtt_smarthome_username>
7
+  password: <mqtt_smarthome_password>
8
+serial:
9
+  port: /dev/ttyACM0
10
+advanced:
11
+  ikea_ota_use_test_url: true
12
+  legacy_api: false
13
+  log_level: debug
14
+  channel: 15
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: <zigbee_auth_token>
21
+  url: http://localhost
22
+devices:
23
+  '0x84ba20fffe82ed8c':
24
+    friendly_name: dirk/heating_valve
25
+  '0xcc86ecfffea41814':
26
+    friendly_name: stairway/motion_sensor_gf
27
+  '0x60a423fffe07bc02':
28
+    friendly_name: marion/desk_light
29
+  '0x003c84fffe42092a':
30
+    friendly_name: dirk/desk_light
31
+  '0x84ba20fffe82ea89':
32
+    friendly_name: marion/heating_valve
33
+  '0xb4e3f9fffe08e0e9':
34
+    friendly_name: floor/main_light_1
35
+  '0x540f57fffe9411c5':
36
+    friendly_name: floor/main_light_2
37
+  '0xb4e3f9fffe7813eb':
38
+    friendly_name: sunroom/router
39
+  '0x000b57fffeb2332c':
40
+    friendly_name: dirk/main_light
41
+  '0x000b57fffec5c877':
42
+    friendly_name: dirk/input_device

Loading…
Cancel
Save