Is there a simple way to reboot the "Pi" when an GPIO input contact is closed?
I'm planning on having a "System Reboot" button on the front panel of the completed system and can't seem to find the "CODESYS" way of commanding this as oppose to generating a seperate script on the Pi.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I would like executing a script via "Sys Process Execute Command" or another Function out of the library.
I tried different commands in the .cfg file but it doesnt work.
Could anyone tell me how i can start a script sucessfully?
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The Function in Codesys was "Sys Process Execute command " pzsCommand "switch"
In CODESYSControl.cfg i ve insert : [SysProcess]
/home/pi/switch.sh=switch
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Now again the Beginning:
I made a new script switch.sh, then I set it executeable.
The Script sends a 433 Mhz Signal , GPIO17
On the Raspberry Pi i can execute the Script and the Signal generates sucessfully
I moved my Script "switch.sh" to /usr/bin/ and set up the Codesys Program.
Now i set the Bit START_SCRIPT but nothing happend,
has anyone a idea what went wrong?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If nothing is configured, Sys Execute Command will always fail.
In addition to that, it is also possible to ignore the above white list and allow all commands by: Command=AllowAll
ATTENTION: If Command=AllowAll is set, there is no further verification done, before a command is executed. Please check your security requirements carefully before activating this. For the same reason you should also choose the allowed commands in the list accurately.
Ich habe das Skript unter /usr/bin/ angelegt und ausführbar gemacht!(in Putty funktioniert das skript)
In der CODESYSControl.cfg habe ich folgende Einträge gemacht [SysProcess]
Command=AllowAll
Command.0=cs_mail
Der Aufruf in Codesys sieht so aus
IF (xSendMail) THEN
_('cs_mail' , ADR(Result) );
xSendMail:=FALSE;
END_IF
Result ist nach dem Ausführen auf 25
Was mache ich falsch?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I know its an older thread and it was helping me a lot, but in my case when pi reboots all my data are lost. How was it in your case or do you know how to solve such an issue?
BR
Erwin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Offtopic!
But: To retain the variables, the variables have to be declared as retain ;-) and are only reliable saved, if the system process "shutdown/reboot" is used.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good Morning,
Is there a simple way to reboot the "Pi" when an GPIO input contact is closed?
I'm planning on having a "System Reboot" button on the front panel of the completed system and can't seem to find the "CODESYS" way of commanding this as oppose to generating a seperate script on the Pi.
Hi,
you need to do the following steps:
1. Pi side
add the section and command which you want to execute in CODESYSControl.cfg (this is under /etc)
See Screenshot config.jpg
In CODESYS Library Manager you need to add Sysprocess.library and SysTypes.library
See screenshot reboot.jpg - how to execute it in CODESYS:
Thats it!
BR
Edwin
You are the man Edwin.
Cheers!
Hello,
I would like executing a script via "Sys Process Execute Command" or another Function out of the library.
I tried different commands in the .cfg file but it doesnt work.
Could anyone tell me how i can start a script sucessfully?
Thanks!
Hi, which command did you add to the config and what do you call in the codesys code exactly?
Regards plcmax
The Function in Codesys was "Sys Process Execute command " pzsCommand "switch"
In CODESYSControl.cfg i ve insert :
[SysProcess]
/home/pi/switch.sh=switch
Hi,
for me the solution was to move my script 'script_run' to /usr/bin
and in the CODESYSControl.cfg you enable it by
[SysProcess]
Command.0=script_run
In Codesys I call it by:
Regards
plcmax
Thanks plcmax!
Now again the Beginning:
I made a new script switch.sh, then I set it executeable.
The Script sends a 433 Mhz Signal , GPIO17
On the Raspberry Pi i can execute the Script and the Signal generates sucessfully
I moved my Script "switch.sh" to /usr/bin/ and set up the Codesys Program.
Now i set the Bit START_SCRIPT but nothing happend,
has anyone a idea what went wrong?
Hi,
either call 'script.sh' in CODESYS or rename your script in /usr/bin to script
you could check if the script is executed with cat /tmp/codesyscontrol.log
BR
Edwin
Thanks a lot!!!
Finally it works i think i was mentally blocked...
How easy
->Solved
Hi,
may I ask what exactly you are realize with the 433 Mhz Signal on GPIO17?
BR
Edwin
If nothing is configured, Sys Execute Command will always fail.
In addition to that, it is also possible to ignore the above white list and allow all commands by: Command=AllowAll
ATTENTION: If Command=AllowAll is set, there is no further verification done, before a command is executed. Please check your security requirements carefully before activating this. For the same reason you should also choose the allowed commands in the list accurately.
[SysProcess]
Command=AllowAll
Command.0=script_run
Command.1=reboot
Habe ein Problem bekomme immer 25 als rückgabe von Result
Hallo,
was hast du in der CODESYSControl.cfg eingetragen und welches Kommando
rufst du denn auf in Codesys?
Grüße
plcmax
Ich habe das Skript unter /usr/bin/ angelegt und ausführbar gemacht!(in Putty funktioniert das skript)
In der CODESYSControl.cfg habe ich folgende Einträge gemacht
[SysProcess]
Command=AllowAll
Command.0=cs_mail
Der Aufruf in Codesys sieht so aus
IF (xSendMail) THEN
_('cs_mail' , ADR(Result) );
xSendMail:=FALSE;
END_IF
Result ist nach dem Ausführen auf 25
Was mache ich falsch?
Hallo
hast du das script mit dem gleichen User und Rechten über Putty ausgeführt wie codesys es ausführt?
MFG
McBain
Hi, I know its an older thread and it was helping me a lot, but in my case when pi reboots all my data are lost. How was it in your case or do you know how to solve such an issue?
BR
Erwin
Offtopic!
But: To retain the variables, the variables have to be declared as retain ;-) and are only reliable saved, if the system process "shutdown/reboot" is used.