ui_LED, dashboard and error 401


#1

Ok, this is another thing which is not playing nice for me.

Here is the list of packages I have installed:

pi@TimePi:~/.node-red $ npm ls --depth=0
node-red-project@0.0.1 /home/pi/.node-red
├── node-red-contrib-advance-logger@1.0.2
├── node-red-contrib-advanced-ping@1.2.0
├── node-red-contrib-bigtimer@2.1.3
├── node-red-contrib-browser-utils@0.0.7
├── node-red-contrib-counter@0.1.5
├── node-red-contrib-cpu@0.0.4
├── node-red-contrib-device-stats@1.1.2
├── node-red-contrib-diode@1.0.1
├── node-red-contrib-excursion@0.1.7
├── node-red-contrib-fs-ops@1.5.0
├── node-red-contrib-isonline@1.1.15
├── node-red-contrib-looptimer@0.0.8
├── node-red-contrib-moment@3.0.1
├── node-red-contrib-mytimeout@3.0.1
├── node-red-contrib-play-audio@2.3.1
├── node-red-contrib-pythonshell@1.4.3
├── node-red-contrib-queue-gate@1.1.0
├── node-red-contrib-repeat@0.0.27
├── node-red-contrib-simple-gate@0.2.2
├── node-red-contrib-simple-message-queue@0.2.2
├── node-red-contrib-simpletime@2.4.0
├── node-red-contrib-startup-trigger@0.1.0
├── node-red-contrib-string@0.2.2
├── node-red-contrib-sunpos@1.4.0
├── node-red-contrib-timeout@1.0.7
├── node-red-contrib-timeouttrigger@0.0.2
├── node-red-contrib-traffic@0.2.1
├── node-red-contrib-ui-led@0.1.3
├── node-red-contrib-web-push@0.0.1
├── node-red-contrib-wifiscan@0.0.2
├── node-red-dashboard@2.13.2
├── node-red-node-ledborg@0.0.19
├── node-red-node-pi-sense-hat@0.0.15
├── node-red-node-ping@0.0.15
├── node-red-node-random@0.1.0
├── node-red-node-serialport@0.6.5
├── node-red-node-smooth@0.1.0
└── node-red-node-suncalc@0.0.10

pi@TimePi:~/.node-red $ 

I put them all so there are no nasties which may pop up later.

This is the flow:

[{"id":"f1ee051d.a087c8","type":"inject","z":"c636aa5a.cc34","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":3490,"y":1860,"wires":[["158ffdeb.df221a"]]},{"id":"6aa4b5df.f7408c","type":"inject","z":"c636aa5a.cc34","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":3490,"y":1900,"wires":[["158ffdeb.df221a"]]},{"id":"158ffdeb.df221a","type":"ui_led","z":"c636aa5a.cc34","group":"bb53947.22a3b68","order":3,"label":"Main","name":"Main","x":3640,"y":1940,"wires":[]},{"id":"bb53947.22a3b68","type":"ui_group","z":"","name":"Telemetry","tab":"e57b580a.89d2d8","order":3,"disp":true,"width":"6","collapse":false},{"id":"e57b580a.89d2d8","type":"ui_tab","z":"","name":"JUNK1","icon":"dashboard","order":26}]

This is what happens when I press either button.


#2

(Not to attract attention, but more as an update)

The error 401 has gone away.
(Probably because of other things being fixed.)

However, the ui_LED still doesn't glow when I inject true or !true into it.

It just stays grey.

Digging further I found this in the package.json file:

"devDependencies": {
    "eslint": "5.x",
    "eslint-plugin-angular": "4.x"
  },

Searching google, I find this link:
about the elsint dependency

Now, I don't know how to list if I have that installed on one machine and not on another.

But as it is listed as a "dependency" then I am taking it as read it is needed.


#3

Start with a very simple bit of flow. A couple of inject nodes feed into a LED node. If that works then it is the data you are feeding to the one in your main flow that is the problem.


#4

Ignore the dev dependencies, they are not relevant to what you are doing.


#5

I have a basic part of the flow.

