PiSense HAT Disconnected - both ends!

Hello,

The "connection lost" issue at https://discourse.nodered.org/t/node-red-connection-lost/1724 does not apply to my situation. I'm using node (v11.6.0) and npm (6.5.0-next.0) and stretch will all updates/upgrades applied on RPi3.

Both PiSense HAT nodes (in and out) display "disconnected" status message after "some" random period. Node-RED is running as a service per official documentation. Other related nodes, Wunderground, Inject (fixed periodicity) and others, are working fine per my understanding. Even if I close the browser, PiSense HAT nodes stop transmitting/receiving (per respective node) after a while.

I am probably making a basic mistake. It is very elementary linear PiSense HAT flow. What should I look for in the logs?

Thanks.

P.S. Getting back to Node-RED after an year's absence and it shows! :slight_smile: Still need to fix the Twitter node at my end.

Were you aware that v8.x is the recommended version of node.js with node-RED? I don't think it very likely that this is the cause of your problem but still, dropping back to the supported version would be my first action just in case.

Thanks, Colin. I'll give it a try. Rgds.

Hello Colin,

Just an update to complete the loop (and to close my original post in case it helps others).

I downgraded the versions (per your suggestion) but the problem persisted. I reverted back to my prior version and disconnected the PiSenseHAT display node. No further issue with the input node (for some inexplicable understanding at my end). I have had continuous feed from PiSenseHAT to the Dashboard nodes for the last six days. Since I am uncomfortable with the PiSense display (via node sadly but works wonderfully with Python code), I will simply focus on improving my Node-RED skills with other widgets for now.

Thanks once again for stepping in to respond and to provide a positive suggestion (as you always do). Regards.

For what it's worth, I just upgraded my pi using a sense hat to NR 0.19.5 and for the moment see no problem with the PiSense.

Were you seeing and/or reading something from the hat?

Ok, I have reproduced this :grinning: but don't know the exact steps to reproduce it :confused:. It seems that some event (I was sending different things to the LEDs) caused the session to close and it reopened right away but in the flow editor, the node shows a red dot and the word Disconnected even though it still works.
sensehat
what makes it more interesting is that if I do something to modify the flow - like edit the node and give it a name or add a debug to the flow - the Sense Hat node is attached to, it goes back to a green dot and Connected. In this image you see two of the Sense Hat nodes are now connected and the last is not - which makes a sense (no pun intended) since I have deploy set to 'Modified Flows'.
sensehat2
Here is the startup log to the point where the issue occurs

Start Node-RED
 
Once Node-RED has started, point a browser at http://192.168.48.222: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.
25 Jan 03:44:32 - [info]
Welcome to Node-RED
===================
25 Jan 03:44:32 - [info] Node-RED version: v0.19.5
25 Jan 03:44:32 - [info] Node.js  version: v8.15.0
25 Jan 03:44:32 - [info] Linux 4.14.79-v7+ arm LE
25 Jan 03:44:34 - [info] Loading palette nodes
25 Jan 03:44:50 - [info] Dashboard version 2.9.4 started at /ui
25 Jan 03:44:52 - [info] Settings file  : /home/pi/.node-red/settings.js
25 Jan 03:44:52 - [info] Context store  : 'default' [module=memory]
25 Jan 03:44:52 - [info] User directory : /home/pi/.node-red
25 Jan 03:44:52 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
25 Jan 03:44:52 - [info] Flows file     : /home/pi/.node-red/flows_arduino.json
25 Jan 03:44:52 - [warn]
---------------------------------------------------------------------
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.
---------------------------------------------------------------------
25 Jan 03:44:52 - [info] Starting flows
      pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/usr/bin/python -u /home/pi/.node-red/node_modules/node-red-node-pi-sense-hat/sensehat.py
pam_unix(sudo:session): session opened for user root by (uid=0)
25 Jan 03:44:52 - [info] Started flows
25 Jan 03:44:52 - [info] Server now running at http://127.0.0.1:1880/
 25 Jan 03:51:37 - [info] Stopping modified flows
25 Jan 03:51:37 - [info] Stopped modified flows
25 Jan 03:51:37 - [info] Starting modified flows
25 Jan 03:51:37 - [info] Started modified flows
25 Jan 03:51:56 - [info] Stopping modified flows
25 Jan 03:51:56 - [info] Stopped modified flows
25 Jan 03:51:56 - [info] Starting modified flows
25 Jan 03:51:56 - [info] Started modified flows
pam_unix(sudo:session): session closed for user root
      pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/usr/bin/python -u /home/pi/.node-red/node_modules/node-red-node-pi-sense-hat/sensehat.py
pam_unix(sudo:session): session opened for user root by (uid=0)

Thanks for the detailed information. As a newbie, every little bit helps me to understand Node-RED a little bit more. Your details will help me positively.

I could not get:

  • Text to scroll (even I used exactly the same string as in the doc)
  • Couldn't sequence multiple frames the 8x8 LED display (of course, comparison to equivalent Python is unfair)

Since the Dashboard widgets are doing their job, I have one less reason to blink LEDs. It has been eight days now since I resumed the PiSense HAT feed and there has no gap in the Dashboard line charts (unlike previously). The only bell/whistle that I would like to see would be some user setting to stream the payload at any reasonable user specified interval. Right now I have to use a downstream node for this purpose - not an issue at all because I got to experience the two ways to filter messages.

Regards.

Revisited this topic owing to a need at my end after re-reading the founder's note!

The following works uninterrupted (for nearly 48 hours now - no freeze :grinning: v0.20.5):

msg.payload = "some cmd";
msg.payload = msg.payload + "\nsome cmd";

but not a single string with "\n" as the implicit delimiter (sorry, I'm a Javascript newbie).

P.S. The only correct reading that I get out of PiSense HAT is that for humidity. I know more knowledgeable folks have managed to apply correction factors (per BenN for ISS) for temperature but I doubt that those factors are universal. My pet peeve - the lowly DHTxx sensors provide better temperature readings than others including BME680 (mounted close to RPi0 header - my issue) and DS18B20 on a breadboard (3 mounted in parallel - each dissipating heat to the others?)

Whom are you refering to when you say 'founder' and what note is that?

The only correct reading that I get out of PiSense HAT is that for humidity.
How are you doing your readings? i.e. with out your flow, who knows...

Readings of any temperature sensor will be effected by the local environment. If you want to check the temperature of a room and put the sensor over an incandescent light bulb or a heater vent, you're going to see a spike when the light or heat is turned on/off. If you mount a sensor on top of the Pi, the heat from the pi will have an affect on your readings. Even mounting componente next to each other can cause changes to the micro environment they are in.

One thing you could do is make sure any sensor is under other equipment - heat rises after all :laughing:

My apologies for my cryptic note. What I was alluding to was the fact that the PiSense HAT serves no useful purpose in measuring temperature because any correction would be ad-hoc.

I understand what you are saying. No issue with your comments. My observation regarding the BME680 reinforces your comments. I have been using these temperature sensors for several years now in various tire kicking exercises. :grinning: I have some basic knowledge in heat (and mass) transfer principles.