Documentation – RevPiPyLoad

This component is installed on the Revolution Pi Core.

By installing via dpkg or apt-get, the daemon is automatically integrated into the init/systemd system of Linux and starts automatically with the system start.

The default configuration attempts to start a Python3 program called “program.py” in the /var/lib/revpipyload directory.  The XML-RPC server is disabled (NOTICE AT THE END OF THE PAGE !!!).

Daemon restart / Stop / Load configuration

If changes (as described below) are made, they must be applied by RevPiPyLoad. This can be easily done via the shell:

# start daemon
pi@RevPi ~ $ sudo service revpipyload start

# stop daemon
pi@RevPi ~ $ sudo service revpipyload stop

# reload settings
pi@RevPi ~ $ sudo service revpipyload reload

# restart daemon
pi@RevPi ~ $ sudo service revpipyload restart
Change Settings

All settings are made in /etc/revpipyload/revpipyload.conf. To edit, you can simply open it in an editor, eg:

pi@RevPi ~ $ sudo nano /etc/revpipyload/revpipyload.conf

Parameters in DEFAULT section:

  • autoreload=1
    Automatically restarts the Python program when it is finished, whether by crash or because it has gone through.  NOTE: Python programs should run continuously and do not complete a task, exit and then being restarted by RevPiPyLoad!
  • autoreloaddelay=5
    Delay to restart the Python program
  • autostart=1
    Starts the Python program automatically when the RevPi core system starts
  • plcworkdir=/var/lib/revpipyload
    Base directory for the Python program. The program, all related files and subfolders must be stored here.
  • plcprogram=program.py
    This program is being started through RevPiPyLoad.
  • plcarguments=
    Arguments to pass to the Python Program at startup
  • plcuid=1000
    User ID for Python program authorization. The user pi has the UID 1000 and usually enough privileges to run the program. If root permissions are required, the value 0 can be specified here.
  • plcgid=1000
    Group ID for authorization of the Python program. The user pi has the GID 1000. If root permissions are required, the value 0 can be specified here.
  • pythonversion=3
    Python version to start your python program
  • zeroonerror=0
    If 1, the process image is overwritten with \ x00 bytes at Python program crash to set all outputs to NULL.  NOTE: We recommend setting this parameter to 1!
  • zeroonexit=0
    If 1, the process image is overwritten with \ x00 bytes when the python program is terminated (exitcode = 0) to set all outputs to NULL
Parameters in PLCSLAVE section:

  • plcslave=0
    This parameter determines whether the process image server for RevPiModIO (RevPiNetIO(...), RevPiNetIOSelected(...), RevPiNetIODriver(...)) is activated. By setting to 1 a connection from other computers via RevPiModIO is possible (note aclplcslave.conf file!)
  • aclfile=/etc/revpipyload/aclplcslave.conf
    Specifies the file name from which to read the permissions for IP addresses.
    These authorizations control access to the process image.
    ONE access definition PER LINE: IPADDRESS,RIGHT

    • IPADDRESS
      Single IP address or groups defined with wildcards:
      192.168.178.10 -> Only one computer
      192.168.178. * -> All computers where the IP starts with 192.168.178.
    • RIGHT
      0 = read only
      1 = read and write
    # PLC-SLAVE Access Control List (acl)
    # One entry per Line IPADRESS,LEVEL
    #
    
    # All computers in the 192.168.178.0/24 net can read the IOs
    192.168.178.*,0
    
    # The computer 192.168.178.10 can read and write the IOs
    192.168.1.20,1

NOTE: If an IP address attempts to access without authorization (no matter if read only or read / write), the connection will be rejected immediately!

  • bindip=*
    Specifies the IP to which the process image server is to be bound. This can be useful if the RevPi has several IPs and the process image should only to be reached from one network.
    If you want to bind the process image server to all IPs, enter *.
  • port=55234
    Specifies the port on which the process image server listen
Parameters in XMLRPC section:

  • xmlrpc=0
    Enables 1 or disables 0 the XML-RPC server. This is required if RevPiPyLoad should be controlled via the graphical tool RevPiPyControl
    (note aclxmlrpc.conf file!)
  • aclfile=/etc/revpipyload/aclxmlrpc.conf
    Specifies the file name from which to read the permissions for IP addresses.
    These authorizations control access to the RevPiPyLoad via RevPiPyControl.
    ONE access definition PER LINE: IPADDRESS,RIGHT

    • IPADDRESS
      Single IP address or groups defined with wildcards:
      192.168.178.10 -> Only one computer
      192.168.178. * -> All computers where the IP starts with 192.168.178.
    • RIGHT
      0: Start/Stop PLC program and read logs
      1: all from 0 + read IOs in watch modus
      2: all from 1 + read properties and download PLC program
      3: all from 2 + upload PLC program an write IOs in watch modus
      4: all from 3 + set properties of RevPiPyLoad
    # XML-RPC Access Control List (acl)
    # One entry per Line IPADRESS,LEVEL
    #
    
    # All computers in the 192.168.178.0/24 net can read log files and start/stop the plc program
    192.168.178.*,0
    
    # The computer 192.168.178.20 has access to all features and settings
    192.168.178.10,4

NOTE: If an IP address attempts to access without authorization (no matter if read only or read / write), the connection will be rejected immediately!

  • bindip=*
    Specifies the IP to which the XML-RPC server is to be bound. This can be useful if the RevPi has several IPs and RevPiPyLoad should only to be reached from one network.
    If you want to bind the process image server to all IPs, enter *.

 

Logging

In addition to the log file for the Python program, RevPiPyLoad creates its own. It can monitor output from the daemon. The level of logging can be changed via the file /etc/default/revpipyload.

pi@RevPi ~ $ sudo nano /etc/default/revpipyload

By adding -v, the log output can be increased:

DAEMON_ARGS="-d"
# ändern in
DAEMON_ARGS="-d -v"

 

NOTE: The XML-RPC interface is only for the local network! It may NEVER be used over the Internet because the transmission is not encrypted. There are also no authentication options yet!  Theoretically, with xmlrpc value 3 EVERYONE in the network can load software on the device!  For productive use the xmlrpc value MUST be less than 3!

QUESTION: Why is there no encryption and authentication?  The RevPiPyPlc system has been developed for the development phase of controllers with the programming language Python – also in connection with our RevPiModIO module. Programs should be transferred quickly to the system and, above all, the runtime behavior can be monitored.

The primary focus of the system is monitoring the actual Python program. Log its outputs, log errors, and make sure the Python program is running! But (still) not to do everything from anywhere over the network.

Depending on the feedback from the community, we will include such functions 😀