# Storing a variable persistently

**URL:** <https://community.particle.io/t/storing-a-variable-persistently/16866>\
**Category:** Cloud\
**Created:** [October 25, 2015, 4:00pm UTC](https://community.particle.io/t/storing-a-variable-persistently/16866 "2015-10-25T16:00:07Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![matteo\_monti](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@matteo\_monti](https://community.particle.io/u/matteo_monti)\
**Post date:** [October 25, 2015, 4:00pm UTC](https://community.particle.io/t/storing-a-variable-persistently/16866/1 "2015-10-25T16:00:07Z")

</div>

As far as my understanding goes, I can use the cloud interface to expose a variable so that I can read it from the internet. However, what I would like to do is to set a variable via the internet so that it stays set even if I reboot my Particle. As an example, say that I want an integer setting to be used by my Particle. I would like to set it via the cloud interface, and I would like it to stay set: whenever I turn off my Particle, when it is turned back on I would like it to fetch the value again from the cloud, and use it.

Is it possible to do something like this?

Thanks

---

<div class="post-metadata">

**Author:** ![BulldogLowell](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bulldoglowell/32/4305_2.png) [@BulldogLowell](https://community.particle.io/u/BulldogLowell)\
**Post date:** [October 25, 2015, 4:10pm UTC](https://community.particle.io/t/storing-a-variable-persistently/16866/2 "2015-10-25T16:10:38Z")

</div>

If you are asking “can I store data (like a variable) into the Particle Cloud?” I believe the answer is “No”.

If you are asking “can I retrieve some data from a server (where I store my value) each time I start up my Particle?” the answer would be “yes”.

Are you looking to retrieve a stored value from a server?

---

<div class="post-metadata">

**Author:** ![matteo\_monti](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@matteo\_monti](https://community.particle.io/u/matteo_monti)\
**Post date:** [October 25, 2015, 4:13pm UTC](https://community.particle.io/t/storing-a-variable-persistently/16866/3 "2015-10-25T16:13:10Z")

</div>

Well. I was hoping to store the value on the cloud, but I guess I can store it on a server and then retrieve it when I start up the Particle.

Can I do such a thing?

---

<div class="post-metadata">

**Author:** ![matteo\_monti](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@matteo\_monti](https://community.particle.io/u/matteo_monti)\
**Post date:** [October 25, 2015, 4:13pm UTC](https://community.particle.io/t/storing-a-variable-persistently/16866/4 "2015-10-25T16:13:43Z")

</div>

Is there something like an urlopen equivalent for Particle?

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [October 25, 2015, 4:15pm UTC](https://community.particle.io/t/storing-a-variable-persistently/16866/5 "2015-10-25T16:15:29Z")

</div>

What about this: [https://docs.particle.io/reference/firmware/photon/#eeprom](https://docs.particle.io/reference/firmware/photon/#eeprom) ?

---

<div class="post-metadata">

**Author:** ![matteo\_monti](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@matteo\_monti](https://community.particle.io/u/matteo_monti)\
**Post date:** [October 25, 2015, 4:18pm UTC](https://community.particle.io/t/storing-a-variable-persistently/16866/6 "2015-10-25T16:18:41Z")

</div>

I thought about this, but how can I set the value via the internet?

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [October 25, 2015, 4:21pm UTC](https://community.particle.io/t/storing-a-variable-persistently/16866/7 "2015-10-25T16:21:13Z")

</div>

Use a Particle.function(), pass it as an argument, then store that?

---

<div class="post-metadata">

**Author:** ![mdma](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/mdma/32/1924_2.png) [@mdma](https://community.particle.io/u/mdma)\
**Post date:** [October 25, 2015, 7:48pm UTC](https://community.particle.io/t/storing-a-variable-persistently/16866/8 "2015-10-25T19:48:39Z")

</div>

There’s no way to do this at present - once a device is powered off, then the variables are not available. However, this is on our roadmap!

---

<div class="post-metadata">

**Author:** ![dustpuppy](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dustpuppy/32/7406_2.png) [@dustpuppy](https://community.particle.io/u/dustpuppy)\
**Post date:** [October 26, 2015, 1:40am UTC](https://community.particle.io/t/storing-a-variable-persistently/16866/9 "2015-10-26T01:40:41Z")

</div>

@mdma have you given some thought to pairing up with other cloud PaaS such as Pubnub, Firebase ?

Pubnub: flexible and simple messaging to and from photon. Mobile push notifications from the photon.

Firebase: persist data even when photon is powered off. At startup, the photon reads from the dB and refreshes its RAM.

Your cloud variable concept is a little bit like a 2 way binding between Firebase and a Web page.

---

<div class="post-metadata">

**Author:** ![Polder](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/polder/32/24631_2.png) [@Polder](https://community.particle.io/u/Polder)\
**Post date:** [September 25, 2017, 10:18am UTC](https://community.particle.io/t/storing-a-variable-persistently/16866/10 "2017-09-25T10:18:25Z")

</div>

This is something I am really looking out for.  
I have a product that has variables that need to be set remotely by the customer. Currently I use the suggestion Moors7 made a few posts up with Particle.Function().

However it would be much better if the values are stored in a database on my dashboard that get called on by the particle during startup using an ID (particle ID or one stored in EEPROM) to get a string of variables that can be processed and put into the different variables.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [September 25, 2017, 10:39am UTC](https://community.particle.io/t/storing-a-variable-persistently/16866/11 "2017-09-25T10:39:34Z")

</div>

> [@Polder](#):
>
> However it would be much better if the values are stored in a database on my dashboard that get called on by the particle during startup using an ID (particle ID or one stored in EEPROM) to get a string of variables that can be processed and put into the different variables.

Then you might want to use webhooks (or direct pub/sub)
