Node Red video player issues

#1

Hi, I have a python script running on a Raspberry Pi which works as a triggered video player. I'm using Node Red to trigger the GPIOs to play the videos from the NR UI. I'm able to manually trigger the videos using the GPIOs but I'm not able to trigger them through Node Red. However, when I move something around in NR (not make any real changes) then hit the Deploy button then it works fine. Does anyone know what's going on and how to fix this?

I'm a noob, any help is appreciated!

#2

Can you export your flow to the clipboard and copy and paste it here please
put 3 backticks ``` before and after your paste to make it easier to copy back out again

#3

What do you mean by that?

#4

If I take a jumper wire and connect it from the GPIO pin to ground it plays the video.

#5
[{"id":"26d17cb5.f37484","type":"rpi-gpio out","z":"c75e314a.03afa","name":"Pause - 14","pin":"8","set":true,"level":"1","freq":"","out":"out","x":850,"y":350.0000305175781,"wires":[]},{"id":"cd013a0c.e6ccc8","type":"ui_switch","z":"c75e314a.03afa","name":"","label":"Pause","group":"83389784.468eb8","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"0","onvalueType":"str","onicon":"","oncolor":"","offvalue":"1","offvalueType":"str","officon":"","offcolor":"","x":159.00000381469727,"y":348.00000953674316,"wires":[["26d17cb5.f37484"]]},{"id":"83389784.468eb8","type":"ui_group","z":"","name":"Video","tab":"f291fdf0.0507d","disp":true,"width":"6","collapse":false},{"id":"f291fdf0.0507d","type":"ui_tab","z":"","name":"The Lair of the Puzzlemaster","icon":"dashboard"}]
#6

Did you put the flow between lines containing just three back ticks as suggested? I am on phone so not certain. If you haven't then the flow will probably not import. Have you put a debug node on the output sending to the gpio node to check the payload is correct? Also check the node red log to see if any errors and post what you see in the log when you restart node red.

#7

Yes, I think it's posted correctly now.

#8

I added a debug node on the output and everything is working correctly.

Here's what I found in the node red log:
24 Aug 12:03:55 - [info] Starting flows
24 Aug 12:03:55 - [info] Started flows
24 Aug 12:03:55 - [info] Server now running at http://127.0.0.1:1880/
24 Aug 12:04:54 - [info] Stopping flows
24 Aug 12:04:54 - [info] Stopped flows
24 Aug 12:04:54 - [info] Starting flows
24 Aug 12:04:55 - [info] Started flows
24 Aug 12:05:24 - [info] Stopping flows
24 Aug 12:05:24 - [info] Stopped flows
24 Aug 12:05:24 - [info] Starting flows
24 Aug 12:05:24 - [info] Started flows
25 Aug 09:31:21 - [info] Stopping flows
25 Aug 09:31:21 - [info] Stopped flows
25 Aug 09:31:21 - [info] Starting flows
25 Aug 09:31:22 - [info] Started flows
25 Aug 09:31:40 - [info] Stopping flows
25 Aug 09:31:40 - [info] Stopped flows
25 Aug 09:31:40 - [info] Starting flows
25 Aug 09:31:41 - [info] Started flows

#9

I should mention everything was working properly until I updated (ran sudo apt-get upgrade). Now it doesn't work until I hit deploy, then it's fine.

#10

Yes you certainly should have mentioned that.
On a pi you should not update node red using apt, you should use the bash <(curl script from https://nodered.org/docs/hardware/raspberrypi.

You have not posted the log from when node-red is restarted, that will show the versions of node-red etc.

I don't understand what you mean by it not working until you deploy. If it works ok after deploy what makes it stop working again so you have to re-deploy?

#11

Sorry, I'm not sure where to find that log. I used node-red-log is there another log somewhere?

The video player script doesn't work when I boot up the pi. If I go into Node Red and adjust something then hit the deploy button then the video player works from Node Red. This pi will be shut down every night so when we boot it up again I would have to do the same process again. I'm trying to find a solution so I don't have to do that.

Thanks for the response!

#12

That is the log, but as I said, restart node red then the log will have the start up

#13

Ok, I think I found what you want:
Starting as a systemd service.
Started Node-RED graphical event wiring tool.
25 Aug 12:24:34 - [info]
Welcome to Node-RED

25 Aug 12:24:34 - [info] Node-RED version: v0.19.1
25 Aug 12:24:34 - [info] Node.js version: v8.11.4
25 Aug 12:24:34 - [info] Linux 4.14.62-v7+ arm LE
25 Aug 12:24:35 - [info] Loading palette nodes
25 Aug 12:24:38 - [info] Dashboard version 2.9.6 started at /ui
25 Aug 12:24:39 - [info] Settings file : /home/pi/.node-red/settings.js
25 Aug 12:24:39 - [info] Context store : 'default' [module=memory]
25 Aug 12:24:39 - [info] User directory : /home/pi/.node-red
25 Aug 12:24:39 - [warn] Projects disabled : editorTheme.projects.enabled=false
25 Aug 12:24:39 - [info] Flows file : /home/pi/.node-red/flows_Trapped.json
25 Aug 12:24:39 - [info] Server now running at http://127.0.0.1:1880/
25 Aug 12:24:39 - [warn]

#14

The log look looks fine, except that you seem to have stopped copying at a warning message. I would have preferred to see the complete log up to the time it is in a stable running state. Are the messages off the end of interest?

Let me see if I understand. You restart node-red and it doesn't work.
So by doesn't work do you mean that pressing the switch on and off does not appear to change the state of the output pin? How have you checked that the pin is not changing state?
If you have a debug node looking at the switch output then, in the non-working state, does it show it going on and off?
Then you move one of the nodes and re-deploy and it then works? Very odd.
It may not be a factor, and I don't see why initially it would not work and then it would, but I prefer not to use pre-allocated pins for general purpose IO. The Txd pin is the pin used for serial output, so there could be a conflict of use there. I wonder if something else is trying to use the serial port. In order to rule it out then, if you can, I suggest moving to one of the free ports.

#15

Sorry, I thought the log was over at the ---- line.

Here's the full log:

Starting as a systemd service.
Started Node-RED graphical event wiring tool.
25 Aug 12:19:39 - [info]
Welcome to Node-RED

25 Aug 12:19:39 - [info] Node-RED version: v0.19.1
25 Aug 12:19:39 - [info] Node.js version: v8.11.4
25 Aug 12:19:39 - [info] Linux 4.14.62-v7+ arm LE
25 Aug 12:19:40 - [info] Loading palette nodes
25 Aug 12:19:44 - [info] Dashboard version 2.9.6 started at /ui
25 Aug 12:19:44 - [info] Settings file : /home/pi/.node-red/settings.js
25 Aug 12:19:44 - [info] Context store : 'default' [module=memory]
25 Aug 12:19:44 - [info] User directory : /home/pi/.node-red
25 Aug 12:19:44 - [warn] Projects disabled : editorTheme.projects.enabled=false
25 Aug 12:19:44 - [info] Flows file : /home/pi/.node-red/flows_localhost.json
25 Aug 12:19:44 - [info] Creating new flow file
25 Aug 12:19:44 - [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 Aug 12:19:44 - [info] Starting flows
25 Aug 12:19:44 - [info] Started flows
25 Aug 12:19:44 - [info] Server now running at http://127.0.0.1:1880/

You are correct, when I said it's not working I was referring to the video player starting. I did check to make sure it was sending a 0 to the output through a debug node, which it is. It also shows the state of the IO change from 1 to 0.
Yes, then I move one of the nodes and re-deploy then everything works properly (video plays, stops, etc.) Sometimes I need to re-deploy twice to get it to work.
I tried changing the GPIO to another non-pre defined pin and it's still not working.
I thought the python script may be the issue, but everything works properly when I manually trigger the pins.

#16

I think you need to put a meter or led or something on the pin in order to see whether it is the pin not being driven properly or something else.

#17

Hold on, it should not be saying that! That suggests your flow file is empty.
Also it is using a different name for the file. The first time round the log said it was using
Flows file : /home/pi/.node-red/flows_Trapped.json
If that is actually the flow you are using then we need the log from that one, from starting node red, through the failing condition with you exercising the button but nothing happening, and then deploying and it working.