[{"id":"f1ee051d.a087c8","type":"inject","z":"c636aa5a.cc34","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":3490,"y":1860,"wires":[["158ffdeb.df221a"]]},{"id":"6aa4b5df.f7408c","type":"inject","z":"c636aa5a.cc34","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":3490,"y":1900,"wires":[["158ffdeb.df221a"]]},{"id":"158ffdeb.df221a","type":"ui_led","z":"c636aa5a.cc34","group":"bb53947.22a3b68","order":3,"label":"Main","name":"Main","x":3640,"y":1940,"wires":[]},{"id":"bb53947.22a3b68","type":"ui_group","z":"","name":"Telemetry","tab":"e57b580a.89d2d8","order":3,"disp":true,"width":"6","collapse":false},{"id":"e57b580a.89d2d8","type":"ui_tab","z":"","name":"JUNK1","icon":"dashboard","order":26}]

It is the part in the red area of the screen shot.

Two inject nodes, one ui_LED node.

Inject and Nothing.


#6

For the sake of trying I tried to uninstall the node.

This is what happened - from the web page:

"Uninstall of module node-red-contrib-ui-led failed:"
2/2/2019, 8:09:11 PMmsg : string[42]
"------------------------------------------"
2/2/2019, 8:09:11 PM
msg : string[65]
"Error: Command failed: npm remove --save node-red-contrib-ui-led↵"

Interesting.


#7

Well, like you, I can't get node-red-contrib-ui-led to work at all, with nothing unnexpected in the log. Did you say you have it working on another machine? If so which version of node.js are you using on each? node -v will tell you that.


#8

Copy/paste the full result of the npm remove command please.


#9

This is from the machine on which is does NOT work.

pi@TimePi:~/.node-red $ npm remove node-red-contrib-ui-led
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

removed 18 packages and audited 773 packages in 218.924s
found 6 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
pi@TimePi:~/.node-red $ sudo systemctl restart nodered
pi@TimePi:~/.node-red $ npm install node-red-contrib-ui-led
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

+ node-red-contrib-ui-led@0.1.3
added 1 package from 1 contributor and audited 876 packages in 212.14s
found 6 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
pi@TimePi:~/.node-red $ npm install
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

audited 876 packages in 204.113s
found 6 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
pi@TimePi:~/.node-red $ npm outdated
Package                         Current  Wanted  Latest  Location
node-red-contrib-browser-utils    0.0.7   0.0.7   0.0.8  node-red-project
node-red-contrib-play-audio       2.3.1   2.3.2   2.3.2  node-red-project
node-red-contrib-pythonshell      1.4.3   1.4.3   1.5.4  node-red-project
node-red-contrib-timeout          1.0.7   1.0.8   1.1.1  node-red-project
node-red-node-ledborg            0.0.19  0.0.19  0.0.21  node-red-project
node-red-node-pi-sense-hat       0.0.15  0.0.15  0.0.18  node-red-project
node-red-node-ping               0.0.15  0.0.15  0.0.16  node-red-project
node-red-node-random              0.1.0   0.1.2   0.1.2  node-red-project
node-red-node-serialport          0.6.5   0.6.8   0.6.8  node-red-project
node-red-node-suncalc            0.0.10  0.0.10  0.0.11  node-red-project
pi@TimePi:~/.node-red $ node -v
v8.12.0
pi@TimePi:~/.node-red $ 

Node version 8.12.0

This is from the machine which does work:

me@me-desktop:~/.node-red$ node -v
v8.15.0
me@me-desktop:~/.node-red$ 

What else? (Sorry.)

(Via edit)

So on the TimePi machine, it doesn't work. me@me-desktop it does work.
Sorry for the format of the first cut/paste. It was a cut/paste from the CLI.


#10

That is a pity, I am on node 10.x and I hoped that your working machine would be on something else and the failing one on 10. So I don't know. Anyone else any suggestions other than filing a issue against the node? There is nothing that I can see in the browser console or the log.


#11

Well, I don't think it is a node problem. It is just something doesn't like something else in the system.

That is all I get when trying to remove it.
Installing it (from the web) just fails.
So I did it from the CLI. As you see from the stuff above, I restarted NR, uninstalled the node, restarted NR, all that.
Still won't work on TimePi.
But it will work on me-desktop.

I'm really stuck with what is going on.


#12

It is more likely that the led node requires something particular that is not as it expects.
Which version of node-red are you using on each machine? You can see that from the log, as I am sure you know, if you run

node-red-stop
node-red-start

#13

TimePi details:

Starting as a systemd service.
Started Node-RED graphical event wiring tool.
2 Feb 21:21:27 - [info]
Welcome to Node-RED
===================
2 Feb 21:21:27 - [info] Node-RED version: v0.19.5
2 Feb 21:21:27 - [info] Node.js  version: v8.12.0
2 Feb 21:21:27 - [info] Linux 4.14.79+ arm LE

