Page 3 of 18

Re: Python Plugin: Zigbee2Mqtt

Posted: Saturday 10 November 2018 11:58
by m0rph13
Any plans on making this work with DeConz hardware?

Re: Python Plugin: Zigbee2Mqtt

Posted: Monday 12 November 2018 23:40
by prelude
prelude wrote: Friday 19 October 2018 21:14 Yep, no help from there.
Got it working just replacing "server: 'mqtt://rabbitmq'" -> server: 'mqtt://10.10.10.1' (likely 127.0.0.1 would work also) in configuration.yaml. Funny thing is that pairing works ok but normal "update" messages do not go thru. Ouh yeah, i'm using dockers. And sorry as i do not have now time to check why it work like that.

Re: Python Plugin: Zigbee2Mqtt

Posted: Friday 23 November 2018 14:31
by Hesmink
Hi All,

What is the expected behavior of the aqara water leak sensor?
Mine stays in an 'open' state, even when the alarm is gone already.

Re: Python Plugin: Zigbee2Mqtt

Posted: Sunday 25 November 2018 20:18
by StasDemydiuk
What is the expected behavior of the aqara water leak sensor?
Because it is just simple contact sensor it stays "Open" when there is no water leakage and "Closed" if there is

Re: Python Plugin: Zigbee2Mqtt

Posted: Sunday 25 November 2018 21:31
by Hesmink
StasDemydiuk wrote: Sunday 25 November 2018 20:18
What is the expected behavior of the aqara water leak sensor?
Because it is just simple contact sensor it stays "Open" when there is no water leakage and "Closed" if there is
Thanks, works perfectly.
I was confused since the Xiaomi gareways plugin shows them a bit different.

Python Plugin: Zigbee2Mqtt

Posted: Wednesday 12 December 2018 9:18
by dextm80
Hi, my zigbee2mqtt service works perfectly and send regular updates but my domoticz plugin after a while stops working and seems not to receive data, anyone that have this issue?
Thanks
Image

Re: Python Plugin: Zigbee2Mqtt

Posted: Friday 14 December 2018 16:44
by dextm80
anyone can help me to understand where is the problem? my plugin stop receive data after 1/2 days...i've to reboot domoticz.
Service (zigbee2mqtt.service) send data correctly.
Thanks

Re: Python Plugin: Zigbee2Mqtt

Posted: Thursday 20 December 2018 9:43
by mvzut
I noticed that (Xiaomi) devices sometimes send updates even when their state (on/off, open/close, temperature, etc.) has not changed. I suspect they do this when e.g. their battery level or signal strength has changed. The zigbee2mqtt bridge copies these updates to mqtt, where the plugin picks them up and updates the corresponding device. This results in multiple "off" updates for e.g. motion sensors when you look at the log.

However, I would personally prefer it if devices are not updated when their actual state has not changed, since I use the value of the "last updated" timestamp in some of my scripts to check when the last movement or door opening took place. Therefore, I made a small modification to the plugin, which makes it check if a device state (svalue) has actually changed before updating it.

Are more people interested in this modification? It would be great if a few people would be willing to test it to check if it doesn't have unforeseen consequences. If it works for everyone, I can make a pull request.

My fork is at:
https://github.com/mvzut/domoticz-zigbee2mqtt-plugin
You could clone the entire plugin structure from there, but the easiest way to test my modification is probably to just download this file:
https://raw.githubusercontent.com/mvzut ... /device.py
And copy it over the existing one in the plugin's subfolder "devices". Restart the plugin once you have copied the new file.

Let me know your opinion and your findings!

Re: Python Plugin: Zigbee2Mqtt

Posted: Thursday 20 December 2018 15:14
by salopette
I just tried it, replaced file and restarted, but comes with errors!

Code: Select all

2018-12-20 15:12:32.383 Error: (Zigbee2MQTT) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/zigbee2mqtt/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-12-20 15:12:32.383 Error: (Zigbee Stick) Module Import failed, exception: 'SyntaxError'
2018-12-20 15:12:32.383 Error: (Zigbee Stick) Import detail: File: /home/pi/domoticz/plugins/zigbee2mqtt/devices/device.py, Line: 7, offset: 1
2018-12-20 15:12:32.383 Error: (Zigbee Stick) Error Line '<!DOCTYPE html>
2018-12-20 15:12:32.383 '

