DrozmotiX/ioBroker.wled

WLED adapter stopped working with Javascript/Blockly engine

zeromancer1972 opened this issue · 15 comments

Describe the bug
All my scripts (blockly) stopped working properly, I cannot control WLED's "ps" or "on" properties repliably.
I can manually in the objects, but not script-controlled.
They used to work before and stopped a few days ago. Not sure if JS adapter is to blame or this plugin.

To reproduce: create a simple script that just controls the "ps" property - nothing will happen.
To be clear: sometimes it works, but in 80% of switch events it does not.

I just created a script that sets "ps" to a "on" preset when I click a button and to a "ps" that switched the WLED off. Debugger shows the button state perfectly but WLED does not react to that accordingly. Is there a certain amount of "waiting" time between switch events I have to obey?

Versions:

  • Adapter version: v0.6.7
  • JS-Controller version: v6.0.0
  • Node version: v16.14.0
  • Operating system: Linux Ubuntu

Additional context
Add any other context about the problem here.

Show your script please. Please also show a debug level log of the adapter. If the adapter was noch updated tehen what should cause something to not work from one day to the other

This is the little test script

on({id: "zigbee.0.5c0272fffe58f743.state"/*Switch event*/, change: "any"}, async function (obj) {
  var value = obj.state.val;
  var oldValue = obj.oldState.val;
  if (getState("zigbee.0.5c0272fffe58f743.state").val) {
    console.log('ON');
    setState("wled.0.2c3ae845304c.ps"/*ID of currently set preset*/, 80);
  } else {
    console.log('OFF');
    setState("wled.0.2c3ae845304c.ps"/*ID of currently set preset*/, 100);
  }
});

The logs show nothing except my own console messages.

why you use getState of the same state as the trigger? This can have side effects ... always use the "value" variable! (no idea if this is the issue, but could be f getState gets an old version... which javascript adapgter version i used?)

Adapter is v6.0.0 and I have no issues since I get the correct log messages. If-else is working properly, but the setState for WLED does not.

Ok, then ...but still strange that it stopped working without any update ... tried restarting host/iobroker?

I tried the usual stuff already. Rebooting, restarting, restarting the adapter, restarting the ESP. I found a workaround now using the HTTP API of WLED directly with NodeRed

maybe was there a wled firmware update or such?

WLED firmware update was done moths ago, it stopped working 2 days ago

Tried to poer off(on the devices? Sorry for asking such dump questions but why an adapter should stop wirking when nothing was changed?

Tried everything. I have no explanation for it.

I just found out that using scenes still works, so it's currently "only" Javascript/Blockly that is not working

Which makes it ebvene more intersesting ... So via Admin also works? maybe turned on simulation mode of the script in javaScript or such?

Never seen "simulation mode" so I don't think I accidentally enabled that. Setting the ps property via the object/datapoint works, too

I think this should be further analyses or researched at the JavaScript adapter, as you are able to control wled by the states in admin the adapter is working question is way your script is not working anymore.

That can have several reasons, like another script causing the JavaScript adapter to crash

Wled firmware and adapter looks fine, otherwise you could not control it al all

as we have no follow up here an I still think its related to javascript engine, I will close for now :)