Zigbee2MQTT

Xiaomi, Ikea TRÅDFRI, Philips Hue and more.

Moderator: leecollings

Post Reply
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: Zigbee2MQTT

Post by l0gic »

Hi guys,
my hardware has arrived to day (at last!)
Tried to set up a Xiaomi button switch using the earlier example and hit some issues, only some actions arrived at the Domoticz switch.

Long story short, I've received a Xiaomi Button Model: WXKG11LM rather than a WXKG01LM
This button is feature limited in comparison, it offers just single click, double click, hold and release plus just to add to the fun there is a new payload called action which is related to hold and release.

So I have the following actions with this switch;
"click":"single"
"click":"double"
"action":"hold"
"action":"release"

So I've modified the format data function to the following;

Code: Select all

// Xiaomi Button Model: WXKG11LM

if (typeof msg.payload.click !== 'undefined'){
 var click = msg.payload.click.toString();
 var action = ' ';
}
if (typeof msg.payload.action !== 'undefined'){
 var click = ' ';
 var action = msg.payload.action.toString();
}
var batt = Math.round(msg.payload.battery);
msg.payload.idx = 612 ;

delete msg.payload.click;
delete msg.payload.duration;
delete msg.payload.battery;
delete msg.payload.voltage;

if(click == 'single') {
 var level = 10
} else if (click == 'double') {
 var level = 20
} else if (action == 'hold') {
 var level = 30
} else if (action == 'release') {
 var level = 40
}
msg.payload.nvalue = 2 ;
msg.payload.level = level;
msg.payload.svalue = level.toString();
msg.payload.Battery = batt;
return msg;
which seems to cover the options.

Off to play with the cube next....

p.s. if anyone can tell me how to package up the required flow I'll post it up here.

ATB

Kevin

EDIT Worked out how to export flow

Code: Select all

