Controlling WLED - json modifiyng

hi, I'm trying to control a WLED instance and am currently encountering a small problem.

I take the actual state of the LED strip and store it. After a different shema (short blinking), it should be returned to the stored one. This works fine so far. But when I use a WLED preset, switching back ignores the state (on/off).

if (msg.topic==="recall") {
    msg.payload = context.get("laststate");
    return msg;
} else {
    context.set("laststate",msg.payload);
}

I think the preset information "ps":1 just needs to be deleted from string and then the power state (on: true/false) is valid again.

{"on":true,"bri":24,"transition":3,"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":227,"len":227,"grp":1,"spc":0,"of":0,"on":true,"frz":false,"bri":255,"cct":127,"col":[[255,160,0],[0,0,0],[0,0,0]],"fx":104,"sx":0,"ix":65,"pal":44,"sel":true,"rev":false,"mi":false}]}

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.