Harsch-Systems / node-red-contrib-pi-plates

Control Pi-Plates from Node-RED
Apache License 2.0
6 stars 7 forks source link

Issues with Pi-Plate node forcing nodered restarts #9

Closed beccsjb closed 4 years ago

beccsjb commented 4 years ago

Having an issue with nodered, once the relay node is deployed it forces node red to schedule restart and sits there on a constant loop.

I'm about out of ideas on how to get it too run.

I have followed the install guide on the pi plates website, installed pi-plates module through pip.


8 Jul 17:15:29 - [info] [xiaomi-gateway-config:Xiomi Gateway - Amarok] UDP socket listening on 0.0.0.0:9898 8 Jul 17:15:29 - [info] [tcp in:b6f3127a.bdf7e] listening on port 8099 8 Jul 17:15:29 - [red] Uncaught Exception: 8 Jul 17:15:29 - Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed at doWrite (_stream_writable.js:406:19) at writeOrBuffer (_stream_writable.js:394:5) at Socket.Writable.write (_stream_writable.js:294:11) at WorkQueue.do_cmd [as worker] (/home/pi/.node-red/node_modules/pi-plates/BASEplate.js:26:17) at Immediate. (/home/pi/.node-red/node_modules/vasync/lib/vasync.js:562:6) at runCallback (timers.js:705:18) at tryOnImmediate (timers.js:676:5) at processImmediate (timers.js:658:5) nodered.service: Main process exited, code=exited, status=1/FAILURE nodered.service: Failed with result 'exit-code'. nodered.service: Service RestartSec=100ms expired, scheduling restart. nodered.service: Scheduled restart job, restart counter is at 2. Stopped Node-RED graphical event wiring tool. Started Node-RED graphical event wiring tool. 8 Jul 17:15:32 - [info] Welcome to Node-RED

8 Jul 17:15:32 - [info] Node-RED version: v1.0.3 8 Jul 17:15:32 - [info] Node.js version: v10.15.2 8 Jul 17:15:32 - [info] Linux 4.19.97-v7l+ arm LE 8 Jul 17:15:34 - [info] Loading palette nodes 8 Jul 17:15:37 - [info] Dashboard version 2.22.1 started at /ui 8 Jul 17:15:38 - [info] Settings file : /home/pi/.node-red/settings.js 8 Jul 17:15:38 - [info] Context store : 'default' [module=localfilesystem] stderr: Traceback (most recent call last): File "/home/pi/.node-red/node_modules/pi-plates/plate_io.py", line 3, in import piplates.DAQCplate as DP ModuleNotFoundError: No module named 'piplates' code: 1 signal: null


It appears to be looking for a module called piplates, isnt the module called 'pi-plates' ?

beccsjb commented 4 years ago

I also get the same error when launching module 'piplates' from Python Shell.

">>> import piplates.RELAYplate as RELAY Traceback (most recent call last): File "<pyshell#3>", line 1, in import piplates.RELAYplate as RELAY ModuleNotFoundError: No module named 'piplates'

"

Yet when i run in Terminal, i can manually turn on relays on the Pi Plate....

pi@raspberrypi:~/.node-red $ python Python 2.7.16 (default, Oct 10 2019, 22:02:15) [GCC 8.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import piplates.RELAYplate as RELAY RELAY.getID(0) 'Pi-Plate RELAY' RELAY.relayON(0,1)

As you would expect relay 1 turns on...

mharsch commented 4 years ago

At first glance, it looks like you've installed the python 2.7 version of the pi-plates python library. The Node-RED package (as of the most recent release) requires the python 3 version of the pi-plates library. Could you try installing the python 3 version (e.g. 'sudo apt install python3-pip' then 'pip3 install pi-plates')?

beccsjb commented 4 years ago

You my friend have just saved me from going bald!

Thank you so much, really appreciate you taking the time to reply and solve my issue!

For those n00bs who stumble upon this issue aswell. The install needs to be done as below;

Sudo apt update sudo apt install python3-pip pip3 install pi-plates

Thanks to mharsch for the solution!

pi-plates commented 4 years ago

Isn't pip3 already part of the RPi OS image?

On Wed, Jul 8, 2020, 8:26 AM beccsjb notifications@github.com wrote:

You my friend have just saved me from going bald!

Thank you so much, really appreciate you taking the time to reply and solve my issue!

For those n00bs who stumble upon this issue aswell. The install needs to be done as below;

Sudo apt update sudo apt install python3-pip pip3 install pi-plates

Thanks to mharsch for the solution!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Harsch-Systems/node-red-contrib-pi-plates/issues/9#issuecomment-655487310, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACACCANTM5MDESEZSSAPQ3TR2RQWJANCNFSM4OUMQGJQ .

mharsch commented 4 years ago

Neither pip nor pip3 are installed by default on the 'lite' version of Raspberry Pi OS. It looks like they are installed by default when you start with the 'full' image.