[{"id":"441a77f0.9c89c8","type":"mqtt in","z":"e136808d.ab3ee","name":"zigbee2mqtt/XiaomiButtonSwitch01","topic":"zigbee2mqtt/XiaomiButtonSwitch01","qos":"2","broker":"a2ca6e39.69968","x":180,"y":260,"wires":[["3298ab7d.304524"]]},{"id":"3298ab7d.304524","type":"json","z":"e136808d.ab3ee","name":"","property":"payload","action":"","pretty":false,"x":410,"y":260,"wires":[["20493cdd.b946d4"]]},{"id":"3e22449b.75b7cc","type":"mqtt out","z":"e136808d.ab3ee","name":"","topic":"domoticz/in","qos":"2","retain":"","broker":"e0b700ec.7593","x":750,"y":260,"wires":[]},{"id":"20493cdd.b946d4","type":"function","z":"e136808d.ab3ee","name":"Format Data","func":"// Xiaomi Button Model: WXKG11LM\n\nif (typeof msg.payload.click !== 'undefined'){\n var click = msg.payload.click.toString();\n var action = ' ';\n}\nif (typeof msg.payload.action !== 'undefined'){\n var click = ' ';\n var action = msg.payload.action.toString();\n}\nvar batt = Math.round(msg.payload.battery);\nmsg.payload.idx = 612 ;\n\ndelete msg.payload.click;\ndelete msg.payload.duration;\ndelete msg.payload.battery;\ndelete msg.payload.voltage;\n\nif(click == 'single') {\n var level = 10\n} else if (click == 'double') {\n var level = 20\n} else if (action == 'hold') {\n var level = 30\n} else if (action == 'release') {\n var level = 40\n}\nmsg.payload.nvalue = 2 ;\nmsg.payload.level = level;\nmsg.payload.svalue = level.toString();\nmsg.payload.Battery = batt;\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":260,"wires":[["3e22449b.75b7cc"]]},{"id":"6602a106.24e15","type":"comment","z":"e136808d.ab3ee","name":"Xiaomi Button Model: WXKG11LM Multi Click","info":"","x":210,"y":220,"wires":[]},{"id":"a2ca6e39.69968","type":"mqtt-broker","z":"","name":"Domoticz box MQTT","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"domoticz/bridge/state","birthQos":"0","birthPayload":"online","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"e0b700ec.7593","type":"mqtt-broker","z":"","name":"Domoticz box MQTT","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Last edited by l0gic on Friday 07 December 2018 20:17, edited 1 time in total.
Non credus crepitus
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: Zigbee2MQTT - Xiaomi Cube Model: MFKZQ01LM

Post by l0gic »

Well I've had a quick go with the cube and have produced the following,

Code: Select all

[{"id":"f9e0eecc.48aaa","type":"mqtt in","z":"e136808d.ab3ee","name":"zigbee2mqtt/XiaomiCube01","topic":"zigbee2mqtt/XiaomiCube01","qos":"2","broker":"a2ca6e39.69968","x":140,"y":160,"wires":[["d9b2d9f0.43b598"]]},{"id":"d9b2d9f0.43b598","type":"json","z":"e136808d.ab3ee","name":"","property":"payload","action":"","pretty":false,"x":370,"y":160,"wires":[["a0bb21a6.0e61a"]]},{"id":"ad324acf.bc69e8","type":"mqtt out","z":"e136808d.ab3ee","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"e0b700ec.7593","x":730,"y":160,"wires":[]},{"id":"a0bb21a6.0e61a","type":"function","z":"e136808d.ab3ee","name":"Format Data","func":"// Xiaomi Cube Model: MFKZQ01LM\nif (typeof msg.payload.action !== 'undefined' && msg.payload.action !== null){\nvar action = msg.payload.action.toString();\nvar batt = Math.round(msg.payload.battery);\nmsg.payload.idx = 613 ;\n\ndelete msg.payload.action;\ndelete msg.payload.duration;\ndelete msg.payload.battery;\ndelete msg.payload.voltage;\ndelete msg.payload.linkquality;\ndelete msg.payload.from_side;\ndelete msg.payload.to_side;\ndelete msg.payload.angle;\ndelete msg.payload.side;\n\nif(action == 'slide') {\n var level = 10\n} else if (action == 'rotate_left') {\n var level = 20\n} else if (action == 'rotate_right') {\n var level = 30\n} else if (action == 'flip90') {\n var level = 40\n} else if (action == 'flip180') {\n var level = 50\n} else if (action == 'shake') {\n var level = 60\n} else if (action == 'fall') {\n var level = 70\n} else if (action == 'tap') {\n var level = 80\n} else if (action == 'wakeup') {\n var level = 90\n}\nmsg.payload.nvalue = 2 ;\nmsg.payload.level = level;\nmsg.payload.svalue = level.toString();\nmsg.payload.Battery = batt;\nreturn msg;\n}","outputs":1,"noerr":0,"x":530,"y":160,"wires":[["ad324acf.bc69e8"]]},{"id":"fe568972.353bd8","type":"comment","z":"e136808d.ab3ee","name":"Xiaomi Cube Model: MFKZQ01LM","info":"","x":160,"y":120,"wires":[]},{"id":"a2ca6e39.69968","type":"mqtt-broker","z":"","name":"Domoticz box MQTT","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"domoticz/bridge/state","birthQos":"0","birthPayload":"online","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"e0b700ec.7593","type":"mqtt-broker","z":"","name":"Domoticz box MQTT","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
I've stripped out the following for now,
  • from_side (side 0 - 5) Used with flip actions
  • to_side (side 0 - 5) Used with flip actions
  • angle (+ve if rotated right, -ve if rotated left) Used with rotate actions
  • side (0 - 5 used with tap to indicate upper face) Used with rotate actions
If required I guess they could be used but there is no obvious 'sideness' to the cube apart from the logo on the top.
Hence being stripped for now.

Having fun :D

I need to buy some different ones now I'm satisfied that it all works well!

Kevin
Non credus crepitus
ben53252642
Posts: 543
Joined: Saturday 02 July 2016 5:17
Target OS: Linux
Domoticz version: Beta
Contact:

Re: Zigbee2MQTT

Post by ben53252642 »

Very cool! I was going to say writing a flow for the cube would be one of the harder flows to write but you seem to be doing well.

I've got a git folder here that I've been adding various flows to (I need to update it), some of the flows in this thread are more up to date.

Feel free to create folders and add there if you like (it's linked to from the Admin Panel).

https://github.com/ben423423n32j14e/zig ... adminpanel

https://github.com/ben423423n32j14e/zig ... er/devices

To export from Node-Red, select the nodes you want to export, go into the menu at top right, click export and then clipboard. It's as simple as copy and paste.

Cheers
Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: Zigbee2MQTT

Post by l0gic »

Cheers!
The flow above for the cube includes the following,
slide = 10
rotate_left = 20
rotate_right = 30
flip90 = 40
flip180 = 50
shake = 60
fall = 70
tap = 80
wakeup = 90

I'm now setting up the code in lua to get the cube to actually do stuff, not convinced wakeup is of any real use as it only happens when the cube actually wakes up after inactivity.

cheers
Non credus crepitus
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: Zigbee2MQTT

Post by l0gic »

Morning Ben,
just installed your Admin Panel and I've hit issues.
I get a continuous

node: e3c890e4.398e2
function : (error)
"TypeError: Cannot read property
'length' of undefined"

in the debug panel

The url page displays but is blank in that it doesn't carry any information, only the sections (Devices, Status, Permit join/ Remove device, Logging level/Rename device) are visible.

I've tried regrabbing the flow in case there was any dodgy characters without any success.
I've disabled it for now but any pointers would be appreciated.
Non credus crepitus
ben53252642
Posts: 543
Joined: Saturday 02 July 2016 5:17
Target OS: Linux
Domoticz version: Beta
Contact:

Re: Zigbee2MQTT

Post by ben53252642 »

"'length' of undefined" means it's not getting data from Zigbee2MQTT (a configuration issue).

Double check the configuration of all the MQTT nodes (looking in each of the sub flows).
Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
Eosfoto
Posts: 9
Joined: Wednesday 07 November 2018 12:06
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: @Home
Contact:

Re: Zigbee2MQTT

Post by Eosfoto »

Is there somewhere a workaround how to get it working on a Synology NAS?
And if there isn't, would someone be so nice and help me with this over PM?
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Zigbee2MQTT

Post by EddyG »

How can I prevent that Zigbee2MQTT clutters my syslog file with all zigbee2mqtt messages which also go to my 'normal' logfile?
ben53252642
Posts: 543
Joined: Saturday 02 July 2016 5:17
Target OS: Linux
Domoticz version: Beta
Contact:

Re: Zigbee2MQTT

Post by ben53252642 »

EddyG, I start every component of my system manually in a particular order.

For example at the top of the script, startup is aborted if the system can not confirm it has the correct time:

Code: Select all

# Set timezone and get the current time from NTP server
export TZ=Australia/Melbourne
settime=$(ntpdate time.google.com 2> /dev/null)
if [[ ! $settime ]]; then
echo "Unable to get time, retrying..."
settime=$(ntpdate time.google.com 2> /dev/null)
sleep 1
if [[ ! $settime ]]; then
echo "Unable to get time, aborting..."
exit
fi
fi
Eg, I have an entry in /etc/init.d for "startup" which is just a bash file which I've got then starting every component.

This is how I am starting Zigbee2MQTT on my system:

Code: Select all

# Zigbee2MQTT
update-rc.d zigbee2mqtt disable # Make sure auto start via init is disabled
service zigbee2mqtt stop # Make sure the service is stopped
mkdir -p /tmp/zigbee2mqtt/log
ln -sf /tmp/zigbee2mqtt/log.txt /opt/zigbee2mqtt/data/log.txt
ln -sf /tmp/zigbee2mqtt/state.json /opt/zigbee2mqtt/data/state.json
ln -sf /tmp/zigbee2mqtt/log /opt/zigbee2mqtt/data
service zigbee2mqtt start
/etc/init.d/zigbee2mqtt

Code: Select all

#!/bin/sh
### BEGIN INIT INFO
# Provides: echobridge
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 5
# Default-Stop:
# Description: Starts Amazon Echo Hue Bridge
### END INIT INFO

case "$1" in
'start')
        cd /opt/zigbee2mqtt
        sudo -u root /usr/bin/screen -S zigbee2mqtt -d -m npm start
        ;;
'stop')
        sudo -u root pkill -f "zigbee2mqtt"
        ;;
*)
        echo "Usage: $0 { start | stop }"
        ;;
esac
exit 0
As you can see I create symlinks for the log files and put them to tmp in ram to save writes to the disk.

I've got dozens of symlinks putting various files to tmp / ram, very rarely will I let log files actually touch the hard disk (writes to disk always decrease the life expectancy of storage).
Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Zigbee2MQTT

Post by EddyG »

The question was/is how do I prevent that the logging which is going to dir /var/log/zigbee also goes to the syslog file in /var/log/syslog.
The logging is double and I do not need the logging in my syslog file.

Logging to tmp files in ram does not give answer on system crashes, because logging is gone.

I am using Berryboot so I do not have to worry about degrading SD-card or harddisks.
B.t.w. that works perfect, a Berryboot on my Synology, where I make snapshots every hour for 3 months.
ben53252642
Posts: 543
Joined: Saturday 02 July 2016 5:17
Target OS: Linux
Domoticz version: Beta
Contact:

Re: Zigbee2MQTT

Post by ben53252642 »

Not sure, I suggest posting in the Zigbee2MQTT git.

Agree RE the Berryboot setup, I've run that before, it's probably the best Raspberry Pi setup for Domoticz I know of.

That said I now consider ECC memory to be absolutely critical in my setup so I've moved to a proper server.

Dual cpu's each 8 core Xeon, with 48gb of ECC ram and 3500mb read / 2500mb write SSD with 10gbe networking. :)
Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Zigbee2MQTT

Post by EddyG »

I have a solution, but that is a workaround.
Something like that should be in the Zigbee2MQTT config file.
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: Zigbee2MQTT

Post by l0gic »

Happy New Year guys,
I've received a pack of door/window magnetic sensors and have coded up the Node Red flow

The item is a Xiaomi Door/Window Switch Model: MCCGQ11LM

Code: Select all

[{"id":"bb498c40.641f3","type":"debug","z":"26d2c56.3ed793a","name":"Door Switch to Domoticz","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":730,"y":760,"wires":[]},{"id":"a39a3f0c.700ef","type":"mqtt in","z":"26d2c56.3ed793a","name":"zigbee2mqtt/XiaomiDoorSwitch01","topic":"zigbee2mqtt/XiaomiDoorSwitch01","qos":"2","broker":"a2ca6e39.69968","x":150,"y":700,"wires":[["b6e09b5c.af6808","5d14b745.2b5808"]]},{"id":"b6e09b5c.af6808","type":"json","z":"26d2c56.3ed793a","name":"","property":"payload","action":"","pretty":false,"x":370,"y":700,"wires":[["11a97828.5c14b8"]]},{"id":"b4ff3d43.5627c","type":"mqtt out","z":"26d2c56.3ed793a","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"e0b700ec.7593","x":730,"y":700,"wires":[]},{"id":"11a97828.5c14b8","type":"function","z":"26d2c56.3ed793a","name":"Format Data","func":"// Xiaomi Door/Window Switch Model: MCCGQ11LM\nif (typeof msg.payload.contact !== 'undefined' && msg.payload.contact !== null){\nvar contact = msg.payload.contact.toString();\n\nif (typeof msg.payload.battery !== 'undefined' && msg.payload.battery !== null){\nvar batt = Math.round(msg.payload.battery);\n}\n\ndelete msg.payload.voltage;\ndelete msg.payload.linkquality;\ndelete msg.payload.contact;\n\nmsg.payload.command = \"switchlight\";\nmsg.payload.idx = 654 ;\nif (contact == 'false') {\n    msg.payload.switchcmd = \"On\";\n} else {\n    msg.payload.switchcmd = \"Off\";\n}\n\nif (typeof msg.payload.battery !== 'undefined' && msg.payload.battery !== null){\nmsg.payload.Battery = Math.round(msg.payload.battery);\n}\n\nreturn msg;\n}","outputs":1,"noerr":0,"x":530,"y":700,"wires":[["b4ff3d43.5627c","bb498c40.641f3"]]},{"id":"eef98697.702928","type":"comment","z":"26d2c56.3ed793a","name":"Xiaomi Door Switch Model: MCCGQ11LM","info":"","x":180,"y":660,"wires":[]},{"id":"5d14b745.2b5808","type":"debug","z":"26d2c56.3ed793a","name":"Raw Door Switch data","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":400,"y":760,"wires":[]},{"id":"7f79569.2e031a8","type":"comment","z":"26d2c56.3ed793a","name":"Door Switch 01","info":"","x":100,"y":620,"wires":[]},{"id":"a2ca6e39.69968","type":"mqtt-broker","z":"","name":"Domoticz box MQTT","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"domoticz/bridge/state","birthQos":"0","birthPayload":"online","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"e0b700ec.7593","type":"mqtt-broker","z":"","name":"Domoticz box MQTT","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Note; I have yet to see a battery status appear from the device but I've (hopefully) coded it to send it through to Domoticz if it appears.

Have fun!
Kevin
Non credus crepitus
domoticzag1
Posts: 10
Joined: Thursday 27 December 2018 22:08
Target OS: -
Domoticz version:
Contact:

Re: Zigbee2MQTT

Post by domoticzag1 »

I have 1 doorcontact and 1 motion sensor working with Zigbee2MQTT on domoticz. But the second door sensor I want to add, doenst appear in my Devices.

It does appear in de configuration.yaml, then I checked the domoticz LOG, it seems the second door contact's MQTT messages arent handled by the plugin.

Any idea why?:

Domoticz Log:
Spoiler: show
2019-01-04 14:16:37.255 (Zigbee2MQTT) MQTT message: zigbee2mqtt/0x00158d00024e5fec {'voltage': 2975, 'device': {'manufName': 'LUMI', 'type': 'EndDevice', 'manufId': 4151, 'powerSource': 'Battery', 'ieeeAddr': '0x00158d00024e5fec', 'nwkAddr': 32474, 'status': 'online', 'friendlyName': '0x00158d00024e5fec', 'modelId': 'lumi.sensor_magnet.aq2'}, 'linkquality': 49, 'contact': False, 'battery': 37}
2019-01-04 14:16:37.255 (Zigbee2MQTT) Unhandled message from zigbee2mqtt: zigbee2mqtt/0x00158d00024e5fec {'voltage': 2975, 'device': {'manufName': 'LUMI', 'type': 'EndDevice', 'manufId': 4151, 'powerSource': 'Battery', 'ieeeAddr': '0x00158d00024e5fec', 'nwkAddr': 32474, 'status': 'online', 'friendlyName': '0x00158d00024e5fec', 'modelId': 'lumi.sensor_magnet.aq2'}, 'linkquality': 49, 'contact': False, 'battery': 37}
Matthias
Posts: 12
Joined: Wednesday 09 January 2019 23:32
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Zigbee2MQTT

Post by Matthias »

Hi,
I don't find anything in my language (French) so I try to find some help here.
I would like to add a xiaomi temp/hum/bar with my zigbee key.
I don't know anything about node red.
I see that i have to import codes but which parameters of the code i have to configure to create the link with my domoticz and my virtual sensor in node red ?
ben53252642 wrote: Sunday 19 August 2018 19:23

Code: Select all

[{"id":"ccd928ae.df6e08","type":"mqtt in","z":"f962b96d.7044c8","name":"zigbee2mqtt/out","topic":"zigbee2mqtt/bedroomwindowtempsensor","qos":"2","broker":"6e165f21.f7645","x":340,"y":340,"wires":[["30c7887d.0db668"]]},{"id":"30c7887d.0db668","type":"json","z":"f962b96d.7044c8","name":"","property":"payload","action":"","pretty":false,"x":490,"y":340,"wires":[["903fbd0c.967e8"]]},{"id":"37f9ac4c.00d154","type":"mqtt out","z":"f962b96d.7044c8","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"cd51966f.aa7e38","x":790,"y":340,"wires":[]},{"id":"903fbd0c.967e8","type":"function","z":"f962b96d.7044c8","name":"Format Data","func":"var temp = msg.payload.temperature;\nvar humi = msg.payload.humidity;\nvar pres = msg.payload.pressure;\nvar batt = msg.payload.battery;\nvar rssi = msg.payload.linkquality;\n\nmsg.payload = {}\n\n// Humidity Status\nif (humi < 31) {\n    humistat = \"2\";\n} else if (humi > 69) {\n    humistat = \"3\";\n} else if (humi > 34 && humi < 66 && temp > 21 && temp < 27) {\n    humistat = \"1\";\n} else {\n    humistat = \"0\";\n}\n\n// Pressure Status\nif (pres < 966) {\n    forecast = \"4\";\n} else if (pres < 993) {\n    forecast = \"3\";\n} else if (pres < 1007) {\n    forecast = \"2\";\n} else if (pres < 1013) {\n    forecast = \"3\";\n} else if (pres < 1033) {\n    forecast = \"0\";\n} else {\n    forecast = \"1\";\n}\n\nmsg.payload.idx =  1221\nmsg.payload.nvalue = 0\nmsg.payload.svalue = temp.toString()+\";\"+humi.toString()+\";\"+humistat+\";\"+pres.toString()+\";\"+forecast;\nif (typeof batt !== 'undefined' && batt !== null){\nmsg.payload.Battery = Math.round(batt);\n}\nif (typeof rssi !== 'undefined' && rssi !== null){\nrssi = Math.round(rssi / 12);\nif (rssi > 12) {\n    rssi = 12;\n}\nmsg.payload.RSSI = rssi;\n}\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":340,"wires":[["37f9ac4c.00d154"]]},{"id":"6e165f21.f7645","type":"mqtt-broker","z":"","name":"Zigbee","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"domoticz/bridge/state","birthQos":"0","birthPayload":"online","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"cd51966f.aa7e38","type":"mqtt-broker","z":"","name":"Domoticz","broker":"192.168.0.5","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
(Sorry for my english)
StasDemydiuk
Posts: 59
Joined: Saturday 14 January 2017 21:37
Target OS: Linux
Domoticz version: Beta
Location: Ukraine
Contact:

Re: Zigbee2MQTT

Post by StasDemydiuk »

You could try Domoticz plug-in for zigbee2mqtt: https://github.com/stas-demydiuk/domoti ... qtt-plugin Installation is pretty simple.
unclekoen
Posts: 21
Joined: Saturday 27 October 2018 11:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Zigbee2MQTT

Post by unclekoen »

Raspbian Stretch LITE vs Stretch NORMAL. Does LITE has MQTT installed???

I am trying to install and run Zigbee2MQTT with the: https://koenkk.github.io/zigbee2mqtt/ge ... 2mqtt.html guide.

Everything seems to be OK, except for step 4. I can't start Zigbee2MQTT. Do not get any connection to the MQTT server. The configuration.yaml is basic, no MQTT credentials are filled in.

Code: Select all

# MQTT settings
mqtt:
  # MQTT base topic for zigbee2mqtt MQTT messages
  base_topic: zigbee2mqtt
  # MQTT server URL
  server: 'mqtt://localhost'
  # MQTT server authentication, uncomment if required:
  # user: my_user
  # password: my_password
I am wondering what to do, do i need to follow the Docker documentation or Hass.io Zigbee2mqtt add-on or both, like KoenKK is telling about at the top of his guide. Or can i just run a:

Code: Select all

sudo apt-get install mosquitto
iganin
Posts: 47
Joined: Tuesday 28 October 2014 17:55
Target OS: NAS (Synology & others)
Domoticz version: 2020.2
Location: Aalter, Belgium
Contact:

Re: Zigbee2MQTT

Post by iganin »

Trying to pair the first sensor - Xiaomi Smart Human Body Sensor without success. Log is below. The device connects to Xiaomi Gateway without any issue.
Please help me out.

zigbee2mqtt:debug 2019-1-24 21:01:15 Loaded state from file /opt/zigbee2mqtt/data/state.json
zigbee2mqtt:info 2019-1-24 21:01:15 Starting zigbee2mqtt version 1.0.1 (commit #c44816e)
zigbee2mqtt:info 2019-1-24 21:01:15 Starting zigbee-shepherd
zigbee2mqtt:info 2019-1-24 21:01:16 zigbee-shepherd started
zigbee2mqtt:info 2019-1-24 21:01:16 Coordinator firmware version: '20181024'
zigbee2mqtt:debug 2019-1-24 21:01:16 zigbee-shepherd info: {"enabled":true,"net":{"state":"Coordinator","channel":11,"panId":"0x1a62","extPanId":"0xdddddddddddddddd","ieeeAddr":"0x00124b001936790f","nwkAddr":0},"firmware":{"transportrev":2,"product":0,"version":"2.6.3","revision":20181024},"startTime":1548360076,"joinTimeLeft":0}
zigbee2mqtt:info 2019-1-24 21:01:16 Currently 0 devices are joined:
zigbee2mqtt:warn 2019-1-24 21:01:16 `permit_join` set to `true` in configuration.yaml.
zigbee2mqtt:warn 2019-1-24 21:01:16 Allowing new devices to join.
zigbee2mqtt:warn 2019-1-24 21:01:16 Set `permit_join` to `false` once you joined all devices.
zigbee2mqtt:info 2019-1-24 21:01:16 Zigbee: allowing new devices to join.
zigbee2mqtt:info 2019-1-24 21:01:16 Connecting to MQTT server at mqtt://192.168.1.13:1883
zigbee2mqtt:info 2019-1-24 21:01:16 zigbee-shepherd ready
zigbee2mqtt:info 2019-1-24 21:01:16 Connected to MQTT server
zigbee2mqtt:info 2019-1-24 21:01:16 MQTT publish: topic 'zigbee2mqtt/bridge/state', payload 'online'
zigbee2mqtt:debug 2019-1-24 21:01:17 Received MQTT message on 'zigbee2mqtt/bridge/config/devices' with data ''
zigbee2mqtt:info 2019-1-24 21:01:17 MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"devices","message":[]}'
zigbee2mqtt:debug 2019-1-24 21:01:17 Received MQTT message on 'zigbee2mqtt/bridge/config/permit_join' with data 'true'
zigbee2mqtt:info 2019-1-24 21:01:17 Zigbee: allowing new devices to join.
zigbee2mqtt:info 2019-1-24 21:01:17 MQTT publish: topic 'zigbee2mqtt/bridge/config', payload '{"log_level":"debug","permit_join":true}'
zigbee2mqtt:debug 2019-1-24 21:01:17 Mounted the cieApp (epId {epId})
mvzut
Posts: 443
Joined: Thursday 12 November 2015 10:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Zigbee2MQTT

Post by mvzut »

From the log it's not possible to see what's going wrong, I think this is a normal log for a system with no devices paired. What do you see when you try to pair the device?
It's not always easy to pair devices, you have to keep them awake after pressing the pairing button for quite some time. It can sometimes also help to reduce the distance between the device and the Zigbee sniffer (in my experience).
Raspberry Pi 4 - RFXtrx433 - CC2531 Zigbee - Opentherm Gateway - P1 smart meter - Netatmo - Philips Hue - ELV Max! - ESP8266 DIY water meter - 6 x Sonos - 4 x IP cameras - Wall mounted tablet + Dashticz - Google Home integration - MANY switches/sensors
unclekoen
Posts: 21
Joined: Saturday 27 October 2018 11:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Zigbee2MQTT

Post by unclekoen »

unclekoen wrote: Tuesday 22 January 2019 10:18I am wondering what to do, do i need to follow the Docker documentation or Hass.io Zigbee2mqtt add-on or both, like KoenKK is telling about at the top of his guide. Or can i just run a:

Code: Select all

sudo apt-get install mosquitto
For me just install mosquitto was enough to get it running. :)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest