# Huemagic : store previous item state

**URL:** <https://discourse.nodered.org/t/huemagic-store-previous-item-state/2449>\
**Category:** General\
**Created:** [21 August 2018 17:03 UTC](https://discourse.nodered.org/t/huemagic-store-previous-item-state/2449 "2018-08-21T17:03:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![codegrau](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/codegrau/32/1928_2.png) [@codegrau](https://discourse.nodered.org/u/codegrau)\
**Post date:** [21 August 2018 17:03 UTC](https://discourse.nodered.org/t/huemagic-store-previous-item-state/2449/1 "2018-08-21T17:03:02Z")

</div>

Hi there,  
Help with huemagic (control Philips Hue with Node RED) very appreciated:

> **[node-red-contrib-huemagic](https://flows.nodered.org/node/node-red-contrib-huemagic)**
>
> Philips Hue node to control lights, groups, scenes, taps, switches, motion sensors, temperature sensors and Lux sensors using Node-RED.

There is an "alert" feature aka Special Alert Effect for groups:

Plays an alert effect based on the passed in **msg.payload** values of:

**alert** - int _(required)_ -Configurable amount of seconds to play the alert effect (max 30). When the alert effect is finished you have to manually reset the lights to their previous state.

How would I do that? How would I get and store the "previous state" to set the lights back after the alert stops?

As soon as I start the alert, the output of the huemagic light node would alter, so that I can't use this msg for reset.

Looking forward to your help. Thank you!

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [21 August 2018 17:05 UTC](https://discourse.nodered.org/t/huemagic-store-previous-item-state/2449/2 "2018-08-21T17:05:16Z")

</div>

Have a look here:

[https://nodered.org/docs/user-guide/context](https://nodered.org/docs/user-guide/context)

Garry

---

<div class="post-metadata">

**Author:** ![codegrau](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/codegrau/32/1928_2.png) [@codegrau](https://discourse.nodered.org/u/codegrau)\
**Post date:** [21 August 2018 17:11 UTC](https://discourse.nodered.org/t/huemagic-store-previous-item-state/2449/3 "2018-08-21T17:11:21Z")

</div>

Hey ghayne,

Yeah, but this would (also) store the output triggered by the alert (because the light node would output the changed object for alert mode)

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [21 August 2018 17:13 UTC](https://discourse.nodered.org/t/huemagic-store-previous-item-state/2449/4 "2018-08-21T17:13:53Z")

</div>

You'll need some clever programming then 🙂  
Can you post a flow?