Re: Python Plugin: Zigbee2Mqtt

Posted: Thursday 20 December 2018 17:30
by mvzut
salopette wrote:I just tried it, replaced file and restarted, but comes with errors!

Code: Select all

2018-12-20 15:12:32.383 Error: (Zigbee2MQTT) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/zigbee2mqtt/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-12-20 15:12:32.383 Error: (Zigbee Stick) Module Import failed, exception: 'SyntaxError'
2018-12-20 15:12:32.383 Error: (Zigbee Stick) Import detail: File: /home/pi/domoticz/plugins/zigbee2mqtt/devices/device.py, Line: 7, offset: 1
2018-12-20 15:12:32.383 Error: (Zigbee Stick) Error Line '<!DOCTYPE html>
2018-12-20 15:12:32.383 '
That is strange, the error seems to originate from line 7, which I did not change. I only included one line of code at line 101. Are you sure you ONLY changed this one file with my version? Seems it cannot import a certain module.

Re: Python Plugin: Zigbee2Mqtt

Posted: Thursday 20 December 2018 18:18
by salopette
yes for sure, I only device.py swapped those.

Re: Python Plugin: Zigbee2Mqtt

Posted: Thursday 20 December 2018 20:42
by mvzut
salopette wrote: Thursday 20 December 2018 18:18 yes for sure, I only device.py swapped those.
Looking at your log output, I suspect you did not download the file correctly, if you use wget you should use this direct link to the device.py file:

Code: Select all

cd ~/domoticz/plugins/zigbee2mqtt/devices
wget https://raw.githubusercontent.com/mvzut/domoticz-zigbee2mqtt-plugin/master/devices/device.py
The link I posted earlier was a link to the Github page for this file, not a download link for the file itself (I updated the link in my previous post to avoid confusion).

Re: Python Plugin: Zigbee2Mqtt

Posted: Thursday 20 December 2018 21:24
by salopette
thanks, was my mistake!
Have now replaced again, will watch it!

Re: Python Plugin: Zigbee2Mqtt

Posted: Saturday 22 December 2018 11:06
by EscApe
@mvzut
However, I would personally prefer it if devices are not updated when their actual state has not changed, since I use the value of the "last updated" timestamp in some of my scripts to check when the last movement or door opening took place. Therefore, I made a small modification to the plugin, which makes it check if a device state (svalue) has actually changed before updating it.
Hi,
I have the same problem, however there are exceptions. Wall switches and remote controls are basically ‘stateless’ (E.g. they don’t know you turned the light off from another switch or voice command). So even if the previous state for the remote was ‘on’ I would still want it to relay another ‘on’ command to turn the lights back on.
It might be better to modify the specific device(type)files instead of the main device.py.

Re: Python Plugin: Zigbee2Mqtt

Posted: Sunday 30 December 2018 0:03
by mvzut
EscApe wrote: Saturday 22 December 2018 11:06Wall switches and remote controls are basically ‘stateless’ (E.g. they don’t know you turned the light off from another switch or voice command). So even if the previous state for the remote was ‘on’ I would still want it to relay another ‘on’ command to turn the lights back on.
It might be better to modify the specific device(type)files instead of the main device.py.
Yes, you're right. I have tried to find better ways to avoid multiple updates with the same state, with the intention to exclude buttons (and maybe other devices?) from this check, but haven't succeeded yet. Anyone with better Python skills willing to help, or perhaps the plugin author?

Python Plugin: Zigbee2Mqtt

Posted: Friday 04 January 2019 22:22
by mvzut
mvzut wrote: Sunday 30 December 2018 0:03 Yes, you're right. I have tried to find better ways to avoid multiple updates with the same state, with the intention to exclude buttons (and maybe other devices?) from this check, but haven't succeeded yet. Anyone with better Python skills willing to help, or perhaps the plugin author?
In the meantime, I have found a better way to avoid updates of only door/motion switches when their state has not changed. It involves a few small modifications to the /devices/device.py file, see: https://github.com/mvzut/domoticz-zigbe ... /device.py
Please check it out. I have also created a pull request in Github, because I hope this can become the standard way the plugin handles device updates from door/motion sensors.

