Wled Binding: Sitemap selection delayed

I’ve added “Selection” elements in my sitemap for Wled playlists, presets, effects and palettes. The selection values are autmatically pulled from my wled controller.

The only annoying issue with the selections is that when I e.g select a different effect in the selection list the selected value stays on the old value. If I again select yet another effect it now displays the previously selected effect. Only if I select the same effect twice it displays the correct active effect. Also when the device is polled (e.g. every 60 seconds) the correct value is displayed.

  • The same thing happens when selecting presets.
  • When selecting playlists the value always shows -1, the selected value is never displayed.
  • The only selection that show’s up correctly after selecting is the palette selection.

Is there a reason for this behaviour of could this be fixed?

What browser are you using to run Basic UI?
It is certainly not a general issue but rather something specific to your item or binding channel. What is the binding channel involved?

In you logs, I assume you see a command sent to your item. But do you see an update of the item state just after ?

And if you see an item state update in you logs, does the value match one of your defined options?

I’m using Chrome, but it is the same in Firefox and also in the Android app. I also suspect this to be an issue related to the wled binding and not a general issue.

Here is how I configured the the effect item:

String ST_WLED_Kitchen_S0_Effect "Effect [%s]" {channel="wled:segment:54c24ab629:54c24ab629-0:fx"}

And this is how the selection entry is configured in the sitemap:

Selection item=ST_WLED_Kitchen_S0_Effect label="Effect"

I monitored the item changes using postman via the /rest/events api. If I select a different effect in Basic UI I get the following item updates:


In this case I selected the item with the id 26. The item is updated to 26, but shorty after it is set back to the previous value. (in this case 1)

Any idea what could be the problem? I will also try to test this in a development environment, but at the moment something is broken with the eclipse development.

So this is not a problem of Basic UI.
The problem is why the wled binding is restoring the old state ?
I assume you have no rule changing the item state?

Enabling wled binding TRACE logs could maybe provide interesting information for binding maintainer.
You could then create a GitHub issue related to wled binding providing maximum of information for the binding developer.

I have no rules that modify this item.

The log also does not help. The only entry I found regarding the effect is this line:

Sending WLED POST:/json/state Message:{"seg":[{"id":0,"fx":186}]}

I hope I can get my development environment running again. Then I can trace this directly in the code of the binding.

I suggest you create an issue for wled binding in GitHub with all these information.

I got my development environment working again and this is what I found out:

Preset and Playlist:

Segment Effect:

  • Current situation: The binding first calls the function setGlobalOn which turns on the lights. This command also receives all the current values back from the wled controller. The values are then reflected to the item’s in openhab. After that the setEffect function is called which sends the effect to the wled controller, but here no values are received from the controller so the item is not updated to the new effect.
  • Suggestion: Send the ON command and the requested effect in a single json message to the wled controller and then process the new values from the controller. I’ve tested this on the latest WLED release 0.15.0 and it worked perfectly. I’ve uploaded a code example on my GitHub fork here: Fix when changing effect · TheNetStriker/openhab-addons@6885ea6 · GitHub

I also just created an issue for this in the OpenHab GitHub repository: [wled] Selecting preset, playlist or segment effect in the UI reverts back to previous value · Issue #17964 · openhab/openhab-addons · GitHub