Python Plugin: WLED

Python and python framework

Moderator: leecollings

frustreerMeneer
Posts: 39
Joined: Tuesday 21 March 2017 11:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Python Plugin: WLED

Post by frustreerMeneer »

If anyone interested, I've made a Python plugin for WLED integration into Domoticz.
It's the first version and still quite beta, but it works for me. (It's my first Python project and first GitHUB repository).
Curious to know if it works for you.
My plugin: https://github.com/frustreermeneer/domoticz-wled-plugin
I'm planning to extend it, to make full use of all WLED features.

WLED allows you to control RGB LEDs with an ESP8266/ESP32 over WiFi.
WLED: https://github.com/Aircoookie/WLED
Screenshot WLED in Domoticz
Screenshot WLED in Domoticz
Clipboard01.jpg (72.14 KiB) Viewed 7213 times
Cluedo
Posts: 3
Joined: Sunday 15 January 2017 21:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: WLED

Post by Cluedo »

Hello!

I tried this tonight, i got some problem i cant understand.

Domoticz add the different light, but i got error in Domoticz logs..
Spoiler: show
019-10-15 20:48:55.033 Status: (WLED) Entering work loop.
2019-10-15 20:48:55.033 Status: (WLED) Initialized version 0.0.1, author 'frustreermeneer'
2019-10-15 20:48:55.129 Status: MQTT: Subscribed
2019-10-15 20:48:55.577 Status: (WLED) Entering work loop.
2019-10-15 20:48:55.578 Status: (WLED) Initialized version 0.0.1, author 'frustreermeneer'
2019-10-15 20:48:55.617 Error: Plugin: Connection Exception: 'resolve: Host not found (authoritative)' connecting to 'http://192.168.1.98:80'
2019-10-15 20:48:55.617 Error: Plugin: Connection Exception: 'resolve: Host not found (authoritative)' connecting to 'http://192.168.1.98:80'
2019-10-15 20:48:55.617 Error: (WLED) Transport is not connected, write directive to 'getWLEDStatusConn' ignored.
2019-10-15 20:48:55.617 Error: (WLED) Transport is not connected, write directive to 'getWLEDStatusConn' ignored.
2019-10-15 20:50:44.732 (WLED) Connect directive received, action initiation failed.
2019-10-15 20:50:44.732 Error: Plugin: Connection Exception: 'resolve: Host not found (authoritative)' connecting to 'http://192.168.1.98:80'
2019-10-15 20:50:44.732 Error: (WLED) Transport is not connected, write directive to 'getWLEDStatusConn' ignored.
2019-10-15 20:50:45.183 (WLED) Connect directive received, action initiation failed.
2019-10-15 20:50:45.183 Error: Plugin: Connection Exception: 'resolve: Host not found (authoritative)' connecting to 'http://192.168.1.98:80'
2019-10-15 20:50:45.184 Error: (WLED) Transport is not connected, write directive to 'getWLEDStatusConn' ignored.

It is ESP8266-12F flashed with WLED version 0.8.5

i can connect direcly with webpage. working great!

domoticz
Version: 4.10717
Build Hash: b38b49e5

Linux raspberrypi 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l GNU/Linux


You got any clue what is wrong?
Probably something i don't understand during installation....

thanks in advance

//Cluedo
frustreerMeneer
Posts: 39
Joined: Tuesday 21 March 2017 11:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: WLED

Post by frustreerMeneer »

I think you entered the IP address the wrong way.
Try filling out only 192.168.1.98

It should look like something like this:
settings.jpg
settings.jpg (35.2 KiB) Viewed 7196 times
frustreerMeneer
Posts: 39
Joined: Tuesday 21 March 2017 11:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: WLED

Post by frustreerMeneer »

Update: changes made in WLED app or WLED web interface or now also reflected in Domoticz.
Cluedo
Posts: 3
Joined: Sunday 15 January 2017 21:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: WLED

Post by Cluedo »

frustreerMeneer wrote: Tuesday 15 October 2019 22:15 I think you entered the IP address the wrong way.
Try filling out only 192.168.1.98

It should look like something like this:
settings.jpg

Hello!

Of course i did wrong :)
I put http://192.168.1.98/ should be 192.168.1.98

Its working great know, thanks for your help!

First ledstrip i got to work with Domoticz !

Realy impressive work you have done!

Thanks again !

//Cluedo
vwtune
Posts: 19
Joined: Wednesday 24 January 2018 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Nederland
Contact:

Re: Python Plugin: WLED

Post by vwtune »

Lovely project!

I'm getting the follwing error after installing and restart domoticz and add the WLED hardware:


2019-10-25 16:16:07.126 Error: (WLED) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/wled/:/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-10-25 16:16:07.126 Error: (WLED) Module Import failed, exception: 'ImportError'
2019-10-25 16:16:07.127 Error: (WLED) Module Import failed: ' Name: requests'
2019-10-25 16:16:07.127 Error: (WLED) Error Line details not available.
2019-10-25 16:17:12.289 Error: WLED hardware (22) thread seems to have ended unexpectedly
2019-10-25 16:17:26.295 Error: WLED hardware (22) thread seems to have ended unexpectedly

How can i fix this?
Last edited by vwtune on Friday 25 October 2019 16:29, edited 1 time in total.
frustreerMeneer
Posts: 39
Joined: Tuesday 21 March 2017 11:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: WLED

Post by frustreerMeneer »

It seems to miss the requests module.

Maybe you can try to install it?
sudo apt-get install python-requests

Let me know if that works.
vwtune
Posts: 19
Joined: Wednesday 24 January 2018 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Nederland
Contact:

Re: Python Plugin: WLED