Update
My modification had already been incorporated in the main code, so you can simply check out out with a new git pull

Re: Python Plugin: Zigbee2Mqtt

Posted: Sunday 06 January 2019 16:38
by mvzut
I have a Xiaomi Vibration sensor, which I mounted to my cat door. Unfortunately, the Zigbee2Mqtt Python plugin just records states like "Tilt" or "Vibration", and doesn't create separate devices for the tilt angles. Therefore, I could detect if my cat was using the door, but not if it was going in or out.

To solve this, I made a small modification to /adapters/lumi/sensor_vibration.py, it now looks like this:

Code: Select all

from adapters.adapter_with_battery import AdapterWithBattery
from devices.switch.selector_switch import SelectorSwitch
from devices.custom_sensor import CustomSensor


class SensorVibration(AdapterWithBattery):
    def __init__(self, devices):
        super().__init__(devices)

        self.switch = SelectorSwitch(devices, 'action', 'action')
        self.switch.add_level('Off', None)
        self.switch.add_level('Vibration', 'vibration')
        self.switch.add_level('Drop', 'drop')
        self.switch.add_level('Tilt', 'tilt')
        self.switch.set_selector_style(SelectorSwitch.SELECTOR_TYPE_MENU)
        self.devices.append(self.switch)

        self.devices.append(CustomSensor(devices, 'angle', 'angle_z', ' (Rotation Angle Z)'))


    def handleCommand(self, alias, device, device_data, command, level, color):
        self.switch.handle_command(device_data, command, level, color)
The plugin now creates an additional (custom) sensor with the tilt angle, in this case only for the Z angle since this is the angle around which my cat door is tilting. I can now get notifications (using e.g. Lua scripts) about the cat going in or out!

Of course you can adapt this to your own needs. If many people feel that (all?) sensor angles should be shown in custom sensors by default, I could make a pull request for that.

Re: Python Plugin: Zigbee2Mqtt

Posted: Monday 07 January 2019 20:35
by gerbenvanasselt
Hi guys, I have problem with the plugin version 0.0.15. I'm running domo beta v4.103.
Every 5seconds the domo log gives an update.


019-01-07 20:31:27.328 (zigbee2mqtt) Zigbee2mqtt bridge is online

2019-01-07 20:31:27.329 (zigbee2mqtt) Joining new devices is enabled on the zigbee bridge

2019-01-07 20:31:27.396 (zigbee2mqtt) Received available devices list from bridge


Can this be stopped? Or set less frequent?

Thanks

Verstuurd vanaf mijn ONEPLUS A6003 met Tapatalk


Re: Python Plugin: Zigbee2Mqtt

Posted: Tuesday 08 January 2019 8:06
by StasDemydiuk
gerbenvanasselt wrote: Monday 07 January 2019 20:35 Hi guys, I have problem with the plugin version 0.0.15. I'm running domo beta v4.103.
Every 5seconds the domo log gives an update.


019-01-07 20:31:27.328 (zigbee2mqtt) Zigbee2mqtt bridge is online

2019-01-07 20:31:27.329 (zigbee2mqtt) Joining new devices is enabled on the zigbee bridge

2019-01-07 20:31:27.396 (zigbee2mqtt) Received available devices list from bridge


Can this be stopped? Or set less frequent?

Thanks

Verstuurd vanaf mijn ONEPLUS A6003 met Tapatalk
You can try to do one of:
  • update plugin settings
  • remove and then add plugin on Hardware page
Most likely it happened because since you've installed plugin some new settings were added to its config and unfortunately Domoticz behave weirdly with such settings: it doesn't set values to default ones, it just skips these new settings.

Re: Python Plugin: Zigbee2Mqtt

Posted: Thursday 07 February 2019 12:32
by sach
Hi Guys,

I have a Hive Active Plug which I have got working in zigbee2mqtt.
How can I get this supported by the plugin?

Sach