node-red/node-red-nodes

node-red-node-pi-sense-hat

keefer223 opened this issue · 2 comments

as soon as I hit DEPLOY node-RED displays the following error:

Flows stopped due to missing node types.

rpi-sensehat in
rpi-sensehat out

I've uninstalled and reinstalled node-red-node-pi-sense-hat v 0.1.2 several times and I get the same error.

  • When I install the node everything installs fine - no errors

  • the 2 widgets that pop-up on the palette is "Sense HAT" input and "Sense HAT" output

  • further review shows that each are supposedly rpi-sensehat in and rpi-sensehat out respectively

  • It doesn't matter whether I drag in one or both "Sense HAT" input and "Sense HAT" output and connect them to a flow or even just debug

  • as soon as you hit DEPLOY node-RED displays the error.

However, both widgets are still visible, but shortly after the error is displayed both show-up as a red box, "unknown: rpi-sensehat in" and "unknown: rpi-sensehat out" in the flow

I checked Palette Management (install tab) for node-red-node-pi-sense-hat before I hit install:

node-red-node-pi-sense-hat
A Node-RED node to interact with a Raspberry Pi Sense HAT
0.1.1 1 year, 3 months ago

Palette Management (install tab) for node-red-node-pi-sense-hat after I hit install:

node-red-node-pi-sense-hat
A Node-RED node to interact with a Raspberry Pi Sense HAT
0.1.1 1 year, 3 months ago

Palette Management (Nodes tab) for node-red-node-pi-sense-hat after I hit install:

node-red-node-pi-sense-hat
0.1.2

Error: Can't find Sense HAT python libraries. Run sudo apt-get install sense-hat

rpi-sensehat in
rpi-sensehat out

Part of the problem appears to be two different versions if the node in palette management,

I installed both:
python3-sense-hat (2.3.1-1)
sense-hat (1.3)

the log file for the install;

2022-07-13T14:03:13.447Z Install : node-red-node-pi-sense-hat 0.1.1

2022-07-13T14:03:13.436Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-node-pi-sense-hat@0.1.1
2022-07-13T14:03:22.099Z [out]
2022-07-13T14:03:22.099Z [out] added 1 package in 8s
2022-07-13T14:03:22.120Z rc=0


keefer@rpi4:~ $ sudo apt install sense-hat
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
sense-hat

0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/11.6 kB of archives.
After this operation, 76.8 kB of additional disk space will be used.
Selecting previously unselected package sense-hat.
(Reading database ... 123699 files and directories currently installed.)
Preparing to unpack .../archives/sense-hat_1.3_all.deb ...
Unpacking sense-hat (1.3) ...
Setting up sense-hat (1.3) ...
Enabling I2C...

keefer@rpi4:~ $ node-red-start

Start Node-RED

Once Node-RED has started, point a browser at http://192.168.1.43: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.
13 Jul 11:36:41 - [info]
Welcome to Node-RED

13 Jul 11:36:41 - [info] Node-RED version: v2.2.2
13 Jul 11:36:41 - [info] Node.js version: v12.22.12
13 Jul 11:36:41 - [info] Linux 5.15.32-v7l+ arm LE
13 Jul 11:36:43 - [info] Loading palette nodes
13 Jul 11:36:48 - [info] Dashboard version 3.1.7 started at /ui
13 Jul 11:36:49 - [warn] ------------------------------------------------------
13 Jul 11:36:49 - [warn] [node-red-node-pi-sense-hat/sensehat] Error: Can't find Sense HAT python libraries. Run sudo apt-get install sense-hat
13 Jul 11:36:49 - [warn] ------------------------------------------------------
13 Jul 11:36:49 - [info] Settings file : /home/keefer/.node-red/settings.js
13 Jul 11:36:49 - [info] Context store : 'default' [module=memory]
13 Jul 11:36:49 - [info] User directory : /home/keefer/.node-red
13 Jul 11:36:49 - [warn] Projects disabled : editorTheme.projects.enabled=false
13 Jul 11:36:49 - [info] Flows file : /home/keefer/.node-red/flows.json
13 Jul 11:36:49 - [info] +-----------------------------------------------------
13 Jul 11:36:49 - [info] | uibuilder v5.1.1 initialised
13 Jul 11:36:49 - [info] | root folder: /home/keefer/.node-red/uibuilder
13 Jul 11:36:49 - [info] | Using Node-RED's webserver at:
13 Jul 11:36:49 - [info] | http://0.0.0.0:1880/
13 Jul 11:36:49 - [info] | Installed packages:
13 Jul 11:36:49 - [info] +-----------------------------------------------------
13 Jul 11:36:49 - [info] Server now running at http://127.0.0.1:1880/
13 Jul 11:36:49 - [info] Starting flows
13 Jul 11:36:50 - [info] Started flows

