Skip to content

Commit

Permalink
Починил ошибки логирования на версиях zigbee2mqtt 1.21 и новее (#5)
Browse files Browse the repository at this point in the history
* Починил ошибки логирования на версиях zigbee2mqtt 1.21 и новее
  • Loading branch information
aadegtyarev authored Jan 31, 2023
1 parent 44a7957 commit 5683e91
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
wb-zigbee2mqtt (1.2.0) stable; urgency=medium

* fix logging in zigbee2mqtt 1.21.x and above

-- Alexander Degtyarev <a.degtyarev@wirenboard.com> Thu, 26 Jan 2022 12:00:00 +0400

wb-zigbee2mqtt (1.1.0) stable; urgency=medium

* add zigbee2mqtt 1.22+ support (should not break 1.18.1)
Expand Down
19 changes: 18 additions & 1 deletion wb-zigbee2mqtt.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,23 @@ defineRule("Permit join", {
}, 5000);
}
});

//for zigbee2mqtt 1.18.x
trackMqtt(base_topic + "/bridge/log", function(obj) {
dev["zigbee2mqtt"]["Log"] = obj.value;
});

//for zigbee2mqtt 1.21.x and above
trackMqtt(base_topic + "/bridge/logging", function(obj) {
var msg = JSON.parse(obj.value)

if (msg["message"].indexOf("MQTT publish") != 0){
dev["zigbee2mqtt"]["Log"] = msg["message"];
dev["zigbee2mqtt"]["Log level"] = msg["level"];
}
});

//for zigbee2mqtt 1.18.x
trackMqtt(base_topic + "/bridge/config", function(obj) {
if (obj.value != '') {
JSON.parse(obj.value, function(k, v) {
Expand All @@ -84,6 +97,11 @@ defineRule("Permit join", {
}
});

//for zigbee2mqtt 1.21.x and above
trackMqtt(base_topic + "/bridge/info", function(obj) {
var msg = JSON.parse(obj.value)
dev["zigbee2mqtt"]["Version"] = msg["version"];
});

trackMqtt(base_topic + "/bridge/response/permit_join", function(obj) {
if (obj.value != '') {
Expand All @@ -95,7 +113,6 @@ defineRule("Permit join", {
}
});


trackMqtt(base_topic + "/bridge/devices", function(obj) {
if (obj.value != '') {
JSON.parse(obj.value, function(k, v) {
Expand Down

0 comments on commit 5683e91

Please sign in to comment.