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

Parameter:

  • 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!
  • autostart=1
    Starts the Python program automatically when the RevPi core system starts
  • 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.
  • 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.
  • 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 the parameter plcslaveacl!)
  • plcslaveacl=This parameter controls access to the process image.
    The value has the following syntax: IPADDRESS,RIGHT
    (several of these permissions are separated by a space)

    • 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

    Example: plcslaveacl = 192.168.178.*,0 192.168.178.10,1
    All computers in the network 192.168.178.xxx have read access, the computer with IP 192.168.178.10 has read and write access.

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

  • pythonversion=3
    Python Version with which the Python program is being executed.
  • xmlrpc=0
    Mode for the XML-RPC-Server:
    0 = Deactivated
    1 = Python Program start/stop and read logfile
    2 = 1 + Download program archive and piCtory configuration
    3 = 2 + Upload program archive and piCtory configuration
  • xmlrpcport=55123
    Port via which the XML-RPC server can be reached (never set less than 1024)
  • 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

For the use of RevPiPyControl an xmlrpc value of min. 1 is required. These settings can also be changed via the graphical interface, if the xmlrpc value is 3.

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 😀