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 »

Yep, humongous data = API key ok (this command list all your lights), "unauthorised user" > bad key

@ tjabas I have this bug too, since the last update of deCONZ (since 3/4 days), the JSON are sometime in double/triple format, I need to investigate that, but I will make a patch today for it.
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by tjabas »

ok, nice , keep up the good work :)
could you attach a link when the update has been done.

by the way, have you encountered booting problems when you have both deconz and domoticz on the same pi?
mine wont boot after i have pulled the plug, its just deconz that boots, not domoticz.
i have to restart the pi with sudo reboot after pulling the plug, then both deconz and domoticz starts.
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, I have too deconz and domoticz on same pi (all the pi3 under 5% cpu usage).
Perhaps a consumption problem if you have too much device, but I can understand if domotics start and not deconz but not the reverse ....
It s realy strange something can prevent Domoticz load.

To make deconz autostart I have use

Code: Select all

mkdir ~/.config/autostart
touch ~/.config/autostart/deCONZ.desktop
And I have copy the content from to other desktop file to this one.
So Domoticz start first, and deCONZ after the GUI.
Last edited by Thorgal789 on Saturday 22 December 2018 16:12, edited 1 time in total.
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 1h I m playing with my device, and I can't reproduce the bug with bad JSON, so rare.
I have push a new version, you still have the error message, but the Json will be corrected to be used (In theory, because I haven't the bug yet to test)

Have you often this bug ? (It's from the websocket connexion, can't be a connexion problem if all application are on the same raspberry)

I m using deconz V 2.05.50 ATM.
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by tjabas »

Thorgal789 wrote: Saturday 22 December 2018 15:42 Nope, I have too deconz and domoticz on same pi (all the pi3 under 5% cpu usage).
Perhaps a consumption problem if you have too much device, but I can understand if domotics start and not deconz but not the reverse ....
It s realy strange something can prevent Domoticz load.

To make deconz autostart I have use

Code: Select all

mkdir ~/.config/autostart
touch ~/.config/autostart/deCONZ.desktop
And I have copy the content from to other desktop file to this one.
So Domoticz start first, and deCONZ after the GUI.
Can i use/install these lines in the command prompt
And domoticz will be starting first and deconz second?
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 »

For me yes, because Domoticz start with the system and this trick is only for GUI, so the raspberry run first domoticz then the GUI and after deCONZ.
You can use the command prompt but to copy the desktop file content, I have used the GUI (if you only use theses 2 lines, you will have the file, but empty)
/usr/share/applications/deCONZ.desktop to ~/.config/autostart/deCONZ.desktop.

Code: Select all

[Desktop Entry]
Name=deCONZ
Comment=ZigBee monitoring and control
Exec=/usr/bin/deCONZ-autostart.sh
Icon=/usr/share/deCONZ/icons/de_logo_48px.png
Terminal=false
Type=Application
Categories=Development;
StartupNotify=false
Are you using the headless mode ?
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by tjabas »

Thorgal789 wrote: Saturday 22 December 2018 17:04 For me yes, because Domoticz start with the system and this trick is only for GUI, so the raspberry run first domoticz then the GUI and after deCONZ.
You can use the command prompt but to copy the desktop file content, I have used the GUI (if you only use theses 2 lines, you will have the file, but empty)
/usr/share/applications/deCONZ.desktop to ~/.config/autostart/deCONZ.desktop.

Code: Select all

[Desktop Entry]
Name=deCONZ
Comment=ZigBee monitoring and control
Exec=/usr/bin/deCONZ-autostart.sh
Icon=/usr/share/deCONZ/icons/de_logo_48px.png
Terminal=false
Type=Application
Categories=Development;
StartupNotify=false
Are you using the headless mode ?
yes im using the headless mode
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 »

Arf, so this method can't work in your situation.
IDK how to do, but use a delay can be a solution.
You can ask on deCONZ github but will be usefull if you can see where your loading hang on, because the bug can come from domoticz and not deCONZ as it's domoticz that don't launch.

You have not error message ? Have tried to reload Domoticz with command line ?
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by tjabas »

I have tried this:
mkdir ~/.config/autostart
touch ~/.config/autostart/deCONZ.desktop

but it says that the file exists,
i really dont how to install this:
[Desktop Entry]
Name=deCONZ
Comment=ZigBee monitoring and control
Exec=/usr/bin/deCONZ-autostart.sh
Icon=/usr/share/deCONZ/icons/de_logo_48px.png
Terminal=false
Type=Application
Categories=Development;
StartupNotify=false

im not that good att programming, sorry.
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 »

You can use to edit file

Code: Select all

sudo nano ~/.config/autostart/deCONZ.desktop
But it will work only with using GUI, this method load application after the GUI was loaded, no difference for you in headless mode.
There is some trick here to delay service boot https://askubuntu.com/questions/90982/h ... -run-later

But for me it's a bug, on normal usage you don't need to use theses files, if after a boot only deconz is running and not domoticz, try to run domoticz manually

Code: Select all

sudo /etc/init.d/domoticz.sh start
And hope for an error message.
ivarka
Posts: 11
Joined: Sunday 17 April 2016 21:00
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by ivarka »

Thanks for creating this plugin!

Ignore question below.... worked after a reboot!

Just one question; Are trådfri motion sensors missing?

I'm getting

Code: Select all

2018-12-29 20:49:32.807 Error: (deConz) Unknow MAJ{'name': 'TRÅDFRI Motion sensor', 'uniqueid': '00:0b:57:ff:fe:2d:61:6b-01-0006', 'id': '2', 'r': 'sensors', 't': 'event', 'e': 'changed'}
and later

Code: Select all

2018-12-29 20:54:04.979 (deConz) Banned device > 2 (sensors)
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 »

YEp ^^.
It's because you have changed a device name in phoscon (for exemple). The plugin never change name, else you will need to change all your lua script for exemple, or added device after the synchronisation.

When you have this kind of desynchronisation, don't worry just restart the plugin > "Hardware" , select "deconz" then "Update". You don't need to reboot.
wizzard72
Posts: 116
Joined: Friday 20 December 2013 7:45
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by wizzard72 »

I have recently bought a Dresden Zigbee USB stick. I have only one sensor added. But I got the following error in the logfile:

Code: Select all

2019-01-18 08:56:32.885 Error: (deCONZ) Bad JSON response : {}
It seems the plugin has troubles when there is no lightbulb added.
Some more logging:

Code: Select all

2019-01-18 08:58:02.922 (deCONZ) ### Request lights
2019-01-18 08:58:02.922 (deCONZ) Send Command /api/F9999999999/lights/ with None
2019-01-18 08:58:02.922 (deCONZ) Deallocating connection object 'deCONZ_Com' (192.168.x.x:80).
2019-01-18 08:58:02.922 (deCONZ) Pushing 'ConnectDirective' on to queue
2019-01-18 08:58:02.922 (deCONZ) Processing 'ConnectDirective' message
2019-01-18 08:58:02.922 (deCONZ) Protocol for 'deCONZ_Com' not specified, 'None' assumed.
2019-01-18 08:58:02.922 (deCONZ) Transport set to: 'TCP/IP', 192.168.x.x:80.
2019-01-18 08:58:02.923 (deCONZ) Connect directive received, action initiated successfully.
2019-01-18 08:58:02.924 (deCONZ) Pushing 'onConnectCallback' on to queue
2019-01-18 08:58:02.973 (deCONZ) Processing 'onConnectCallback' message
2019-01-18 08:58:02.973 (deCONZ) Calling message handler 'onConnect'.
2019-01-18 08:58:02.973 (deCONZ) onConnect called
2019-01-18 08:58:02.973 (deCONZ) Pushing 'WriteDirective' on to queue
2019-01-18 08:58:02.973 (deCONZ) Processing 'WriteDirective' message
2019-01-18 08:58:02.973 (deCONZ) Sending 188 bytes of data
2019-01-18 08:58:02.973 (deCONZ) 47 45 54 20 2f 61 70 69 2f 46 39 32 32 34 39 46 34 32 37 2f GET./api/F9999999999/
2019-01-18 08:58:02.973 (deCONZ) 6c 69 67 68 74 73 2f 20 48 54 54 50 2f 31 2e 31 0d 0a 48 6f lights/.HTTP/1.1..Ho
2019-01-18 08:58:02.974 (deCONZ) 73 74 3a 20 31 39 32 2e 31 36 38 2e 31 37 2e 32 35 30 3a 38 st:.192.168.x.x:8
2019-01-18 08:58:02.974 (deCONZ) 30 0d 0a 55 73 65 72 2d 41 67 65 6e 74 3a 20 44 6f 6d 6f 74 0..User-Agent:.Domot
2019-01-18 08:58:02.974 (deCONZ) 69 63 7a 2f 31 2e 30 0d 0a 41 63 63 65 70 74 3a 20 74 65 78 icz/1.0..Accept:.tex
2019-01-18 08:58:02.974 (deCONZ) 74 2f 68 74 6d 6c 2c 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 t/html,application/x
2019-01-18 08:58:02.974 (deCONZ) 68 74 6d 6c 2b 78 6d 6c 2c 61 70 70 6c 69 63 61 74 69 6f 6e html+xml,application
2019-01-18 08:58:02.974 (deCONZ) 2f 78 6d 6c 3b 71 3d 30 2e 39 2c 2a 2f 2a 3b 71 3d 30 2e 38 /xml;q=0.9,*/*;q=0.8
2019-01-18 08:58:02.974 (deCONZ) 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 6b 65 65 70 2d 61 ..Connection:.keep-a
2019-01-18 08:58:02.974 (deCONZ) 6c 69 76 65 0d 0a 0d 0a .. .. .. .. .. .. .. .. .. .. .. .. live....
2019-01-18 08:58:02.975 (deCONZ) Pushing 'ReadEvent' on to queue
2019-01-18 08:58:03.024 (deCONZ) Processing 'ReadEvent' message
2019-01-18 08:58:03.024 (deCONZ) Received 159 bytes of data
2019-01-18 08:58:03.024 (deCONZ) 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d 0a 41 63 63 HTTP/1.1.200.OK..Acc
2019-01-18 08:58:03.024 (deCONZ) 65 73 73 2d 43 6f 6e 74 72 6f 6c 2d 41 6c 6c 6f 77 2d 4f 72 ess-Control-Allow-Or
2019-01-18 08:58:03.025 (deCONZ) 69 67 69 6e 3a 20 2a 0d 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 igin:.*..Content-Typ
2019-01-18 08:58:03.025 (deCONZ) 65 3a 20 61 70 70 6c 69 63 61 74 69 6f 6e 2f 6a 73 6f 6e 3b e:.application/json;
2019-01-18 08:58:03.025 (deCONZ) 20 63 68 61 72 73 65 74 3d 75 74 66 2d 38 0d 0a 43 6f 6e 74 .charset=utf-8..Cont
2019-01-18 08:58:03.025 (deCONZ) 65 6e 74 2d 4c 65 6e 67 74 68 3a 32 0d 0a 45 54 61 67 3a 22 ent-Length:2..ETag:"
2019-01-18 08:58:03.025 (deCONZ) 36 36 32 39 65 66 31 30 61 62 38 34 30 30 34 64 34 31 39 30 6629ef10ab84004d4190
2019-01-18 08:58:03.025 (deCONZ) 31 34 34 65 39 31 30 30 34 63 63 37 22 0d 0a 0d 0a 7b 7d .. 144e91004cc7"....{}
2019-01-18 08:58:03.025 (deCONZ) Pushing 'onMessageCallback' on to queue
2019-01-18 08:58:03.025 (deCONZ) Processing 'onMessageCallback' message
2019-01-18 08:58:03.025 (deCONZ) Calling message handler 'onMessage'.
2019-01-18 08:58:03.025 (deCONZ) onMessage called
2019-01-18 08:58:03.025 (deCONZ) Pushing 'DisconnectDirective' on to queue
2019-01-18 08:58:03.026 (deCONZ) Classic Data : {}
2019-01-18 08:58:03.026 (deCONZ) Processing 'DisconnectDirective' message
2019-01-18 08:58:03.026 (deCONZ) Disconnect directive received for '192.168.x.x:80'.
2019-01-18 08:58:03.026 (deCONZ) Handling disconnect, socket (192.168.x.x:80) is connected
2019-01-18 08:58:03.026 (deCONZ) Queued asyncronous read aborted (192.168.x.x:80).
2019-01-18 08:58:03.026 (deCONZ) Pushing 'DisconnectedEvent' on to queue
2019-01-18 08:58:03.026 (deCONZ) Processing 'DisconnectedEvent' message
2019-01-18 08:58:03.027 (deCONZ) Disconnect event received for '192.168.x.x:80'.
2019-01-18 08:58:03.027 (deCONZ) Pushing 'onDisconnectCallback' on to queue
2019-01-18 08:58:03.027 (deCONZ) Processing 'onDisconnectCallback' message
2019-01-18 08:58:03.027 (deCONZ) Calling message handler 'onDisconnect'.
2019-01-18 08:58:03.026 Error: (deCONZ) Bad JSON response : {}
If I connect to the api manually:

Code: Select all

http://192.168.x.x/api/F999999999/lights/
I got the same answer:

Code: Select all

{}
It looks like the plugin won't handle {} correctly.
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 »

Yep, it s exactly that, but it's strange, when have you installed the plugin ?
This bug was corrected the 12/01/19, are you using the "1.0.2" version ? you can find the version number inside the plugin.py file, on the firsts lines.
wizzard72
Posts: 116
Joined: Friday 20 December 2013 7:45
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by wizzard72 »

I installed the plugin 30 december 2018, so that was the problem. I have updated the plugin and the problems are gone. I don't know why, but I forgot that I had installed the plugin, I thought that it came with Domoticz, so a git pull did his work.

Thanks for your help.
User avatar
Minglarn
Posts: 214
Joined: Friday 21 August 2015 19:27
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Stockholm / Sweden
Contact:

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

Post by Minglarn »

Code: Select all

2019-02-03 16:17:57.868 Error: (ConBee) WebSocket Disconnected, reconnexion !
2019-02-03 16:17:57.869 Error: CConnection_connect, connect request from 'ConBee' ignored. Transport is connecting.
2019-02-03 16:17:57.970 Error: (ConBee) deCONZ error :{'error': {'address': 'api/1234567890/lights', 'description': 'unauthorized user', 'type': 1}}
So... i'm trying to get this started... Got the lastest from https://github.com/Smanar/Domoticz-deCONZ

Any help on resolving this?
And when trying to update the API key I get this...

Code: Select all

pi@domo:~/domoticz/plugins/Domoticz-deCONZ $ sudo python API_KEY.py
Traceback (most recent call last):
  File "API_KEY.py", line 6, in <module>
    from urllib import request, parse
ImportError: cannot import name request
All tips are appreciated..
When you eliminate the impossible, whatever remains, however improbable, must be the truth.” -Spock in Star Trek VI
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, so first you are right, the problem is from your API key.
This code if for python3, and you force the python2 interpreter > sudo python API_KEY.py.
Try with

Code: Select all

python3 API_KEY.py 127.0.0.1:80 create
I m going to update the gihub

And you can too use a REST client https://dresden-elektronik.github.io/de ... uireapikey.
User avatar
Minglarn
Posts: 214
Joined: Friday 21 August 2015 19:27
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Stockholm / Sweden
Contact:

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

Post by Minglarn »

You're a genius.... Thanks!
2019-02-03 18:08:45.621 Status: (ConBee) ### deCONZ ready

Now it works... Big thanks!

Edit... Was to quick...
Connections seems be OK but got this in the logs:

Code: Select all

2019-02-03 18:20:51.089 Error: (ConBee) WebSocket Disconnected, reconnexion !
2019-02-03 18:20:51.089 Error: CConnection_connect, connect request from 'ConBee' ignored. Transport is connecting.
And state of devices does not change ..
When you eliminate the impossible, whatever remains, however improbable, must be the truth.” -Spock in Star Trek VI
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 »

Wich one port you have set for websocket ? 8088 ?
User avatar
Minglarn
Posts: 214
Joined: Friday 21 August 2015 19:27
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Stockholm / Sweden
Contact:

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

Post by Minglarn »

1.JPG
1.JPG (17.86 KiB) Viewed 2293 times
Yes...
When you eliminate the impossible, whatever remains, however improbable, must be the truth.” -Spock in Star Trek VI
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest