Python plugin: WiZ Connected

Python and python framework

Moderator: leecollings

sydspost
Posts: 3
Joined: Wednesday 04 November 2020 10:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Python plugin: WiZ Connected

Post by sydspost »

Bought recently a WiZ connected WiFI-lightbulb in the Supermarket without checking if there was support for this brand in Domoticz. I found out the hardway that there was no support ;-)

So, i made my own plugin which operates the lightbulb within your local network, no access to the WiZ connected cloud is needed. Except for the initial pairing of the device with your WiFi. After the pairing is done, you can delete the device from the WiZ connected cloud and/or close your account.

Key features:
  • Auto-detects devices in your network
    Tested with WiZ whites lights (but should control other devices on/off)
    Allows controlling Dimmer/Cold-Warm for lights
    When device operated by app, Domoticz is synchronized every 10 seconds
You can download the plugin from https://github.com/sydspost/Domoticz-Wi ... ted-plugin

Enjoy !
User avatar
waltervl
Posts: 5846
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python plugin: WiZ Connected

Post by waltervl »

Thank you, I will add it to the wiki plugin list as soon as I am back from holiday. The list is hard to edit from my smartphone... :-)

I saw a little mistake in your readme installation instructions. It says you have to pull Xenomes/Domoticz-TUYA-Plugin but I think you want them to pull yours :-)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 5846
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python plugin: WiZ Connected

Post by waltervl »

waltervl wrote: Wednesday 28 July 2021 12:47 Thank you, I will add it to the wiki plugin list as soon as I am back from holiday. The list is hard to edit from my smartphone... :-)

I saw a little mistake in your readme installation instructions. It says you have to pull Xenomes/Domoticz-TUYA-Plugin but I think you want them to pull yours :-)
I have added it to the wiki plugin list https://www.domoticz.com/wiki/Plugins
You stll haven't repaired your copy paste error ;-)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
Bartb
Posts: 17
Joined: Monday 29 August 2016 22:19
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: Python plugin: WiZ Connected

Post by Bartb »

Hi,
I bought one of these lamps at AH for testing.
I got it working with the official iPhone app, so it connects to wifi now.
I was also able install the plugin in Domoticz and to select "Wiz Connect" type in the HW in the menu.
There I configured the correct subnet.
Then it created a (lamp) device in Domoticz..... but in the end the lamp doesn't respond in any way.
I am also able to ping the lamp on its ip-address from the Domoticz Raspberry Pi.

Error messages I get are the following:
-------
2021-08-08 19:37:13.007 Error: Wiz Lamps: (Wiz Lamps) 'onCommand' failed 'gaierror':'[Errno -2] Name or service not known'.
2021-08-08 19:37:13.007 Error: Wiz Lamps: (Wiz Lamps) ----> Line 313 in '/home/pi/domoticz/plugins/Domoticz-WiZ-connected-plugin/plugin.py', function onCommand
2021-08-08 19:37:13.007 Error: Wiz Lamps: (Wiz Lamps) ----> Line 171 in '/home/pi/domoticz/plugins/Domoticz-WiZ-connected-plugin/plugin.py', function onCommand
2021-08-08 19:37:18.040 Error: Wiz Lamps: (Wiz Lamps) 'onCommand' failed 'gaierror':'[Errno -2] Name or service not known'.
2021-08-08 19:37:18.040 Error: Wiz Lamps: (Wiz Lamps) ----> Line 313 in '/home/pi/domoticz/plugins/Domoticz-WiZ-connected-plugin/plugin.py', function onCommand
2021-08-08 19:37:18.040 Error: Wiz Lamps: (Wiz Lamps) ----> Line 137 in '/home/pi/domoticz/plugins/Domoticz-WiZ-connected-plugin/plugin.py', function onCommand
2021-08-08 19:37:33.753 Error: Wiz Lamps: (Wiz Lamps) handleThread: [Errno -2] Name or service not known line 251
-------


