# Advice needed on Pi CPU usage

**URL:** https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279
**Category:** General
**Created:** [27 March 2021 12:13 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279 "2021-03-27T12:13:16Z")
**Posts on this page:** 20
**Page:** 6

<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: [11 April 2021 15:31 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/102 "2021-04-11T15:31:46Z")

</div>

Check it with one first, just to make sure it does what you expect.  
Then it just might be worth looking at what is in the flows file for the node you have changed and what was there before. Set flowFilePretty to true in settings.js if it isn't already, restart node-red and force a deploy then open the flows file in an editor and find the new node and one of the old ones. If you are lucky you might be able to do a bit of search and replace to switch them all over. Keep a copy of the flows file obviously. Once you have finished then restart node-red.

---

<div class="post-metadata">

### Author: ![eddee54455](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddee54455/32/43350_2.png) [@eddee54455](https://discourse.nodered.org/u/eddee54455)
#### Post date: [11 April 2021 15:51 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/103 "2021-04-11T15:51:08Z")

</div>

Just had a look.... I'm not clever enough to do a search and replace on this I don't think....

A bit above me... to say the least... I think I'm gonna have to hold on this node swop for a while...

E

---

<div class="post-metadata">

### Author: ![eddee54455](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddee54455/32/43350_2.png) [@eddee54455](https://discourse.nodered.org/u/eddee54455)
#### Post date: [11 April 2021 16:27 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/104 "2021-04-11T16:27:47Z")

</div>

> [@TotallyInformation](#):
>
> First of all, make sure you've checked out Dave's last post and corrected that if it applies. If it does, you can ignore everything else probably.

Went a step further too... Have just finished checking all of the wifi switches that are online to make sure they are individual in client name... All ok, no duplicate client names found....

Ed

---

<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: [11 April 2021 16:32 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/105 "2021-04-11T16:32:47Z")

</div>

To replace the mqtt-json nodes with normal mqtt nodes...

Steps...

- stop node-red
- backup your flows
- open your .node-red/xxxx.flow.json file in a text editor
- search & replace all instances of `"mqtt-json"` with `"mqtt in"` & save.
- uninstall node-red-contrib-mqtt-json
- start node-red

Alternatively

- export all your flows (CTRL+E)
- paste to text editor
  - save as "original.flow.json"

- Delete all flows & deploy
- search & replace all instances of `"mqtt-json"` with `"mqtt in"` in the text editor
- copy all flows to clipboard
- import into node-red (CTRL+I)
- uninstall node-red-contrib-mqtt-json
- restart node-red

* * *

there are slight differences between the JSON of these 2 nodes but nothing that will break anything (i.e. it is enough to search+replace `"mqtt-json"` with `"mqtt in"`)

---

<div class="post-metadata">

### Author: ![eddee54455](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddee54455/32/43350_2.png) [@eddee54455](https://discourse.nodered.org/u/eddee54455)
#### Post date: [11 April 2021 16:39 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/106 "2021-04-11T16:39:00Z")

</div>

Hi Steve,

Thanks for the info, but, a query(of sorts)....

I did a manual insert of the mqtt node alongside a mqtt-json node, copied the relevant criteria across, then put a debug on each node and compared the outputs... There seems to be a bit of a difference between them, whilst they will both operate without errors as the nodes themselves, the downstream nodes have to be "reconfigged" to look at the data in a different way... Or so it seems to me... Might I be wrong?

Regds  
Ed

---

<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: [11 April 2021 16:46 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/107 "2021-04-11T16:46:20Z")

</div>

The differences will mostly not matter (the new MQTT nodes have lots more features, but being missing is not an issue as they will default to default values internally)

The only issue I can see is if in those mqtt-json nodes you have used the `payload` property - you will need to add a change node after the std MQTT node to copy the payload to its intended msg property

Trust me, the effort is worth it. The new MQTT nodes use a much improved version of the MQTT lib and also supports MQTT v5.

---

<div class="post-metadata">

### Author: ![eddee54455](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddee54455/32/43350_2.png) [@eddee54455](https://discourse.nodered.org/u/eddee54455)
#### Post date: [11 April 2021 16:49 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/108 "2021-04-11T16:49:13Z")

</div>

Yep... You hit the nail right on the head!

![screenshot-192.168.0.118_1880-2021.04.11-18_46_38](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/2/220be60fa9c78c025d74f4362278bec2c2240327.png)

And...Of course... In the bulk of them too!!

Regds  
Ed

---

<div class="post-metadata">

### Author: ![eddee54455](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddee54455/32/43350_2.png) [@eddee54455](https://discourse.nodered.org/u/eddee54455)
#### Post date: [11 April 2021 18:43 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/109 "2021-04-11T18:43:05Z")

</div>

Right....

So I have:

1. Gone through and edited all the old mqtt-json nodes and removed the value in the payload field.

2. Put in change node where necessary after it to allow for the payload field I wont be using.

3. Tested the system as it now stands and it seems to be operating as it should.(Still racking up credits in the Skt dept though)...

Now, the million dollar - The "missing field" under "mqtt in" vs what is in the "mqtt-json" node.... Doing a global replace on the flow file, would I need to do a further edit to include this field and set it to "a parsed JSON object", or will it default to that, as such?

Regds  
Ed

---

<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: [11 April 2021 19:58 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/110 "2021-04-11T19:58:04Z")

</div>

> [@eddee54455](#):
>
> Now, the million dollar - The "missing field" under "mqtt in" vs what is in the "mqtt-json" node.... Doing a global replace on the flow file, would I need to do a further edit to include this field and set it to "a parsed JSON object", or will it default to that, as such

Is that what you need. Parsed JSON Payload?

If so, it's easy to add to the JSON when you do the search & replace.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [11 April 2021 20:51 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/111 "2021-04-11T20:51:09Z")

</div>

**DO NOT FORGET LOTS OF BACKUPS OF YOUR FLOW FILE!**

😀

---

<div class="post-metadata">

### Author: ![eddee54455](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddee54455/32/43350_2.png) [@eddee54455](https://discourse.nodered.org/u/eddee54455)
#### Post date: [12 April 2021 11:58 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/112 "2021-04-12T11:58:33Z")

</div>

Thanx, Will check it out...

---

<div class="post-metadata">

### Author: ![eddee54455](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddee54455/32/43350_2.png) [@eddee54455](https://discourse.nodered.org/u/eddee54455)
#### Post date: [12 April 2021 12:00 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/113 "2021-04-12T12:00:23Z")

</div>

Indeedly.... Will download an export of the flow file, work on it locally, then save it as another name, upload it, then swop it in after renaming the original to a backup name....

Cya  
E

---

<div class="post-metadata">

### Author: ![eddee54455](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddee54455/32/43350_2.png) [@eddee54455](https://discourse.nodered.org/u/eddee54455)
#### Post date: [12 April 2021 14:05 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/114 "2021-04-12T14:05:57Z")

</div>

> [@Steve-Mcl](#):
>
> If so, it's easy to add to the JSON when you do the search & replace.

Was a bit above my paygrade.... there were some nodes that were using Text string output and some with json out....

Done it manually... All replaced and mqtt-json has been removed from the palette...

E

---

<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: [12 April 2021 14:18 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/115 "2021-04-12T14:18:47Z")

</div>

I just hope it helps your problem after all this work 🙂

---

<div class="post-metadata">

### Author: ![eddee54455](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddee54455/32/43350_2.png) [@eddee54455](https://discourse.nodered.org/u/eddee54455)
#### Post date: [12 April 2021 14:27 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/116 "2021-04-12T14:27:07Z")

</div>

So far, not looking too good... No major change, but, it is only about 15mins running.... Gone from 420 to 485 or so Skts on graph... Conforms more or less with previous at about 250 Skts increase per hour... Let's see if it flattens out....

E

---

<div class="post-metadata">

### Author: ![eddee54455](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddee54455/32/43350_2.png) [@eddee54455](https://discourse.nodered.org/u/eddee54455)
#### Post date: [12 April 2021 16:15 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/117 "2021-04-12T16:15:46Z")

</div>

Well, The good news is..... I haven't broken it further than it is....

Bad news is..... Still the same... 16h10: 434 Skts open.... 18h10: 943 Skts open....

In the interim, I have removed any disabled flows from the system... Also no improvement...

Bugger......

Ed

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [12 April 2021 17:01 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/118 "2021-04-12T17:01:40Z")

</div>

I wonder, since this process may take some time, whether you should consider running a 2nd instance and do a controlled transfer of your flows from 1 to the other?

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [12 April 2021 17:02 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/119 "2021-04-12T17:02:25Z")

</div>

I wonder, since this process may take some time, whether you should consider running a 2nd instance and do a controlled transfer of your flows from 1 to the other?

---

<div class="post-metadata">

### Author: ![eddee54455](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddee54455/32/43350_2.png) [@eddee54455](https://discourse.nodered.org/u/eddee54455)
#### Post date: [12 April 2021 17:57 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/120 "2021-04-12T17:57:33Z")

</div>

@TotallyInformation

That is a possibility....

Not an easy one to accomplish, as the inter meshing of the two instances would probably argue with one another....

Unfortunately, dissociating a system from its control inputs and outputs would be the only feasible way of doing it, but then, there would be little to no activity per se.... I don't think I would accomplish much by that except having a bit of fun!

I can't help but think, there is something fundamental amiss... Something in the foundational system setup or the way Node Red talks to its "next in line" ....

Any suggestions are worth looking at, more so on the "live" system than anything else....

Regds  
Ed

Edit: I am wondering if there is perhaps a "lost node" or "Lost partial flow" hanging around somewhere that is contributing to the problem.... I have no idea how to even try and track that scenario...

---

<div class="post-metadata">

### Author: ![eddee54455](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddee54455/32/43350_2.png) [@eddee54455](https://discourse.nodered.org/u/eddee54455)
#### Post date: [12 April 2021 18:35 UTC](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279/121 "2021-04-12T18:35:41Z")

</div>

Just bumped NR up to the latest ver 1.3.1 to see if any improvement on the Skts problem....

[Previous page](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279.md?page=5)

[Next page](https://discourse.nodered.org/t/advice-needed-on-pi-cpu-usage/43279.md?page=7)
