# Context to file creating temp files

**URL:** https://discourse.nodered.org/t/context-to-file-creating-temp-files/61760
**Category:** General
**Created:** [25 April 2022 17:25 UTC](https://discourse.nodered.org/t/context-to-file-creating-temp-files/61760 "2022-04-25T17:25:49Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![gschmidt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gschmidt/32/60349_2.png) [@gschmidt](https://discourse.nodered.org/u/gschmidt)
#### Post date: [25 April 2022 17:25 UTC](https://discourse.nodered.org/t/context-to-file-creating-temp-files/61760/1 "2022-04-25T17:25:49Z")

</div>

Hi,

I have created a flow which has 24 context variables saved to file.  
When I browse to the context directory of that flow (Raspberry Pi with Raspbian Buster), I notice that every minute a tmp file is created.

`/home/pi/.node-red/context/8b2862b307a292bb`

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/9/c9fd0edd0533c5acd80a1a08246529d29e622494.png)

What is causing that?

I have injectors in the flow that restore the context values to the dash board objects after restart node-red or reset the raspberry, but repeat is set to "none" the only inject once after 0.1s

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [25 April 2022 17:37 UTC](https://discourse.nodered.org/t/context-to-file-creating-temp-files/61760/2 "2022-04-25T17:37:59Z")

</div>

How are you saving the context variables to file? Using a file node? Using a contrib node? Using file backed store set in settings.js?

---

<div class="post-metadata">

### Author: ![gschmidt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gschmidt/32/60349_2.png) [@gschmidt](https://discourse.nodered.org/u/gschmidt)
#### Post date: [25 April 2022 19:58 UTC](https://discourse.nodered.org/t/context-to-file-creating-temp-files/61760/3 "2022-04-25T19:58:06Z")

</div>

My settings.js is like this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/f/af1a87fe45b53689c98ae8077c5fd3e037d0c3c8.jpeg)

I save context variables to file with:

- 17 change nodes
- 7 function nodes e.g. `flow.set("ct_mon_G", time1, "file");`

I load context variables from file to:

- 17 dashboard nodes with 17 injection nodes
- 14 function nodes e.g. `flow.get("mon_time_G", "file");`
- crontab pro node

And I use one "node-red-contrib-moment" node to show the current time on the dashboard.  
I see in the context directory that this node also creates every minute a tmp file

I can't post the flow because of to much characters , but here is a link:

> **[Node-Red Dashboard Flow - Pastebin.com](https://pastebin.com/tDRfurUb)**
>
> Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

The google home alarm clock flows are made for 2 mobile android phones. When I save a shortcut of this page in google chrome to the mobiles home screen, the dashboard always shows the first tab and automaticaly fills the nodes. But when I switch to the other tab, the nodes are not automatically filled.

So I created a flow, using the **ui\_control** node, which triggeres the nodes again when switching to the other tab.

```auto
[{"id":"5ea0c06fa7709de5","type":"ui_ui_control","z":"e2b6b5f54a987f70","name":"","events":"all","x":100,"y":80,"wires":[["7d9c29f0419c67fe"]]},{"id":"7d9c29f0419c67fe","type":"switch","z":"e2b6b5f54a987f70","name":"","property":"name","propertyType":"msg","rules":[{"t":"eq","v":"Wekker Gerben","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":250,"y":80,"wires":[["a7e09627253fb76a"]]},{"id":"a7e09627253fb76a","type":"change","z":"e2b6b5f54a987f70","name":"Refresh Browser","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"tab\":\"\"}","tot":"json"},{"t":"delete","p":"socketid","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":80,"wires":[["de960b742c49b829"]]},{"id":"de960b742c49b829","type":"trigger","z":"e2b6b5f54a987f70","name":"","op1":"","op2":"","op1type":"pay","op2type":"nul","duration":"5","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":640,"y":80,"wires":[["12d1e9659b28dc8c"]]},{"id":"12d1e9659b28dc8c","type":"ui_ui_control","z":"e2b6b5f54a987f70","name":"","events":"all","x":800,"y":80,"wires":[[]]}]

```

---

<div class="post-metadata">

### Author: ![gschmidt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gschmidt/32/60349_2.png) [@gschmidt](https://discourse.nodered.org/u/gschmidt)
#### Post date: [25 April 2022 21:25 UTC](https://discourse.nodered.org/t/context-to-file-creating-temp-files/61760/4 "2022-04-25T21:25:37Z")

</div>

I figured it out, it was a domoticz mqtt node causing a loop trying to sync the dashboard ON/OFF button with a switch in Domoticz. I used it to turn off the ON/OFF switch with google home voice

---

<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: [9 May 2022 21:26 UTC](https://discourse.nodered.org/t/context-to-file-creating-temp-files/61760/5 "2022-05-09T21:26:18Z")

</div>

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