In the normal logs in Domoticz I see:
-------
2021-08-08 20:08:33.032 Wiz Lamps: (Wiz Lamps) Pushing 'onHeartbeatCallback' on to queue
2021-08-08 20:08:33.082 (Wiz Lamps) Processing 'onHeartbeatCallback' message
2021-08-08 20:08:33.083 Wiz Lamps: (Wiz Lamps) Calling message handler 'onHeartbeat' on 'module' type object.
2021-08-08 20:08:33.083 Wiz Lamps: (Wiz Lamps) onHeartbeat called time=1628446113.0832183
2021-08-08 20:08:33.084 Wiz Lamps: (Wiz Lamps) in handlethread
------


Any idea's?

Thanks!
lassehifi
Posts: 4
Joined: Thursday 28 December 2017 11:03
Target OS: Windows
Domoticz version:
Contact:

Re: Python plugin: WiZ Connected

Post by lassehifi »

Hi!
I'm trying to use this Plugin on a Windows installation. It seems that scapy fail to be imported by the script.
Scapy is installed according to the instruction on this site:
https://scapy.readthedocs.io/en/latest/ ... structions

Any ideas how to setup this for running on a Windows PC?

EDIT:
I actually got it working now by moving the directory structure up one level for scapy under 'C:\Program Files (x86)\Python35-32\lib\site-packages'. Do not why the installation added one extra folder in the beginning...

The now the plugin loads, next step is to configure. But this issue is solved.

/Lars

Code: Select all

2021-10-18 18:59:44.178 Error: WiZ : (wiz) failed to load 'plugin.py', Python Path used was 'C:\Domoticz\plugins\Domoticz-WiZ-connected-plugin\;C:\Program Files (x86)\Python35-32\python35.zip;C:\Program Files (x86)\Python35-32\Lib\;C:\Program Files (x86)\Python35-32\DLLs\;C:\Domoticz;C:\Program Files (x86)\Python35-32;C:\Program Files (x86)\Python35-32\lib\site-packages'.
2021-10-18 18:59:44.178 Error: WiZ : (WiZ ) Module Import failed, exception: 'ImportError'
2021-10-18 18:59:44.179 Error: WiZ : (WiZ ) Module Import failed: ' Name: scapy'
2021-10-18 18:59:44.179 Error: WiZ : (WiZ ) Error Line details not available.
2021-10-18 18:59:44.179 Error: WiZ : (WiZ ) Exception traceback:
2021-10-18 18:59:44.179 Error: WiZ : (WiZ ) ----> Line 53 in 'C:\Domoticz\plugins\Domoticz-WiZ-connected-plugin\plugin.py', function <module>
renevandenbroek
Posts: 12
Joined: Sunday 05 June 2016 21:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: WiZ Connected

Post by renevandenbroek »

I installed the plugin but get these errors:

Code: Select all

2021-11-17 16:10:32.285 Error: Wiz connected: (wiz) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/Domoticz-WiZ-connected-plugin/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2021-11-17 16:10:32.285 Error: Wiz connected: (Wiz connected) Module Import failed, exception: 'ModuleNotFoundError'
2021-11-17 16:10:32.285 Error: Wiz connected: (Wiz connected) Module Import failed: ' Name: scapy.all'
2021-11-17 16:10:32.286 Error: Wiz connected: (Wiz connected) Error Line details not available.
2021-11-17 16:10:32.286 Error: Wiz connected: (Wiz connected) Exception traceback:
2021-11-17 16:10:32.286 Error: Wiz connected: (Wiz connected) ----> Line 53 in '/home/pi/domoticz/plugins/Domoticz-WiZ-connected-plugin/plugin.py', function <module>
What went wong?
renevandenbroek
Posts: 12
Joined: Sunday 05 June 2016 21:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: WiZ Connected

Post by renevandenbroek »

Any body any idea what I did wrong? Or should do?
User avatar
waltervl
Posts: 5846
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python plugin: WiZ Connected

Post by waltervl »

Did you install the scapy module according instructions?

Code: Select all

sudo apt-get install python-scapy
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
renevandenbroek
Posts: 12
Joined: Sunday 05 June 2016 21:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: WiZ Connected

Post by renevandenbroek »

Yes I followed https://github.com/sydspost/Domoticz-Wi ... ted-plugin from the beginning of this post.
User avatar
waltervl
Posts: 5846
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python plugin: WiZ Connected

