Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee) Topic is solved

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

Moderator: leecollings

Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by Thorgal789 »

axel2906 wrote: Tuesday 17 September 2019 8:11 HI to all,

i'm using deCONZ since 2 days... the goal was to inject thel into domoticz. I've already see it in domoticz but i can't use the remote anymore. If i want to user the remote then i can't control it with domoticz...

In deconz he see the remote but impossible to link it with the curtains.

If anybody as an idea

i'm using domoticz with raspbeee (on the same raspberry pi)
Hi, Do you still have the problem ?
salopette
Posts: 187
Joined: Tuesday 07 March 2017 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Germany
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by salopette »

Hi, I have recently the problem that my lights can not turn off via domoticz.
At RGB, e.g. these are switched on and off, but in domoticz they are always displayed as switched on

so the status is not updated
Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by Thorgal789 »

Hello, have you an ikea mouvement sensor ?
The problematics Bulbs are in a group ?

If you force the state with domoticz, they will not re synchronise ?
salopette
Posts: 187
Joined: Tuesday 07 March 2017 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Germany
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by salopette »

The lamps are in groups.
But not Ikea, I have osram.
I also have ikea movement painter, but he is not in the group.

When I turn off in Domoticz, lamp goes out in Deconz, but domoticz shows that it is still on.


PS: Group with Ikea lamps works without problems
salopette
Posts: 187
Joined: Tuesday 07 March 2017 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Germany
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by salopette »

I just took master branch from you, everything works there!
I'm not the last beta.
Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by Thorgal789 »

So now, all is working ? just after a restart ?
If you still have the bug, I think I will need log

When you set a bulb on or off, domoticz send the command, but wait for deconz return to change the state in it (to prevent bulbs change in domoticz if deconz is not working).
So everytime you set a bulb on or off, you will have immediatly after a websocket return, and I m using it to set the bulb state in domoticz, I don't use the request return, only the websocket.

It can be zigbee connection problem, if the bulb don't confirm it's state to the gateway.
But if you see the good websocket return, and bulb state not changing, it's plugin fault.

Nothing usefull on last beta yet, it s just for new device, like alarm or fan.
salopette
Posts: 187
Joined: Tuesday 07 March 2017 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Germany
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by salopette »

As I said, everything restarted and tried.
but with the beta it does not work properly.

I'm running the master now!
Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by Thorgal789 »

Ha it works with master but not beta ?
BTW, I have the same bug ATM on an ikea bulb, The state don't change on domoticz (using beta).

Edit:
Nice, thx a lot ^^, I haven't see the problem before yesterday, you are right, there is a bug on the beta. I will make correction today.
AgeCan
Posts: 4
Joined: Friday 04 October 2019 19:45
Target OS: Linux
Domoticz version:
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by AgeCan »

Hi All!

I've read a lot about this plugin and is very keen on getting it to work and after some struggling with python libs I'm almost there. When I start Domoticz I receive a socket error (see below). The setup is a docker instance with deconz, a virtual machine (debian buster) with latest Domoticz(stable). Both on a QNAP.

These are the error msgs from domoticz log:
2019-10-04 19:56:18.849 Status: (deConz plugin) Launching websocket on port 443
2019-10-04 19:56:18.901 Status: (deConz plugin) onDisconnect called for deCONZ_WebSocket
2019-10-04 19:56:18.798 Error: (deConz plugin) WebSocket Disconnected, reconnexion !
.......
2019-10-04 19:57:18.901 (deConz plugin) Websocket Handshake : HTTP/1.1 400 Bad Request ***Date: Fri, 04 Oct 2019 17:57:19 GMT ***Server: Apache ***X-Frame-Options: SAMEORIGIN ***Content-Length: 362 ***Connection: close ***Content-Type: text/html; charset=iso-8859-1 *** ***<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">***<html><head>***<title>400 Bad Request</title>***</head><body>***<h1>Bad Request</h1>***<p>Your browser sent a request that this server could not understand.<br />***Reason: You're speaking plain HTTP to an SSL-enabled server port.<br />*** Instead use the HTTPS scheme to access this URL, please.<br />***</p>***</body></html>***

