WLed: A binding for controlling LED strips and strings from an opensource esp8266 project

There are some Effects that are narrow. If you can Group 2 or 3 Pixels the effect gets wider.
I just looked in the API Documentation before requesting features that aren’t supported by the API and saw it. So I just thought it could be useful.

And thank you for the fast coding. I think I can get time to test the Segment features in the next Week.

Done, the binding in the marketplace now has the grouping, spacing, playlists and Live Override channels added. @SpaceGlider was wanting the LOR command.

2 Likes

Awesome, thank you!

Has anyone tried the newer binding from the marketplace yet? The changes have now been merged so they will be in next months 3.2 Stable release, so it would be great to get some/any feedback.

Hi @matt1, i have had a quick play with the new binding, but faced a couple of issues (could be through my own doing). Note i am running beta version 0.13.0-b5.

I don’t currently use segments so only have segment 0. Previously i had a switch, dimmer and color linked to the MasterControls and these controlled the global On/Off, brightness and color.

However after trying new binding, Mastercontrols is now linked to the segment specified in the Thing configuration. As a result controlling the On/Off at the segment level requires the Global On/Off to be turned on and left on. Similarly with the brightness, 100% at segment level will only be the % value set at global.

I did notice in the code that there is a reference to setGlobalOn and setGlobalBrightness. Would it be possible to have channels for these? Or is it easier to leave WLED set as On and 100% brightness at the Global level?

Just leave the global on and brightness at full.

Going forward I am considering making a big change to using a bridge and thing. The bridge gets the global controls and then each sub thing is how the binding is now. For people that use segments this will mean performance gains as the bridge will parse only once for all segments.

It should be possible to leave a direct thing in place and not cause breaking changes when this is done so you don’t have to move to the bridge design unless you want the global control.

Those future planned changes I did not want to make before a stable release and wanted to think it over before diving in. I still don’t see another way that makes sense for reducing the load when someone has a lot of segments.

Updated to the latest snapshot and got it working fine now. Only thing i have noticed is that it updates the brightness of the MasterControl Color Item to that in the json and then changes it back to zero as the segment is off (not an issue though).

Future plans sound good! Thank you!

Great, thanks for reporting that it is working without issues.

I consider each segment to be a new light. So 1 led strip can be split up to create multiple “light globes”, aka segments. The maserControls are the controls for a single light aka segment and will model how a normal light is normally handled and responds in openHAB. The future global controls will globally control the whole strip. Another way to globally change all segments is to use the normal openHAB group items as you would if you want to change multiple light globes as one from other bindings.

The brightness changing is important as the semantic model will display a list/count of ‘ON’ lights and also the icons will change to reflect the state of the light output. When a light is OFF, it should be black and any slider icons should go from yellow to gray. Any count of lights turned on should go back down by 1 when the light is turned off. This is the difference between the “primaryColor” channel and the “masterControls” channels.

You can choose to use it with only the primary colour linked to items if you wish, as there is a “segmentBrightness” channel that can be used to change brightness and turn the segment on and off. The choice to set it up in two very different ways can be made, however the masterControls IMHO makes your life much easier, especially if you link it to alexa/google and ask it to change the light to X colour when the light is running FX.

One thing I recommend that you try is to link up the new segmentBrightness channel to BOTH a Switch item and also a Dimmer item, or just a Dimmer if you prefer one less switch. These currently allow you to change the brightness without the HSB color changing if this is what you prefer. It sounds like this is what you were expecting and prefer? Tick the show advanced box to see this and other channels.

The other thing I will mention is that its possible to use openHABs ability to create your own Global controls by creating an item and setting it up to send either MQTT or the HTTP messages directly and not through the binding. There is a whole thread on how to setup openHAB and wled without the binding using MQTT, but it could easily be done without mqtt and by sending the older http API directly or the json api directly. The semantic model allow you to create equipment from multiple bindings and methods and display it as a single piece of equipment, so this is a real world example of how openHAB is flexible and why the equipment concept was introduced.

V0.13.x has only just introduced named segments into the firmware, so the goal for the next lot of changes would be to add auto discovery of multiple segments with auto naming ability and to add the global controls with a bridge/thing setup. So if you or anyone else is setting up segments, don’t forget to name them with the V0.13 firmware when creating your presets and playlists as this will make future upgrades smoother.

@matt1
I am using the “old” items and channels and I get constantly the same itemChangeevents even if the leds did not change:

2021-12-14 21:14:39.431 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControlsPower’ changed from ON to OFF

2021-12-14 21:14:49.458 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControls’ changed from 37,100,0 to 37,100,100

2021-12-14 21:14:49.458 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControlsPower’ changed from OFF to ON

2021-12-14 21:14:49.459 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControls’ changed from 37,100,100 to 37,100,0

2021-12-14 21:14:49.460 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControlsPower’ changed from ON to OFF

2021-12-14 21:14:59.509 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControls’ changed from 37,100,0 to 37,100,100

2021-12-14 21:14:59.510 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControlsPower’ changed from OFF to ON

2021-12-14 21:14:59.510 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControls’ changed from 37,100,100 to 37,100,0

2021-12-14 21:14:59.510 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControlsPower’ changed from ON to OFF

2021-12-14 21:15:09.531 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControls’ changed from 37,100,0 to 37,100,100

2021-12-14 21:15:09.535 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControlsPower’ changed from OFF to ON

2021-12-14 21:15:09.535 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControls’ changed from 37,100,100 to 37,100,0

2021-12-14 21:15:09.535 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControlsPower’ changed from ON to OFF

2021-12-14 21:15:19.550 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControls’ changed from 37,100,0 to 37,100,100

2021-12-14 21:15:19.551 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControlsPower’ changed from OFF to ON

2021-12-14 21:15:19.551 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControls’ changed from 37,100,100 to 37,100,0

2021-12-14 21:15:19.551 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControlsPower’ changed from ON to OFF

2021-12-14 21:15:29.585 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControls’ changed from 37,100,0 to 37,100,100

2021-12-14 21:15:29.585 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControlsPower’ changed from OFF to ON

2021-12-14 21:15:29.586 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControls’ changed from 37,100,100 to 37,100,0

2021-12-14 21:15:29.586 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDMasterControlsPower’ changed from ON to OFF

Do you have an idea why this is happening?

I had this also in an older wled version (0.12.???) and updated today to WLED version 0.13.0-b6
But the issue is still the same.

openHAB 3.2.0.M5

Have no idea but it would help with TRACE logs instead of info to fault find.

Before doing that I suggest you try two things first.

  1. Delete and readd the things. New channels were added and this can cause weird stuff to occur until the delete and re add dance is done. Items can stay created, it is just the thing.

  2. For on and off control try using the new segment brightness channel instead of the channels your using. It uses different code so it may break a feedback loop.

Keen to see the trace log to narrow it down, just try step one above first.

@matt1
So I removed the things and items (I am working with things and items files) and readded them. I also renamed the items, to be sure that there is no rule changing the value.

But the issue occured.
I also added a new WLED strip. There this issue is not occuring.
Now I get the following:

2021-12-15 07:50:49.819 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDLenaMasterControls’ changed from 37,100,0 to 37,100,100

2021-12-15 07:50:49.820 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDLenaMasterControls’ changed from 37,100,100 to 37,100,0

2021-12-15 07:50:59.851 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDLenaMasterControls’ changed from 37,100,0 to 37,100,100

2021-12-15 07:50:59.853 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDLenaMasterControls’ changed from 37,100,100 to 37,100,0

2021-12-15 07:51:09.851 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDLenaMasterControls’ changed from 37,100,0 to 37,100,100

2021-12-15 07:51:09.853 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDLenaMasterControls’ changed from 37,100,100 to 37,100,0

I changed the log value for wled to TRACE and this is the log output:

2021-12-15 07:57:40.859 [TRACE] [nding.wled.internal.api.WledApiV0130] - Sending WLED GET:/json/state

2021-12-15 07:57:40.898 [TRACE] [nding.wled.internal.api.WledApiV0130] - json/state:{“on”:false,“bri”:128,“transition”:7,“ps”:-1,“pl”:-1,“nl”:{“on”:false,“dur”:60,“mode”:1,“tbri”:0,“rem”:-1},“udpn”:{“send”:false,“recv”:true},“lor”:0,“mainseg”:0,“seg”:[{“id”:0,“start”:0,“stop”:300,“len”:300,“grp”:1,“spc”:0,“of”:0,“on”:false,“bri”:255,“cct”:127,“col”:[[255,160,0],[0,0,0],[0,0,0]],“fx”:0,“sx”:128,“ix”:128,“pal”:0,“sel”:true,“rev”:false,“mi”:false}]}

==> /var/log/openhab/events.log <==

2021-12-15 07:57:40.900 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDLenaMasterControls’ changed from 37,100,0 to 37,100,100

2021-12-15 07:57:40.901 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WLEDLenaMasterControls’ changed from 37,100,100 to 37,100,0

So it looks like just one json response but it is setting the last value in WLEDLenaMasterControls to 100 and then directly in 1 ms to 0 back again

Reproduced, fixed, tested and made PR here. This was only happening when the segment was turned off. Thanks for reporting it.

[wled] Fix two events being logged when light is off. by Skinah · Pull Request #11786 · openhab/openhab-addons (github.com)

1 Like

do you know if it will be in the milestone release in 4 days?

Yes, it will be in the release candidates for the 3.2 Stable which should be out in a few days time. If you want to be notified, just subscribe to the forums announcement section (hit the bell icon in the link below) where Kai gave an update last week.

Latest Announcements topics - openHAB Community

@matt1
Which channel is used as a switch Item for power?
In OpenHAB I am able to use the segmentBrightness or the mastercontrols .
But both don’t seem to be synced with the devices power.
When I change the power in the WLED UI or in the WLED app the openhab switch is not toggled.
As well as I change the Power in openhab to OFF and then i am not able to toggle the power in the UI or app. It is shown as ON but the LEDs are still dark.

Please read my post here and the one just above that one on Global controls.
WLed: A binding for controlling LED strips and strings from an opensource esp8266 project - Add-ons / Bindings - openHAB Community

There is a partial fix (just doing another bug fix now) in the latest RC1 build just released if your using milestones do an update, or wait a few days for the newer 3.2 stable to be released. If you use the SLEEP nightmode timer feature it will change the global OFF and this fixes that but only for the masterControls channel which is the one you should use the most and also use this one for Google/Alexa controlling.

@eric1905 I just updated the marketplace jar to fix all known issues and a PR with the extra bug fix has been made and is waiting for review.

Hopefully this picture helps…

Ok I got it. Thank you for your explanation.

ops …just updated to 3.2 without seeing the power sync problem…all other modes are syncing fine,color,effects,etc.Is there a fixed jar or i ll wait for a stable 3.2 fixed update?

A fixed jar is here that will respond to the global on and off states.

http://pcmus.com/openhab/wled/org.openhab.binding.wled-3.2.0-SNAPSHOT.jar
It is already merged and will be in the next milestone and is already in the daily snapshots.

1 Like

Which channel is used for the global on off states? I just used this jar Artifacts of openHAB-Addons #593 : /bundles/org.openhab.binding.wled/target [Jenkins] and I have the feeling there is no real difference