node-red / node-red/node-red-nodes

SenseHAT is loosing connection after some hours of use

Open
#460 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
612
Avg merge
13h 57m
Merged PRs (30d)
3

Description

Which node are you reporting an issue on?

node-red-node-pi-sense-hat

What are the steps to reproduce?

This is the flow, I'm using on my Raspberry Pi 3B+ with Raspbian:

[{"id":"7aa7407d.550d1","type":"rpi-sensehat in","z":"1841b51e.41772b","name":"","motion":true,"env":true,"stick":true,"x":100,"y":180,"wires":[["710370a0.d3b5b"]]},{"id":"710370a0.d3b5b","type":"switch","z":"1841b51e.41772b","name":"Sensor Data","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"motion","vt":"str"},{"t":"eq","v":"environment","vt":"str"},{"t":"eq","v":"joystick","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":4,"x":290,"y":180,"wires":[[],["8d241a12.f97968","460b6c21.49edf4","867dbce7.b4506"],[],[]],"outputLabels":["motion","environment","joystick","otherwise"]},{"id":"8d241a12.f97968","type":"change","z":"1841b51e.41772b","name":"get temperatur","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.temperature","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":160,"wires":[["ef8e416e.62cf2"]]},{"id":"460b6c21.49edf4","type":"change","z":"1841b51e.41772b","name":"get humidity","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.humidity","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":200,"wires":[["7a0053a.62998ac"]]},{"id":"867dbce7.b4506","type":"change","z":"1841b51e.41772b","name":"get pressure","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.pressure","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":240,"wires":[["4390be22.0dd39"]]},{"id":"ef8e416e.62cf2","type":"change","z":"1841b51e.41772b","name":"Save Temperature","rules":[{"t":"set","p":"state.temperature","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":160,"wires":[["2a916557.19be3a"]]},{"id":"7a0053a.62998ac","type":"change","z":"1841b51e.41772b","name":"Save Humidity","rules":[{"t":"set","p":"state.humidity","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":200,"wires":[["56291be6.023ea4"]]},{"id":"4390be22.0dd39","type":"change","z":"1841b51e.41772b","name":"Save Pressure","rules":[{"t":"set","p":"state.pressure","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":240,"wires":[["a539d3c1.409ac"]]},{"id":"2a916557.19be3a","type":"ui_gauge","z":"1841b51e.41772b","name":"Show Temperature","group":"5664af2f.e29e5","order":1,"width":"6","height":"4","gtype":"gage","title":"Temperature","label":"°C","format":"{{value}}","min":"0","max":"50","colors":["#0092b5","#00b500","#ca3838"],"seg1":"10","seg2":"30","x":1210,"y":160,"wires":[]},{"id":"56291be6.023ea4","type":"ui_gauge","z":"1841b51e.41772b","name":"Show Humidity","group":"5664af2f.e29e5","order":2,"width":"3","height":"3","gtype":"wave","title":"Humidity","label":"%RH","format":"{{value}}","min":"0","max":"100","colors":["#0092b5","#00b500","#ca3838"],"seg1":"10","seg2":"30","x":1200,"y":200,"wires":[]},{"id":"a539d3c1.409ac","type":"change","z":"1841b51e.41772b","name":"Ceil","rules":[{"t":"set","p":"payload","pt":"msg","to":"$ceil(payload)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1030,"y":240,"wires":[["d34d30af.841b1"]]},{"id":"d34d30af.841b1","type":"ui_gauge","z":"1841b51e.41772b","name":"Show Pressure","group":"5664af2f.e29e5","order":2,"width":"3","height":"3","gtype":"wave","title":"Pressure","label":"hPa","format":"{{value}}","min":"970","max":"1050","colors":["#0092b5","#00b500","#ca3838"],"seg1":"1000","seg2":"1050","x":1200,"y":240,"wires":[]},{"id":"5664af2f.e29e5","type":"ui_group","z":"","name":"Comfort","tab":"9cb4eb1e.6f02b8","order":1,"disp":true,"width":"6","collapse":false},{"id":"9cb4eb1e.6f02b8","type":"ui_tab","z":"","name":"Sensors","icon":"fa-thermometer-empty","order":3}]
What happens?

Sometimes after one or two days, the cennection to SenseHAT gets lost.

The Node-RED-Log shows this outuput:

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)
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)
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)
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)
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)
What do you expect to happen?

Even after loosing connection the script should reconnect automatically.

Please tell us about your environment:
  • Node-RED version: 0.18.7
  • node.js version: 10.5.0
  • npm version:6.1.0
  • Platform/OS: Raspbian
  • Browser: Chromium

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the node-red-node-pi-sense-hat package and its sensehat.py entry point, using the supplied long-running Raspberry Pi flow to reproduce the loss of connection. Trace the repeated sudo sessions in the Node-RED log and determine how the process handles disconnection. Done means the SenseHAT connection is restored automatically after it is lost.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python, raspberry-pi
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.