The result is that devices are created but receive no sensor updates.

Please excuse me if the problem is obvious I'm quite new to Linux.

Any help is very much appreciated!
Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by Thorgal789 »

Lol, first time I see this bug ^^.
I think there is a url problem > "Server: Apache" on your log but "Server: deconz" on gateway.
But you have enter the good IP for the gateway because you have the config result (it's where the plugin have read for the websocket port).
The 443 port is for https but websocket don't manage https.

On docker setup > https://hub.docker.com/r/marthoc/deconz You can read in Environment Variables
-e DECONZ_WS_PORT=8443 : By default, the websockets service listens on port 443; only set this environment variable if you wish to change the listen port
.

So perhpaps it's a good think to set it to 8443

The return request look like an http protocol, you can try to use this url in a browser to see wich one app is using the port 443, for me it's not deconz because of server header
http(s)://deconz_ip:443 or just https://deconz_ip (deconz_ip being the ip you have enter in hardware)

You can try to, to see wich one app use the port

Code: Select all

sudo netstat -tulpn | grep ":443"
For me

Code: Select all

pi@raspberrypi:~ $ sudo netstat -tulpn | grep ":8088"
tcp        0      0 0.0.0.0:8088            0.0.0.0:*               LISTEN      29910/deCONZ
IDK how work docker but for me there is a redirection for the port 443 from a "virtual machine" to another. So even the IP is good, it's not the good server that answer. Or the websocket have just failed because all the ports it can use are already used, but strange there is no error message.
AgeCan
Posts: 4
Joined: Friday 04 October 2019 19:45
Target OS: Linux
Domoticz version:
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by AgeCan »

Hi!

Thank for you quick response. I've changed port to 8443 and also set NAT rule in container(as were for 443) and are now receiving this in the logs:

2019-10-05 10:46:23.765 Status: (deConz plugin) Started.
2019-10-05 10:46:23.399 Error: (deConz plugin) Bad API KEY !
2019-10-05 10:46:24.162 (deConz plugin) Your haven't use 127.0.0.1 as IP, so I suppose deCONZ and Domoticz aren't on same machine
2019-10-05 10:46:24.162 (deConz plugin) Taking 192.168.1.141 as Domoticz IP
2019-10-05 10:46:24.162 (deConz plugin) Debug logging mask set to: PYTHON
2019-10-05 10:46:24.160 Status: (deConz plugin) Initialized version 1.0.10, author 'Smanar'
2019-10-05 10:46:24.163 Status: (deConz plugin) Entering work loop.
2019-10-05 10:46:34.187 (deConz plugin) onHeartbeat called
2019-10-05 10:46:34.187 (deConz plugin) ### Initialisation > config
2019-10-05 10:46:34.187 (deConz plugin) ### Request config
2019-10-05 10:46:34.187 (deConz plugin) Send Command /api/2858FD45FE/config/ with None (0 in buffer)
2019-10-05 10:46:34.187 (deConz plugin) Making Request : http://192.168.1.171:32773/api/2858FD45FE/config/ with params None
2019-10-05 10:46:34.201 (deConz plugin) Request Return : {"apiversion":"1.16.0","bridgeid":"00212EFFFF0485A7","datastoreversion":"60","devicename":"ConBee II","factorynew":false,"mac":"02:42:0a:00:03:02","modelid":"deCONZ","name":"Phoscon-GW","replacesbridgeid":null,"starterkitid":"","swversion":"2.5.69"}
2019-10-05 10:46:34.201 (deConz plugin) Classic Data : {'apiversion': '1.16.0', 'bridgeid': '00212EFFFF0485A7', 'datastoreversion': '60', 'devicename': 'ConBee II', 'factorynew': False, 'mac': '02:42:0a:00:03:02', 'modelid': 'deCONZ', 'name': 'Phoscon-GW', 'replacesbridgeid': None, 'starterkitid': '', 'swversion': '2.5.69'}

The strange thing is that the api key works if I do a manual request. And also it receives data from conbee according to the log above. Any ideas?

Thank you for helping out!
Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by Thorgal789 »

Nope, it's "light" config, it's the config you can read with bad api key, when you use a good api key the json is larger (and show all api key for exemple)
There is 2 way to retreive the api key
- the hard way https://dresden-elektronik.github.io/de ... uireapikey but set a good usename to reconize it.
- the easy way using the API_KEY.py utility
Just go in plugin folder and use

Code: Select all

python3 API_KEY.py
But on your previous test, the API key was good, where have you find it ? in a browser ?
AgeCan
Posts: 4
Joined: Friday 04 October 2019 19:45
Target OS: Linux
Domoticz version:
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by AgeCan »

Ah OK. Thought that if you received config on the API call it would ensure an OK key. I had to setup a new deconz container since qnap wouldnt let me change env variables even if shut down. Regarding generating a key I followed the getting started guid on deconz homepage. Will generate a new key when I get home this afternoon and get back to you with the result. Perhaps trying out your generate key script instead.

Thanks for your help
AgeCan
Posts: 4
Joined: Friday 04 October 2019 19:45
Target OS: Linux
Domoticz version:
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by AgeCan »

It works! I created a new key with your py script. Then I received web connection problems for the web socket. Suspected that the NAS didnt accept calls on this port. Checked the port forwarding rules for the deconz container and there were a mismatch. In port was 32000... something and when correctly set both in and to rule to 8443.

Thank you very much for all your help. Now its time for some adding/testing sensors fun!
Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by Thorgal789 »

lol, have fun !
Plantje
Posts: 451
Joined: Friday 16 October 2015 7:58
Target OS: Windows
Domoticz version:
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by Plantje »

s4xp wrote: Friday 21 December 2018 17:51 @Thorgal789, I've solved it and it was embarrassingly easy.. I forgot to install the Python runtime for my server..
Now I'll start testing it all out! ;)
Hi,

I'm using Windows as well, but there is no plugins folder where I can put my deCONZ plugin. Should I install Python on my server? And can I then just run the python files one time?
Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by Thorgal789 »

Plantje wrote: Sunday 13 October 2019 23:50 Hi,

I'm using Windows as well, but there is no plugins folder where I can put my deCONZ plugin. Should I install Python on my server? And can I then just run the python files one time?

Yep, I have same problem too, just create it, F:\Application\Domoticz\plugins\Domoticz-deCONZ on my machine, and just extract files from github inside to have something like F:\Application\Domoticz\plugins\Domoticz-deCONZ\plugin.py

And you need python too on the machine, harder than create the folder, not all python version are working (don't take the last one, last one don't mean better one), was my bigger problem > https://www.domoticz.com/wiki/Using_Python_plugins

Domotic will run the python file itself, just run domoticz and take a look on logs (setting/logs), if you have a problem on your machine, all will be written in logs.
Plantje
Posts: 451
Joined: Friday 16 October 2015 7:58
Target OS: Windows
Domoticz version:
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by Plantje »

Hmmm... and adding the Python to the path should happen automatically as well?

Then I will fiddle around with this to some extend and see what works... Downside is that installing Python is not really flying...
Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by Thorgal789 »

If you use the installer, from my memory, all will be done by it.
It's the version Im using ATM on my windows machine and domoticz

Code: Select all

C:\Users>python --version
Python 3.7.4
But yes, I have make 3/4 tries too, before successful install python, make a try and look for error message on logs.
Plantje
Posts: 451
Joined: Friday 16 October 2015 7:58
Target OS: Windows
Domoticz version:
Contact:

Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)

Post by Plantje »

Ah... that version doesn't work on mine...
I have installed it and then I get the "2019-10-14 13:22:11.373 Status: PluginSystem: Failed dynamic library load, install the latest libpython3.x library that is available for your platform." message.
After adding “C:\Users\Familie Hendrix\AppData\Local\Programs\Python\Python37-32\” to the system variables path (rather than only the user variables path) Domoticz doesn't start anymore... removing it from the path makes everything run again.

Could you please check your path?
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest