# Python to Node Red

**URL:** <https://discourse.nodered.org/t/python-to-node-red/60308>\
**Category:** General\
**Created:** [24 March 2022 19:26 UTC](https://discourse.nodered.org/t/python-to-node-red/60308 "2022-03-24T19:26:00Z")\
**Posts on this page:** 5\
**Page:** 2

<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:** [25 March 2022 14:06 UTC](https://discourse.nodered.org/t/python-to-node-red/60308/21 "2022-03-25T14:06:15Z")

</div>

Does the flow you posted actually work? It doesn't suffer from the context problem I warned about, but it shouldn't work at all, as you are not writing the running total back to context.

---

<div class="post-metadata">

**Author:** ![TEdge](https://avatars.discourse-cdn.com/v4/letter/t/8c91f0/32.png) [@TEdge](https://discourse.nodered.org/u/TEdge)\
**Post date:** [25 March 2022 18:32 UTC](https://discourse.nodered.org/t/python-to-node-red/60308/22 "2022-03-25T18:32:49Z")

</div>

The code I posted was missing the context. It was a quick write to post something as I had deleted the original. The code I am running does include it. I have also moved the second write node into the main flow.

---

<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:** [25 March 2022 18:46 UTC](https://discourse.nodered.org/t/python-to-node-red/60308/23 "2022-03-25T18:46:14Z")

</div>

Are you doing the get, update, and set all in one function? You should do that.

---

<div class="post-metadata">

**Author:** ![TEdge](https://avatars.discourse-cdn.com/v4/letter/t/8c91f0/32.png) [@TEdge](https://discourse.nodered.org/u/TEdge)\
**Post date:** [25 March 2022 22:07 UTC](https://discourse.nodered.org/t/python-to-node-red/60308/24 "2022-03-25T22:07:51Z")

</div>

Yes. I originally had a button and separate function to node to use when I refill the tank. I now have 2 buttons to input into the the main function which subtracts 1 for flow out or adds 10 to fill the tank in increments. For fine adjustments the other button subtracts 1. This allows me to partially fill the tank. All set & get are now in one node.

---

<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:** [24 May 2022 22:08 UTC](https://discourse.nodered.org/t/python-to-node-red/60308/25 "2022-05-24T22:08:16Z")

</div>

Closed on 24 May 2022 22:08 UTC

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

[Previous page](https://discourse.nodered.org/t/python-to-node-red/60308.md?page=1)
