The programs used in the installation. Files are located in the folder belonging to the plant on iServ. The files must then be downloaded to the IOT via FileZilla. As directory we recommend"/home/root", but you can also use any other directory.
The files are:
Attachment.Jar (Java main program) attachment.Settings (settings file for the Java program) main.Py (reading the temperature/humidity sensor, executed by the Java program) anlage.Py (control of the LED bar) status.Txt (auxiliary file for "anlage.Py"; specifies whether the LEDs should be switched on or off) anlage.Txt (auxiliary file for "anlage.Py"; contains the current mode which the LEDs should display; is adapted by the Java program) dns.Py (Set the DNS name server to the IP of the router in the installation. This must be done at every restart to get an internet connection.)
In the settings file are among other things the file paths to the two files "main.Py" and "attachment.Txt" specified. Depending on the directory into which the files have been copied, the setting must be adjusted. By default the directory /home/root/ is assumed.
Changing the settings is done by executing this command in PuTTY:
Java -jar /home/root/plant.Jar settings
This opens an input field, with which the settings file can be adapted.
The possible settings are:
1. Debug mode (Specifies how many outputs should be displayed in the terminal when the Java program is executed. For "false" the expenditure is limited to a minimum.)
2. ID of the plant (This can be used to specify the ID of the plant for simultaneous operation of multiple plants.)
3. Communication port PLC (specifies which port is used for communication with the PLC; the same port must be set in the PLC program)
4. File path Python script sensor (file path to the readout program of the sensor)
5. File path to plant.Txt
6. IP address of the printer (specifies the IP address of the printer that prints the QR codes on the cans in the installation).)
7. Web address of the database server (The main part of the URL of the database server; for the execution of the PHP scripts this URL is taken as a base)
8. Username for database access (username for execution of PHP scripts)
9. Password for database access (password for execution of PHP scripts)
10. E-mail address to be notified (e-mail address that should receive notifications from the system; currently not used)
Finally, it must be ensured that the programs are also executed automatically when the IOT is restarted. This affects "plant.Jar", "plant.Py" and "dns.Py". For this purpose, a new autostart script is created with the following commands:
Now the script is written into the input window, which looks like this in the end:
With the key combination Ctrl+O and then Enter the file can be saved and with the window can be left with Ctrl+X.
To make sure that this script is actually executed when the system is started, these commands are entered into PuTTY:
Chmod 777 /etc/init.D/autostart_plant (Administration of access rights to the script; necessary for the following step)
update-rc.D autostart_plant defaults (Adding the script to the autostart)
In addition, the file "etc/profile be adjusted again. The Java installation path has already been added to the file. Now the following extension is made:
In the two scripts, a helper file ("/home/root/autostart") is used simply to determine whether or not the programs have already been started. The autostart script deletes this file when the IOT is started and then "simulates" a login, which makes the "/etc/profile"-Script is executed. This creates the help file again and starts at the same time the programs that are needed in the system.