# Controlling WLED - json modifiyng

**URL:** <https://discourse.nodered.org/t/controlling-wled-json-modifiyng/67016>\
**Category:** General\
**Created:** [27 August 2022 22:12 UTC](https://discourse.nodered.org/t/controlling-wled-json-modifiyng/67016 "2022-08-27T22:12:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![migsun](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/migsun/32/54164_2.png) [@migsun](https://discourse.nodered.org/u/migsun)\
**Post date:** [27 August 2022 22:12 UTC](https://discourse.nodered.org/t/controlling-wled-json-modifiyng/67016/1 "2022-08-27T22:12:38Z")

</div>

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).

```auto
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.

```auto
{"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}]}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 October 2022 22:13 UTC](https://discourse.nodered.org/t/controlling-wled-json-modifiyng/67016/2 "2022-10-26T22:13:29Z")

</div>

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