New version of NR, lost in `settings.js` file

Sorry folks.

After a lot of messing around, I nearly have the machine working.

In the old version I could set a variable to set the device's name.

    functionGlobalContext: {
        // os:require('os'),
        // octalbonescript:require('octalbonescript'),
        // jfive:require("johnny-five"),
        // j5board:require("johnny-five").Board({repl:false})
        myDeviceName: "TelePi"

I have tried in the new settings file:

    functionGlobalContext: {
        myDeviceName: "TelePi"
        // os:require('os'),

Looking in the context for that machine:

Screenshot from 2021-12-14 22-47-31

compared to the other machine's settings:

Screenshot from 2021-12-14 22-48-30

What am I missing?

NR 2.1.4 and 2.1.3

Check you have exportGlobalContextKeys set to true in your settings file (it is false by default).

1 Like

(Machine restarting NR)

Gee there is a substantial change in the settings.js file between 2.1.3 and 2.1.4!

I guess it is just a case of sitting down and going through them.
But basically they are sectionalised in pretty much the same order?

(Nearly running)

Ok, so the settings.js can't exactly be copied from a 1.x to 2.x version - no? (or yes?)

I am also seeing this message:

Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

Ok. I thought I had done that. (Moving on)
I copy the flows.json and flows_cred.json file from their backup.

The flows.json has gone from 1.3 meg to 2.2 meg in size.

(machine now running NR)
It worked!

(setting that line as you said.)

Hmm maybe "no problems so far" was speaking too soon...

Now I have a problem with a Python script.
paho-mqtt was MIA so I had to (re)install it.
and I thought the bigger mqtt set was also missing, but no: it was still here.

But now I am getting an error in the python3 code:

pi@TelePi:~/Pimoroni/blinkt $ python3 
Traceback (most recent call last):
  File "", line 93, in <module>
    client = mqtt.Mosquitto()
AttributeError: module 'paho.mqtt.client' has no attribute 'Mosquitto'
pi@TelePi:~/Pimoroni/blinkt $ 

line 93:
client = mqtt.Mosquitto()
But that should be ok from:
import paho.mqtt.client as mqtt way up in the early lines.

It worked before the update from Jessie to Buster.

Have you solved this? I have the same exact problem on one of my Pi's. Another Pi, built from almost the same image, does not have the problem.

Exactly which problem? There are several in this thread.

Weird, I thought I quoted... :scream: I meant the Paho MQTT problem in the last post.

I found the problem with PahoMQTT

A command I used had been ...... removed.
I had to change it to a different one.

The case in point:

client = mqtt.Mosquitto()


client = mqtt.Client("LED blink routine")

Which is kind of better as now the window that was opened has a name I specify.

Thanks! I'll try to implement that, then. :slight_smile:

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