Working machine stuff:

Starting as a systemd service.
2 Feb 21:19:56 - [info]
Welcome to Node-RED
===================
2 Feb 21:19:56 - [info] Node-RED version: v0.19.4
2 Feb 21:19:56 - [info] Node.js  version: v8.15.0
2 Feb 21:19:56 - [info] Linux 4.15.0-43-generic x64 LE

Just now both are stalled on the initialisation stage.


#14

My guess at this point, given the install/upgrade issues discussed yesterday is a permissions issue. The only thing we haven't looked at is what user node-red is running as. It could be it isn't the usual user and the permissions on package.json or the modules dir are off.


#15

Hi Nick.

Yeah, I've been down that road.

I did the sudo chown ...... stuff.
(Sorry I can't find it now)

But I went through and did it to ALL the machines to stop the problem.

So I hope I did the right thing doing that pre-emptively.

(Found it)
sudo chown -R pi.pi /home/pi/.node-red/node_modules/

So that has been .... dealt with.


#16

What do you mean? Both what?


#17

I did the command/s and as it starts, it shows what I posted then continues scrolling stuff.

(Example:)

pi@TimePi:~/.node-red $ node-red-start

Start Node-RED
 
Once Node-RED has started, point a browser at http://192.168.0.99:1880
On Pi Node-RED works better with the Firefox or Chrome browser
 
Use   node-red-stop                          to stop Node-RED
Use   node-red-start                         to start Node-RED again
Use   node-red-log                           to view the recent log output
Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot
 
To find more nodes and example flows - go to http://flows.nodered.org
 
Starting as a systemd service.
Started Node-RED graphical event wiring tool.
2 Feb 21:21:27 - [info]
Welcome to Node-RED
===================
2 Feb 21:21:27 - [info] Node-RED version: v0.19.5
2 Feb 21:21:27 - [info] Node.js  version: v8.12.0
2 Feb 21:21:27 - [info] Linux 4.14.79+ arm LE
2 Feb 21:21:32 - [info] Loading palette nodes
2 Feb 21:21:59 - [info] Dashboard version 2.13.2 started at /ui
2 Feb 21:22:02 - [info] Settings file  : /home/pi/.node-red/settings.js
2 Feb 21:22:02 - [info] HTTP Static    : /home/pi/.node-red/public
2 Feb 21:22:02 - [info] Context store  : 'default' [module=memory]
2 Feb 21:22:02 - [info] User directory : /home/pi/.node-red
2 Feb 21:22:02 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
2 Feb 21:22:02 - [info] Flows file     : /home/pi/.node-red/flows_TimePi.json
2 Feb 21:22:02 - [info] Server now running at http://127.0.0.1:1880/
2 Feb 21:22:12 - [info] Starting flows
2 Feb 21:22:24 - [info] [udp out:1095c327.4fb3f5] udp ready: 192.168.0.21:6723
2 Feb 21:22:28 - [info] Started flows
2 Feb 21:22:32 - [warn] [function:4ac3b17.7ec8c5] ********************
2 Feb 21:22:32 - [warn] [function:4ac3b17.7ec8c5] Azimuth set to 55
2 Feb 21:22:36 - [warn] [function:Button Colour] **  Reset button colours **
2 Feb 21:22:36 - [warn] [function:Button Colour] **  Reset button colours **
2 Feb 21:22:36 - [warn] [function:Button Colour] **  Reset button colours **
2 Feb 21:22:36 - [warn] [function:Button Colour] **  Reset button colours **
2 Feb 21:22:36 - [warn] [function:Button Colour] **  Reset button colours **
2 Feb 21:22:36 - [warn] [function:Button Colour] **  Reset button colours **
2 Feb 21:22:36 - [warn] [function:Button Colour] **  Reset button colours **
2 Feb 21:22:36 - [warn] [function:Button Colour] **  Reset button colours **
2 Feb 21:22:36 - [warn] [function:Button Colour] **  Reset button colours **
2 Feb 21:22:36 - [warn] [function:Button Colour] **  Reset button colours **
2 Feb 21:22:48 - [info] [mqtt-broker:MQTT host] Connected to broker: mqtt://192.168.0.99:1883
2 Feb 21:22:50 - [info] [mqtt-broker:9ff4e9dd.66b6f] Connection failed to broker: mqtt://192.168.0.99:1883
2 Feb 21:22:50 - [info] [mqtt-broker:MQTT host] Connection failed to broker: mqtt://192.168.0.99:1883
2 Feb 21:23:03 - [info] [mqtt-broker:MQTT host] Connected to broker: mqtt://192.168.0.99:1883
2 Feb 21:23:03 - [info] [mqtt-broker:9ff4e9dd.66b6f] Connected to broker: mqtt://192.168.0.99:1883

      pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/sbin/iwlist wlan0 scan
pam_unix(sudo:session): session opened for user root by (uid=0)
pam_unix(sudo:session): session closed for user root
      pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/sbin/iwlist wlan0 scan
pam_unix(sudo:session): session opened for user root by (uid=0)
pam_unix(sudo:session): session closed for user root
      pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/sbin/iwlist wlan0 scan
pam_unix(sudo:session): session opened for user root by (uid=0)
pam_unix(sudo:session): session closed for user root
      pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/sbin/iwlist wlan0 scan
pam_unix(sudo:session): session opened for user root by (uid=0)
pam_unix(sudo:session): session closed for user root
      pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/sbin/iwlist wlan0 scan
pam_unix(sudo:session): session opened for user root by (uid=0)
pam_unix(sudo:session): session closed for user root
      pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/sbin/iwlist wlan0 scan
pam_unix(sudo:session): session opened for user root by (uid=0)
pam_unix(sudo:session): session closed for user root
      pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/sbin/iwlist wlan0 scan
pam_unix(sudo:session): session opened for user root by (uid=0)
pam_unix(sudo:session): session closed for user root
      pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/sbin/iwlist wlan0 scan
pam_unix(sudo:session): session opened for user root by (uid=0)
pam_unix(sudo:session): session closed for user root
      pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/sbin/iwlist wlan0 scan
pam_unix(sudo:session): session opened for user root by (uid=0)
pam_unix(sudo:session): session closed for user r

And it still isn't finished.

Same with the other machine.

On the TimePi (Problematic machine)
This is the long list of the directories.

node_modules/  flows_TimePi_cred.json  npm_modules.txt    package-lock.json
pi@TimePi:~/.node-red $ ll
total 1180
drwxr-xr-x   4 pi pi    4096 Nov 11 16:10 lib/
drwxr-xr-x 308 pi pi   12288 Feb  2 20:27 node_modules/
drwxr-xr-x   6 pi pi    4096 Nov 11 16:14 public/
-rw-r--r--   1 pi pi     152 Jan  6 09:21 flows_TimePi_cred.json
-rw-r--r--   1 pi pi 1032706 Feb  2 20:46 flows_TimePi.json
-rw-r--r--   1 pi pi   25196 Feb  2 17:41 npm_modules.txt
-rw-r--r--   1 pi pi    1753 Feb  2 20:27 package.json
-rw-r--r--   1 pi pi  102233 Feb  2 20:25 package-lock.json
-rw-r--r--   1 pi pi    9196 Jan 10 15:24 settings.js
pi@TimePi:~/.node-red $ cd node_modules/
pi@TimePi:~/.node-red/node_modules $ ll
total 1220
drwxr-xr-x 2 pi   pi   4096 Nov 11 16:10 accepts/
drwxr-xr-x 3 pi   pi   4096 Nov 11 16:10 after/
drwxr-xr-x 3 pi   pi   4096 Nov 11 16:10 agent-base/
drwxr-xr-x 2 pi   pi   4096 Nov 11 16:14 ansi-bgblack/
drwxr-xr-x 2 pi   pi   4096 Nov 11 16:14 ansi-bgblue/
drwxr-xr-x 2 pi   pi   4096 Nov 11 16:14 ansi-bgcyan/
drwxr-xr-x 2 pi   pi   4096 Nov 11 16:14 ansi-bggreen/
drwxr-xr-x 2 pi   pi   4096 Nov 11 16:14 ansi-bgmagenta/
(and more)

#18

It doesn't finish, it sits watching the log till you use Ctrl-C to get out, which takes you back to the command line but leaves node red running. Everything there looks fine. Presumably your led node still works on one but not the other.


#19

Oh.

Thanks.

Yes: It works on one me-desktop and doesn't work on TimePi


#20

Do you mean the install/uninstall issues or the led node not working? The install/uninstall problem went away when he did it via the command line, and I am confident I have haven't got any permissions issue on mine, where the led also doesn't work.