# Retaining variables after power failure

**URL:** <https://discourse.nodered.org/t/retaining-variables-after-power-failure/76711>\
**Category:** General\
**Created:** [19 March 2023 12:16 UTC](https://discourse.nodered.org/t/retaining-variables-after-power-failure/76711 "2023-03-19T12:16:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![damica51](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@damica51](https://discourse.nodered.org/u/damica51)\
**Post date:** [19 March 2023 12:16 UTC](https://discourse.nodered.org/t/retaining-variables-after-power-failure/76711/1 "2023-03-19T12:16:36Z")

</div>

I have not seen any method to retain a variable (Such as setpoint) if there is a power cycle.  
Am I missing something?

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [19 March 2023 12:22 UTC](https://discourse.nodered.org/t/retaining-variables-after-power-failure/76711/2 "2023-03-19T12:22:17Z")

</div>

Hi,  
Have you ever read [ContextStorage](https://nodered.org/docs/user-guide/context)?

---

<div class="post-metadata">

**Author:** ![damica51](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@damica51](https://discourse.nodered.org/u/damica51)\
**Post date:** [19 March 2023 12:37 UTC](https://discourse.nodered.org/t/retaining-variables-after-power-failure/76711/3 "2023-03-19T12:37:03Z")

</div>

Thanks I will take a detailed look at, after doing some reading it does indeed sound like it sound work.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 March 2023 13:32 UTC](https://discourse.nodered.org/t/retaining-variables-after-power-failure/76711/4 "2023-03-19T13:32:06Z")

</div>

Also consider using retained topics in mqtt.

If you want to learn more about MQTT then see this tutorial [MQTT Essentials - All Core Concepts explained](https://www.hivemq.com/mqtt-essentials/)

---

<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:** [2 April 2023 13:33 UTC](https://discourse.nodered.org/t/retaining-variables-after-power-failure/76711/5 "2023-04-02T13:33:00Z")

</div>

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