Post by vwtune »

same problem after i did sudo apt-get install python-requests
:cry:
vwtune
Posts: 19
Joined: Wednesday 24 January 2018 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Nederland
Contact:

Re: Python Plugin: WLED

Post by vwtune »

Do you have an other solution maybe? I really want to use your plugin :-)
User avatar
JohnnySK
Posts: 25
Joined: Thursday 28 May 2015 22:14
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Slovakia
Contact:

Re: Python Plugin: WLED

Post by JohnnySK »

vwtune wrote: Friday 25 October 2019 21:12 Do you have an other solution maybe? I really want to use your plugin :-)
Try to install correct version.
Your domoticz use propably python v 3.5
So you need to install package python3-requests
snellejellep
Posts: 241
Joined: Tuesday 16 May 2017 13:05
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Neterlands
Contact:

Re: Python Plugin: WLED

Post by snellejellep »

i made a video installing it, maby it helps some people: https://www.youtube.com/watch?v=umVpBED7hpo
raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
frustreerMeneer
Posts: 39
Joined: Tuesday 21 March 2017 11:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: WLED

Post by frustreerMeneer »

snellejellep wrote: Thursday 14 November 2019 21:04 i made a video installing it, maby it helps some people: https://www.youtube.com/watch?v=umVpBED7hpo
Cool video!
Glad you like my plugin. :D
Ankan
Posts: 48
Joined: Thursday 09 November 2017 20:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: WLED

Post by Ankan »

Hi,

I try to control my WLED with a Nexa 433 Mhz wall switch. I made a Blocky event handler that turn on WLED - Color & Brightness when I press ON and tour off same WLED when I press OFF on my wall switch.

This works but I get this error:

Code: Select all

2019-11-25 22:52:28.240 Error: (CDevice_update) WLED - Color & Brightness: Failed to parse parameters: 'nValue', 'sValue', 'Image', 'SignalLevel', 'BatteryLevel', 'Options', 'TimedOut', 'Name', 'TypeName', 'Type', 'Subtype', 'Switchtype', 'Used', 'Description', 'Color' or 'SuppressTriggers' expected.
2019-11-25 22:52:28.240 Error: (WLED) 'CDevice_update' failed 'TypeError':'argument 15 must be str, not dict'.
When I try to dim the device by use the blocky set dim % it doesn't work at all. Maybe I'am using wrong device. I havent used RGB lights before with Domoticz.

I think your plugin is a great idea. It only need some fixes.

My plan is to use it as a wake up light in the bedroom and use a wall switch to turn it on and off manualy. I know Aircoookie is working on a sunset effect, but else it schouldn't be that hard to implement the logic in Domoticz. But first, I need to be able to control my WLED device with Blocky.

Keep up the good work!
Ankan
Posts: 48
Joined: Thursday 09 November 2017 20:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: WLED

Post by Ankan »

By the way, I'am running Domoticz 4.10717
frustreerMeneer
Posts: 39
Joined: Tuesday 21 March 2017 11:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: WLED

Post by frustreerMeneer »

You are using the right device.
I've only tried a script with Dzvents.
I'll try with blockly.
Can you post what your script looks like?
Ankan
Posts: 48
Joined: Thursday 09 November 2017 20:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: WLED

Post by Ankan »

My blocky script is very simple and it looks like this..

Code: Select all

If Button = On
	Set WLED = On
Else if Button = Off
	Set WLED = Off
From time to time I get two other errors also

Code: Select all

Transport is not connected, write directive to 'getWLEDStatusConn' ignored.
No transport, write directive to 'getWLEDStatusConn' ignored.
The dim problem where a limitations in blocky. You can't check dim level in blocky so I have to do it in Python or something else. The idea is to make the wall switch smart. If you press on it toggle dim level if the strip is already on. Off just switch off the strip.
pablo79
Posts: 2
Joined: Monday 15 October 2018 21:58
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: WLED

Post by pablo79 »

I would like to thank you for the script.

At the beginning I also had errors, but I installed:

sudo apt-get install python3-requests

and now everything works great.

Thanks so much
frustreerMeneer
Posts: 39
Joined: Tuesday 21 March 2017 11:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: WLED

Post by frustreerMeneer »

Ankan wrote: Wednesday 27 November 2019 0:04 My blocky script is very simple and it looks like this..

Code: Select all

If Button = On
	Set WLED = On
Else if Button = Off
	Set WLED = Off
I will try to replicate your script to see if i get the same error and hopefully i can fix it then.
Ankan wrote: Wednesday 27 November 2019 0:04 From time to time I get two other errors also

Code: Select all

Transport is not connected, write directive to 'getWLEDStatusConn' ignored.
No transport, write directive to 'getWLEDStatusConn' ignored.
This indicates that Domoticz could not reach your WLED installation.
frustreerMeneer
Posts: 39
Joined: Tuesday 21 March 2017 11:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: WLED

Post by frustreerMeneer »

pablo79 wrote: Wednesday 27 November 2019 15:09 I would like to thank you for the script.

At the beginning I also had errors, but I installed:

sudo apt-get install python3-requests

and now everything works great.

Thanks so much
Glad you like it ;)
frustreerMeneer
Posts: 39
Joined: Tuesday 21 March 2017 11:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: WLED

Post by frustreerMeneer »

frustreerMeneer wrote: Wednesday 27 November 2019 16:35 I will try to replicate your script to see if i get the same error and hopefully i can fix it then.
I made the following script in blockly and it works. Maybe it's because you used ON/OFF in stead of Set Level?

WLED Blockly Example
WLED Blockly Example
WLED_Blockly_example.jpg (24.59 KiB) Viewed 6811 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest