Page 18 of 35
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Wednesday 06 November 2019 11:20
by Harald777
I am on Domoticz version 4.11468 (beta)
It started two update ago.
I cannot get it to work again.
Removed the Domoticz-deCONZ folder from the plugin folder.
All running fine, no errors in the Domoticz log.
Reinstalled the deCONZ plugin, created new API key, reboot.
Domoticz boots up fine, no errors.
Via Hardware added the deCONZ plugin with correct API key and debug on.
After that the log file shows that the deCONZ plugin has started followed by:
EventSystem: Warning!, lua script /home/pi/domoticz/dzVents/runtime/dzVents.lua has been running for more than 10 seconds
That message shows 3 times and the web interface crashes.
The raspberry Pi is still accessible via Putty and WinSCP but the web interface, and Android app, does not access Domoticz.
Phoscon still working.
Sudo reboot in Pyutty will reboot the raspberry and Domoticz is starting again with the deCONZ removed as hardware from the Hardware tab.
Can add deCONZ again but with same result.
I think I have to start all ove ragain and setup Domoticz, deCONZ and Phoscon from stratch.
Hmmmmmmm
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Wednesday 06 November 2019 17:02
by Thorgal789
Have you tried to disable your scripts (LUA + dzevent) ? Perhaps the plugin trigger some blocking scripts (but I never see a script causing this kind of issues)
Or something you can try, in plugin.py around line 396
Code: Select all
def InitDomoticzDB(self,key,_Data,Type_device):
return
Just add 4* space + "return"
it will skip all devices check, but you will still have the message "### deCONZ ready". And the plugin will try some request and enable websocket too.
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Thursday 07 November 2019 8:42
by Harald777
Thorgal789 wrote: ↑Wednesday 06 November 2019 17:02
Have you tried to disable your scripts (LUA + dzevent) ? Perhaps the plugin trigger some blocking scripts (but I never see a script causing this kind of issues)
Or something you can try, in plugin.py around line 396
Code: Select all
def InitDomoticzDB(self,key,_Data,Type_device):
return
Just add 4* space + "return"
it will skip all devices check, but you will still have the message "### deCONZ ready". And the plugin will try some request and enable websocket too.
Thanks again for your support.
Unfortunately I am on the beta channel for Domoticz.
A while ago I updated Domoticz via Putty and used the beta update cmd accidentally.
Would love to go back to the stable version but that station is past because when I do that I get the message that the Domoticz database is not compatible.
So the big question is: is my problem related to the beta updated Domoticz version or is there something bad happened to the deCONZ plugin.
All LUA + dzevent scripts are disabled.
I added the "return" on row 396 and these are the errors now:
Code: Select all
2019-11-07 08:59:42.789 Status: (deCONZ) Started.
2019-11-07 08:59:42.959 Error: (deCONZ) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/Domoticz-deCONZ/:/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload:/usr/local/lib/python3.4/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.4/dist-packages:/usr/lib/dist-python'.
2019-11-07 08:59:42.959 Error: (deCONZ) Module Import failed, exception: 'IndentationError'
2019-11-07 08:59:42.960 Error: (deCONZ) Import detail: File: /home/pi/domoticz/plugins/Domoticz-deCONZ/plugin.py, Line: 399, offset: 32
2019-11-07 08:59:42.960 Error: (deCONZ) Error Line ' if 'uniqueid' in _Data:
'
2019-11-07 09:00:43.842 Error: deCONZ hardware (14) thread seems to have ended unexpectedly
2019-11-07 09:00:57.845 Error: deCONZ hardware (14) thread seems to have ended unexpectedly
Rebooting the Raspberry PI results in a normal re-boot with the deCONZ plugin removed from the hardware page.
A second try gave same errors but after reboot the plugin is still available in the hardware tab.
With the "return" on row 396 the web interface does not crash.
I am not experienced (unfortunately) in programming but it seems that the issue is Python related.
Perhaps it is best to start from scratch with the stable Domoticz release.
Greetings, Harald
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Thursday 07 November 2019 15:49
by WimV
Hi
I run Deconz in a container on a Intel-nuc, on the same machine i run Domoticz.
When i activate the plugin in Domoticz i got a error :
2019-11-07 15:27:00.440 Status: (deCONZ) Started.
2019-11-07 15:27:00.441 Status: Incoming connection from: 192.168.2.226
2019-11-07 15:27:00.817 Status: (deCONZ) Entering work loop.
2019-11-07 15:27:00.818 Status: (deCONZ) Initialized version 1.0.10, author 'Smanar'
2019-11-07 15:27:20.866 Error: (deCONZ) Your pyton version miss requests library
2019-11-07 15:27:20.866 Error: (deCONZ) To install it, type : sudo -H pip3 install requests | sudo -H pip install requests
So i try this on the commandline and i get this back:
wim@ubuntu-nuc:~/config-domoticz/plugins/Domoticz-deCONZ$ sudo -H pip3 install requests
Requirement already satisfied: requests in /usr/local/lib/python3.6/dist-packages
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.6/dist-packages (from requests)
Requirement already satisfied: idna<2.9,>=2.5 in /usr/local/lib/python3.6/dist-packages (from requests)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python3/dist-packages (from requests)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/dist-packages (from requests)
wim@ubuntu-nuc:~/config-domoticz/plugins/Domoticz-deCONZ$ sudo -H pip install requests
Requirement already satisfied: requests in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python2.7/dist-packages (from requests)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python2.7/dist-packages (from requests)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/dist-packages (from requests)
Requirement already satisfied: idna<2.9,>=2.5 in /usr/local/lib/python2.7/dist-packages (from requests)
wim@ubuntu-nuc:~/config-domoticz/plugins/Domoticz-deCONZ$
I try to run version 1.0.9 but that was also not a solution because there was a lot of other errors
The python versions are : 2.7.15+ and 3.6.8
And Domoticz Version: 4.11077
I search on this topic but i can find a solution.
Regards , Wim
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Thursday 07 November 2019 16:14
by snuiter
Currently there are more topics on this matter, this impacts my Zigbee2MQTT but also MQTT for Tasmota and somehow relates to Python. Have not seen the solution yet but this is not related to your specific setup.
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Thursday 07 November 2019 16:35
by Thorgal789
Harald777 wrote: ↑Thursday 07 November 2019 8:42
Unfortunately I am on the beta channel for Domoticz.
A while ago I updated Domoticz via Putty and used the beta update cmd accidentally.
Would love to go back to the stable version but that station is past because when I do that I get the message that the Domoticz database is not compatible.
So the big question is: is my problem related to the beta updated Domoticz version or is there something bad happened to the deCONZ plugin.
All LUA + dzevent scripts are disabled.
Rebooting the Raspberry PI results in a normal re-boot with the deCONZ plugin removed from the hardware page.
A second try gave same errors but after reboot the plugin is still available in the hardware tab.
With the "return" on row 396 the web interface does not crash.
I am not experienced (unfortunately) in programming but it seems that the issue is Python related.
Perhaps it is best to start from scratch with the stable Domoticz release.
I realy can't say, but I haven't changed something on the plugin, and you have theses crash since the domoticz update. And for the moment, you are the only one.
But don't make all modifications in same time, try first with lua disabled but with python code intact, and if you still have crash modify the python code.
"indent error" is syntax error, my bad, it's 4 * space + 4 normal space (so 8 in reality). You need to have "return" at same offset than 'if 'uniqueid' in _Data:'
Try this code >
https://pastebin.com/hm7Y9Ta5
If we don't found yep, you can restart from scratch, but I realy think the probleme is from a lua script.
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Thursday 07 November 2019 16:37
by Thorgal789
WimV wrote: ↑Thursday 07 November 2019 15:49
Yeah, I already have this problem, but on older domoticz version.
If i m right, you can use the request lib without problem on python code, but not in domoticz ?
It's a library path problem, I have a workaround to test, I just need to recover it, give me some time.
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Thursday 07 November 2019 17:00
by Thorgal789
Ok, so I hope you know a lot python ^^.
It something like that (add them just after "import json,urllib, time"
Code: Select all
import sys
sys.path.append('/usr/local/lib/python3.6/site-packages')
With the good path to your request lib
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Thursday 07 November 2019 19:41
by WimV
Thorgal789 wrote: ↑Thursday 07 November 2019 16:37
WimV wrote: ↑Thursday 07 November 2019 15:49
Yeah, I already have this problem, but on older domoticz version.
If i m right, you can use the request lib without problem on python code, but not in domoticz ?
It's a library path problem, I have a workaround to test, I just need to recover it, give me some time.
Ok, Thanks
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Friday 08 November 2019 10:44
by Harald777
Thorgal789 wrote: ↑Thursday 07 November 2019 16:35
I really can't say, but I haven't changed something on the plugin, and you have theses crash since the domoticz update. And for the moment, you are the only one.
But don't make all modifications in same time, try first with lua disabled but with python code intact, and if you still have crash modify the python code.
"indent error" is syntax error, my bad, it's 4 * space + 4 normal space (so 8 in reality). You need to have "return" at same offset than 'if 'uniqueid' in _Data:'
Try this code >
https://pastebin.com/hm7Y9Ta5
If we don't found yep, you can restart from scratch, but I realy think the probleme is from a lua script.
No LUA or dzVents script active (checked folders via WinSCP and cleared all).
Tried script with correct "return" with following result:
Code: Select all
2019-11-08 10:22:17.193 Status: (deCONZ) Started
2019-11-08 10:23:19.352 Error: deCONZ hardware (14) thread seems to have ended unexpectedly
2019-11-08 10:23:33.355 Error: deCONZ hardware (14) thread seems to have ended unexpectedly
After a few minutes the web interface crashes.
Rebooted and plugin removed from Hardware Tab.
After that used your suggested new code and added deCONZ plugin again via Hardware Tab with result:
Code: Select all
2019-11-08 10:32:38.500 Status: (deCONZ) Started.
2019-11-08 10:33:39.039 Error: deCONZ hardware (14) thread seems to have ended unexpectedly
2019-11-08 10:34:21.047 Error: Raspberry PI hardware (13) thread seems to have ended unexpectedly
2019-11-08 10:39:36.297 Error: mainworker seems to have ended or hung unexpectedly (last update 301.000000 seconds ago)
2019-11-08 10:39:36.297 Error: Domoticz(867) is exiting due to watchdog triggered...
After a some time again the web server crashes wit error:
Code: Select all
2019-11-08 10:34:21.047 Error: WebServer:8443 thread seems to have ended unexpectedly (last update 73.000000 seconds ago)
Not port 8433 related, when 8080 is in use same things happens.
The log also reveals that the RFLink Gateway does not function anymore:
Code: Select all
2019-11-08 10:34:35.050 Error: RFLink Gateway hardware (2) nothing received for more than 1 Minute!....
2019-11-08 10:34:36.051 Error: Restarting: RFLink Gateway
Sudo reboot via Putty results in a reboot, Domoticz up and running again and deCONZ removed from the Hardware Tab.
When I have the time I will start from scratch, its the only solution I believe.
Greetings, Harald
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Friday 08 November 2019 16:40
by Thorgal789
WimV wrote: ↑Thursday 07 November 2019 19:41
Thorgal789 wrote: ↑Thursday 07 November 2019 16:37
WimV wrote: ↑Thursday 07 November 2019 15:49
Yeah, I already have this problem, but on older domoticz version.
If i m right, you can use the request lib without problem on python code, but not in domoticz ?
It's a library path problem, I have a workaround to test, I just need to recover it, give me some time.
Ok, Thanks
Have you try the 2 lines in the previous post ?
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Friday 08 November 2019 16:52
by Thorgal789
Harald777 wrote: ↑Friday 08 November 2019 10:44
Code: Select all
2019-11-08 10:23:19.352 Error: deCONZ hardware (14) thread seems to have ended unexpectedly
Just this line, it's not something normal.
Another thing you can try, but boring, make a backup and try with a new domoticz database, to check if the problem is not in the database.
You have try several domoticz version.
You are the only one with the problem, so I don't think the problem is from the python code.
You have try with script disabled
I see only the database as suspect, or the python framework. But for the second one will be hard to find the problem, you need to disable most of the code, and enable part one by one.
Or you can try with disabling the websocket connection by adding a '#' behind the line
Code: Select all
#self.WebSocket = Domoticz.Connection(Name="deCONZ_WebSocket", Transport="TCP/IP", Address=Parameters["Address"], Port=str(_Data['websocketport']) )
#self.WebSocket.Connect()
But you will have so much errors, not sure the plugin will not stop.
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Saturday 09 November 2019 10:04
by Thorgal789
Ok so, new version online, with among others
- better support for thermostatic valve (thx a lot to @salopette) who is still testing the code.
- better support for window covering.
- Long press for ikea remonte (thx to @bitjeverkeerd)
- Better support for legrand hardware (And here I had so much users to help me, @xmillies, @gaz and a big thx to @pipiche again)
Some information for users who want to use legrand device, there is an hidden option for wired switch without firmware update or window covering switch (up to the next deconz update)
If you have problem, just add in device description "NO DIMMER", it will disable the dimmer fonction you will not have without firmware update.
To use the legrand update you need at least the deconz Version 70, but this version have some problem, it's for that it's not on stable branch yet, so better to wait for it or the V71 version.
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Saturday 09 November 2019 12:33
by WimV
Thorgal789 wrote: ↑Thursday 07 November 2019 17:00
Ok, so I hope you know a lot python ^^.
It something like that (add them just after "import json,urllib, time"
Code: Select all
import sys
sys.path.append('/usr/local/lib/python3.6/site-packages')
With the good path to your request lib
The path is: /usr/local/lib/python3.6/dist-packages/requests/ "witch lib ? "
I write this in plugin.py but the same error was there.
I know nothing about python HI.
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Sunday 10 November 2019 21:40
by Harald777
Thorgal789,
Today had the time to start from scratch.
Installed a fresh Raspbian BUster Lite on my Raspberry PI together with a new Stable Domoticz.
With the new Raspbian image came Python 3.7.
Installed Raspbee / Phoscon and the deCONZ plugin.
All okay.
At this moment I am not able to create the PI Key wit command:
Code: Select all
python3 API_KEY.py 127.0.0.1:80 create
It returns with following issue:
Code: Select all
Traceback (most recent call last):
File "/usr/lib/python3.7/urllib/request.py", line 1317, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/usr/lib/python3.7/http/client.py", line 1229, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1275, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1016, in _send_output
self.send(msg)
File "/usr/lib/python3.7/http/client.py", line 956, in send
self.connect()
File "/usr/lib/python3.7/http/client.py", line 928, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/usr/lib/python3.7/socket.py", line 727, in create_connection
raise err
File "/usr/lib/python3.7/socket.py", line 716, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "API_KEY.py", line 25, in <module>
response = request.urlopen(req,timeout=3).read()
File "/usr/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/lib/python3.7/urllib/request.py", line 1345, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/lib/python3.7/urllib/request.py", line 1319, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 111] Connection refused>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "API_KEY.py", line 33, in <module>
elif e.code == 403:
AttributeError: 'URLError' object has no attribute 'code'
Hmmmmmmmmmmm
Gives return:
Code: Select all
Exemples of use
python3 API_KEY.py <ip>:<port> <command> <Api key> <data>
python3 API_KEY.py 127.0.0.1:80 create
python3 API_KEY.py 127.0.0.1:80 info B4B018AA61
python3 API_KEY.py 127.0.0.1:80 list B4B018AA61
python3 API_KEY.py 127.0.0.1:80 delete B4B018AA61 CA606DA036
python3 API_KEY.py 127.0.0.1:80 clean B4B018AA61
So why I cannot create a API Key.
Starting the deCONZ plugin in Domoticz without the correct key shows error:
Error: (deCONZ) Connexion problem (3) with Gateway, check your API key, or Use Request lib > V2.4.2
Greetings, Harald
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Monday 11 November 2019 9:55
by Thorgal789
Deconz is already running ?
Code: Select all
pi@raspberrypi:~ $ ps ax | grep deCONZ
292 ? Ss 114:05 /bin/bash /usr/bin/deCONZ-update2.sh
297 ? Ss 300:39 /bin/bash /usr/bin/deCONZ-WIFI2.sh
19128 ? Ssl 414:57 /usr/bin/deCONZ --http-port=80
21317 pts/0 S+ 0:00 grep --color=auto deCONZ
If yes, it's perhpaps the port. Ip is good for local use.
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Monday 11 November 2019 14:03
by Harald777
Thorgal789 wrote: ↑Monday 11 November 2019 9:55
Deconz is already running ?
Code: Select all
pi@raspberrypi:~ $ ps ax | grep deCONZ
292 ? Ss 114:05 /bin/bash /usr/bin/deCONZ-update2.sh
297 ? Ss 300:39 /bin/bash /usr/bin/deCONZ-WIFI2.sh
19128 ? Ssl 414:57 /usr/bin/deCONZ --http-port=80
21317 pts/0 S+ 0:00 grep --color=auto deCONZ
If yes, it's perhpaps the port. Ip is good for local use.
Indeed deCONZ was not running.
Using Headless installation so used:
All okay now for the raspberry pi / domoticz combo, no more error messages show up.
Top.
Thanks again for your support
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Monday 11 November 2019 20:14
by WimV
With the good path to your request lib
[/quote]
The path is: /usr/local/lib/python3.6/dist-packages/requests/
I write this in plugin.py but the same error was there.
I know nothing about python HI.
[/quote]
Hi Thorgal789
I wrote the 2 lines in plugin.py, but there was the same error.
I make another clean Domoticz and install the plugin but whits the same result, because i think it is Ubuntu and not in de plugin.
I did not know where i can find a solution.
Do you know a way to find the error in python?
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Tuesday 12 November 2019 12:41
by Harald777
Hi All,
Does anyone knows if the new Xiaomi Aqara Opple switches work with the Raspbee?
Harald
Re: Python Zigbee plugin, deCONZ bridge (Using Conbee or Raspbee)
Posted: Tuesday 12 November 2019 18:43
by Thorgal789
Harald777 wrote: ↑Tuesday 12 November 2019 12:41
Does anyone knows if the new Xiaomi Aqara Opple switches work with the Raspbee?
I think not yet, I haven't see something aout this device, I'm just discovering ATM ^^.
https://github.com/dresden-elektronik/d ... -552559549
WimV wrote: ↑Monday 11 November 2019 20:14
I wrote the 2 lines in plugin.py, but there was the same error.
I make another clean Domoticz and install the plugin but whits the same result, because i think it is Ubuntu and not in de plugin.
I did not know where i can find a solution.
Do you know a way to find the error in python?
So what I would do on my side.
- At domoticz startup, you can see the python version it will use, I will compare it with the one I m using on the system with "python3 -- version"
- If it's not the same I will switch the version with "update-alternatives"
- Then I will test if request library is working on my system
Code: Select all
pi@raspberrypi:~ $ python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> exit()
- Then I will test it in a plugin, for exemple the deconz one removing the except loop (with adding requests in the import line a second time)
- If I have an error, an import error I think, hopping for more information from domoticz.
- I will search where is the lib is on my system, looking with a file browser and add the path in the python code
Code: Select all
import sys
sys.path.append('/usr/local/lib/python3.6/site-packages')
On this exemple, I realy have a folder called "requests" in '/usr/local/lib/python3.6/site-packages' and it's the one that is working for the version I m using.
- If it's not working yet, ask on domoticz forum why the "requests" lib can't be used on python 3.x.x with domoticz