OpenMarine
actions, Execute Command, Displaying a message - Printable Version

+- OpenMarine (http://forum.openmarine.net)
+-- Forum: OpenPlotter (http://forum.openmarine.net/forumdisplay.php?fid=1)
+--- Forum: How do I...? (http://forum.openmarine.net/forumdisplay.php?fid=3)
+--- Thread: actions, Execute Command, Displaying a message (/showthread.php?tid=1759)



actions, Execute Command, Displaying a message - Luckbert - 04-10-2019

Hello, everyone, 
I am currently trying to turn my HDMI screen off and on again with actions. 

Now to my procedure. 
I installed cec-utils first. 
This allows me to put the monitor into standby mode and back into on mode. 
This procedure also works wonderfully in the command line. 

Now I wanted to go one step further and automate it. I connected a motion detector to GPIO 05 which acts as a trigger. 
In SK Diagnose, the motion detector runs up, which means it does what it should. 

Now to my problems: 
I wanted to display a message (for testing) as an action. That doesn't work. But I think the problem has been known for some time because I read it in the search of this problem.

Additionally I wanted to execute a command. 
echo "on 0" | cec-client RPI -s -d 1

respectively

echo "standby 0" | cec-client RPI -s -d 1

But I get the following error when I start OP in debug mode..:

MySK_to_Action_Calc instance has no attribute 'currentpath'
"standby 0" | cec-client RPI -s -d 1

Hangs the problem of looking here see Threat?

Are there ways to solve this?

@jim321  I know that you like to work with node red. I tried it. But I am too stupid. It may be quite easy, but unfortunately not for me.  Confused  

Jürgen


RE: actions, Execute Command, Displaying a message - jim321 - 04-10-2019

try this
Code:
[{"id":"2ed20835.b01408","type":"debug","z":"7a2e0c2e.f262a4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":1320,"wires":[]},{"id":"4e97ba9b.014224","type":"exec","z":"7a2e0c2e.f262a4","command":"echo \"on 0\" | cec-client RPI -s -d 1","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":340,"y":1240,"wires":[["607e9e3f.10853"],["590c09c0.a241c8"],["6798a6be.6cc278"]]},{"id":"787f0dd1.2229e4","type":"exec","z":"7a2e0c2e.f262a4","command":"echo \"standby 0\" | cec-client RPI -s -d 1","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":360,"y":1360,"wires":[["2ed20835.b01408"],["c2680497.ab1d28"],["7aa63046.9e825"]]},{"id":"acc43d34.ac5de","type":"switch","z":"7a2e0c2e.f262a4","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":250,"y":1300,"wires":[["4e97ba9b.014224"],["787f0dd1.2229e4"]]},{"id":"b317bccf.a6b4f","type":"rpi-gpio in","z":"7a2e0c2e.f262a4","name":"pir","pin":"5","intype":"tri","debounce":"25","read":false,"x":90,"y":1240,"wires":[["acc43d34.ac5de"]]},{"id":"c2680497.ab1d28","type":"debug","z":"7a2e0c2e.f262a4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":1360,"wires":[]},{"id":"7aa63046.9e825","type":"debug","z":"7a2e0c2e.f262a4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":1400,"wires":[]},{"id":"607e9e3f.10853","type":"debug","z":"7a2e0c2e.f262a4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":1200,"wires":[]},{"id":"590c09c0.a241c8","type":"debug","z":"7a2e0c2e.f262a4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":1240,"wires":[]},{"id":"6798a6be.6cc278","type":"debug","z":"7a2e0c2e.f262a4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":1280,"wires":[]},{"id":"8a14ba3d.fbc5d8","type":"inject","z":"7a2e0c2e.f262a4","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":1300,"wires":[["acc43d34.ac5de"]]},{"id":"405a25e5.55a68c","type":"inject","z":"7a2e0c2e.f262a4","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":1340,"wires":[["acc43d34.ac5de"]]}]



RE: actions, Execute Command, Displaying a message - Luckbert - 04-10-2019

Hello, Jim, 
Thanks for the code, 
Unfortunately, it's not working. 
after inserting a debug-output you get the following error message

Code:
opening a connection to the CEC adapter...
ERROR:   [            3513]    error opening serial port '1': No such file or directory
ERROR:   [            3513]    could not open a connection (try 1)
ERROR:   [            6347]    error opening serial port '1': No such file or directory
ERROR:   [            6347]    could not open a connection (try 2)
ERROR:   [            8247]    error opening serial port '1': No such file or directory
ERROR:   [            8247]    could not open a connection (try 3)
ERROR:   [            9502]    error opening serial port '1': No such file or directory
ERROR:   [            9502]    could not open a connection (try 4)
unable to open the device on port 1
When I put the command in the terminal, the TV does what it's supposed to do. 

Jürgen


RE: actions, Execute Command, Displaying a message - jim321 - 04-10-2019

see if this fixes it..

sudo npm install serialport --unsafe-perm --build-from-source

i have tested it with inject but i don't have cec-utils installed so the command has nothing to start..but i see the command sent.

i updated the code to include inject debug..


RE: actions, Execute Command, Displaying a message - Sailoog - 04-10-2019

(04-10-2019, 04:42 AM)Luckbert Wrote: Hello, everyone, 
I am currently trying to turn my HDMI screen off and on again with actions. 

Now to my procedure. 
I installed cec-utils first. 
This allows me to put the monitor into standby mode and back into on mode. 
This procedure also works wonderfully in the command line. 

Now I wanted to go one step further and automate it. I connected a motion detector to GPIO 05 which acts as a trigger. 
In SK Diagnose, the motion detector runs up, which means it does what it should. 

Now to my problems: 
I wanted to display a message (for testing) as an action. That doesn't work. But I think the problem has been known for some time because I read it in the search of this problem.

Additionally I wanted to execute a command. 
echo "on 0" | cec-client RPI -s -d 1

respectively

echo "standby 0" | cec-client RPI -s -d 1

But I get the following error when I start OP in debug mode..:

MySK_to_Action_Calc instance has no attribute 'currentpath'
"standby 0" | cec-client RPI -s -d 1

Hangs the problem of looking here see Threat?

Are there ways to solve this?

@jim321  I know that you like to work with node red. I tried it. But I am too stupid. It may be quite easy, but unfortunately not for me.  Confused  

Jürgen

Probably related to the thread you point to.


RE: actions, Execute Command, Displaying a message - Luckbert - 04-10-2019

OK, THEN,

That could explain the problem with the command.



Why are no hints/texts displayed anymore?

Greetings Jürgen

(04-10-2019, 09:50 AM)jim321 Wrote: see if this fixes it..

sudo npm install serialport --unsafe-perm --build-from-source

i have tested it with inject but i don't have cec-utils installed so the command has nothing to start..but i see the command sent.

i updated the code to include inject debug..

Hello, Jim, 
Unfortunately, the changes have not been successful.
Greetings Jürgen


RE: actions, Execute Command, Displaying a message - jim321 - 04-10-2019

i installed cec-utils and get the same errors.
have a look here.
https://flows.nodered.org/node/node-red-contrib-cec
https://groups.google.com/forum/#!topic/node-red/e5-oQC3MTYI

i installed this and it connects to the rpi i dont have a HDMI-CEC device to connect to so thats as far as i can go..
dont give up there's more than one way to skin a cat..

new flow i cant test should work you may need to invert the logic in the change node 0,1.
Code:
[{"id":"3ed98844.9f4d88","type":"inject","z":"7a2e0c2e.f262a4","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":"30","x":90,"y":1420,"wires":[["7bcb905b.62118","9471fb30.731358"]]},{"id":"f9da32a0.4adb","type":"cec-out","z":"7a2e0c2e.f262a4","cec_adapter":"eb129ee.9499a6","name":"RPI HDMI CEC Send","x":500,"y":1460,"wires":[]},{"id":"f5a80d3b.50548","type":"rpi-gpio in","z":"7a2e0c2e.f262a4","name":"","pin":"5","intype":"tri","debounce":"25","read":false,"x":90,"y":1500,"wires":[["9471fb30.731358"]]},{"id":"9471fb30.731358","type":"change","z":"7a2e0c2e.f262a4","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"{\"source\":\"unregistered\",\"target\":\"BROADCAST\",\"opcode\":\"active_source\",\"args\":\"1.0.0.0\"}","tot":"json"},{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"num","to":"{\"source\":null,\"target\":\"0.0.0.0\",\"opcode\":\"STANDBY\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":1460,"wires":[["f9da32a0.4adb","7d204894.0a0c78"]]},{"id":"7d204894.0a0c78","type":"debug","z":"7a2e0c2e.f262a4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":470,"y":1420,"wires":[]},{"id":"2bcc25cf.65a8aa","type":"inject","z":"7a2e0c2e.f262a4","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":"30","x":90,"y":1460,"wires":[["9471fb30.731358"]]},{"id":"eb129ee.9499a6","type":"cec-config","z":"","OSDname":"node-red","comport":"","hdmiport":"1","player":true,"recorder":true,"tuner":true,"audio":true}]



RE: actions, Execute Command, Displaying a message - Luckbert - 04-16-2019

Hello,
@ Jim321
Thank you for your trouble. I couldn't insert your last flow. I don't know why. But it caused me to get a little closer to NodeRed. I managed for the first time to build a partly own flow. Now it works and I am very happy about it. Thank you for your persistence.

@Sailoog
Is it intended to fix the error with the messages in actions or do I prefer to wait for OP 2.x.x?

Greetings Jürgen