Which node are you reporting an issue on? node-red-node-pi-sense-hat

What are the steps to reproduce? see above

What happens? flow stops

What do you expect to happen?

Please tell us about your environment:

  • Node-RED version: v 2.2.2
  • node.js version: v12.22.12
  • npm version: v7.5.2
  • Platform/OS: RPI 4 / Raspbian GNU/Linux 11 (bullseye) up to date
  • Browser: Firefox v91.8.0esr

I did find out the following:
File path .node-red/node_modules/node-red-node-pi-sense-hat/sensehat.js
Example I have node-red in my home folder and use nano so its:
pi@raspberrypi:~ $ nano ~/.node-red/node_modules/node-red-node-pi-sense-hat/sensehat.js

line10 :

**if (!fs.existsSync('/usr/lib/python2.7/dist-packages/sense_hat'))**

I changed this to:

if (!fs.existsSync('/usr/lib/python3/dist-packages/sense_hat'))

the problem seems to be the node is tied into python2 instead of python3.

that didn't work!!!
I found the following in the RPI 4 terminal

keefer@rpi4:~ $ node-red-start

Start Node-RED

Once Node-RED has started, point a browser at http://192.168.1.43: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.
13 Jul 18:13:18 - [info]
Welcome to Node-RED

13 Jul 18:13:18 - [info] Node-RED version: v2.2.2
13 Jul 18:13:18 - [info] Node.js version: v12.22.12
13 Jul 18:13:18 - [info] Linux 5.15.32-v7l+ arm LE
13 Jul 18:13:19 - [info] Loading palette nodes
13 Jul 18:13:24 - [info] Dashboard version 3.1.7 started at /ui
13 Jul 18:13:26 - [info] Settings file : /home/keefer/.node-red/settings.js
13 Jul 18:13:26 - [info] Context store : 'default' [module=memory]
13 Jul 18:13:26 - [info] User directory : /home/keefer/.node-red
13 Jul 18:13:26 - [warn] Projects disabled : editorTheme.projects.enabled=false
13 Jul 18:13:26 - [info] Flows file : /home/keefer/.node-red/flows.json
13 Jul 18:13:26 - [info] +-----------------------------------------------------
13 Jul 18:13:26 - [info] | uibuilder v5.1.1 initialised
13 Jul 18:13:26 - [info] | root folder: /home/keefer/.node-red/uibuilder
13 Jul 18:13:26 - [info] | Using Node-RED's webserver at:
13 Jul 18:13:26 - [info] | http://0.0.0.0:1880/
13 Jul 18:13:26 - [info] | Installed packages:
13 Jul 18:13:26 - [info] +-----------------------------------------------------
13 Jul 18:13:26 - [info] Server now running at http://127.0.0.1:1880/
13 Jul 18:13:26 - [info] Starting flows
keefer : PWD=/home/keefer ; USER=root ; COMMAND=/usr/bin/python3 -u /home/keefer/.node-red/node_modules/node-red-node-pi-sense-hat/sensehat.py
pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
13 Jul 18:13:26 - [info] Started flows
pam_unix(sudo:session): session closed for user root
keefer : PWD=/home/keefer ; USER=root ; COMMAND=/usr/bin/python3 -u /home/keefer/.node-red/node_modules/node-red-node-pi-sense-hat/sensehat.py
pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
pam_unix(sudo:session): session closed for user root
keefer : PWD=/home/keefer ; USER=root ; COMMAND=/usr/bin/python3 -u /home/keefer/.node-red/node_modules/node-red-node-pi-sense-hat/sensehat.py
pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)

It goes without saying, using only the sense hat input, in the node-red flow keeps cycling connected - disconnected.

hopefully now closed by e7c0459
Now on npm and in library