Post by waltervl »

Something is wrong with the installation of that Python Scapy module. The user that is running domoticz cannot find the module.
Can you try to install without sudo (will probably not work)?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
renevandenbroek
Posts: 12
Joined: Sunday 05 June 2016 21:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: WiZ Connected

Post by renevandenbroek »

This what I run

Version: 2021.1 (build 13639)
Build Hash: d20f51ba2
Compile Date: 2021-09-29 07:58:52
dzVents Version: 3.1.8
Python Version: 3.7.3 (default, Dec 20 2019, 18:57:59) [GCC 8.3.0]

on
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
renevandenbroek
Posts: 12
Joined: Sunday 05 June 2016 21:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: WiZ Connected

Post by renevandenbroek »

@watervl I cannot install it : insufficient rights only with sudo it installs

pi@raspberrypi:~/domoticz/plugins $ apt-get install python-scapy
E: Kon het vergrendelingsbestand /var/lib/dpkg/lock-frontend niet openen - open (13: Toegang geweigerd)
E: Kan de vergrendeling voor het dpkg-frontend (/var/lib/dpkg/lock-frontend) niet verkrijgen. Heeft u beheerdersrechten?
User avatar
waltervl
Posts: 5846
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python plugin: WiZ Connected

Post by waltervl »

I do not know if it works but you could also try to install scapy with pip3 (with or without sudo)

Code: Select all

sudo pip3 install python-scapy
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
renevandenbroek
Posts: 12
Joined: Sunday 05 June 2016 21:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: WiZ Connected

Post by renevandenbroek »

Thanks for your response but is does work work out


sudo pip3 install python-scapy
Collecting python-scapy
Could not install packages due to an EnvironmentError: 404 Client Error: Not Fou nd for url: https://pypi.org/simple/python-scapy/

pi@raspberrypi:~ $ pip3 install python-scapy
Collecting python-scapy
Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple/python-scapy/
renevandenbroek
Posts: 12
Joined: Sunday 05 June 2016 21:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: WiZ Connected

Post by renevandenbroek »

I also tried
pip install --pre scapy[basic]

and
git clone https://github.com/secdev/scapy.git

They install scapy but the errors stay the same
User avatar
waltervl
Posts: 5846
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python plugin: WiZ Connected

Post by waltervl »

I think you better create a Github issue in https://github.com/sydspost/Domoticz-Wi ... ted-plugin

Perhaps the plugin creator will react there as here on the forum he is not reacting. Or alternative you could try to send him a forum Private message.

I am out of options.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
renevandenbroek
Posts: 12
Joined: Sunday 05 June 2016 21:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: WiZ Connected

Post by renevandenbroek »

Thanks, I will try to do that via github.
renevandenbroek
Posts: 12
Joined: Sunday 05 June 2016 21:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: WiZ Connected

Post by renevandenbroek »

On Github I got the suggestion to try sudo apt-get install python3-scapy'
That did the job for me although I had to install it a couple of time even with --fix-missing
renevandenbroek
Posts: 12
Joined: Sunday 05 June 2016 21:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: WiZ Connected

Post by renevandenbroek »

I use a dimmable color lamp. The plugin supports BW dimmable. Is there a way to update the plugin so that it works for color lamps as well?
Menno
Posts: 35
Joined: Wednesday 24 July 2019 13:23
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: WiZ Connected

Post by Menno »

renevandenbroek wrote: Wednesday 24 November 2021 23:33 On Github I got the suggestion to try sudo apt-get install python3-scapy'
That did the job for me although I had to install it a couple of time even with --fix-missing
I noticed this will try to pull in an enormous amount of dependencies:

sudo apt install python3-scapy
Building dependency tree
0 upgraded, 194 newly installed, 0 to remove and 0 not upgraded.
Need to get 108 MB of archives.
After this operation, 866 MB of additional disk space will be used.

Do I really need packages like fontconfig, ffmpeg, libcups2, x11-utils, x11-server-utils and x11-common to operate a light?
(OK, maybe not a Domoticz question, more of a Raspbian question but if the plugin could somehow incorporate scapy this issue would be resolved)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest