Metainformationen zur Seite
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
en:entwickler:grundlagen_zur_erstellung_eines_plugins [2025/01/23 19:00] – angelegt Brave | en:entwickler:grundlagen_zur_erstellung_eines_plugins [2025/01/23 19:36] (aktuell) – Completely translated page Brave | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | FIXME **Diese Seite wurde noch nicht vollständig übersetzt. Bitte helfen Sie bei der Übersetzung.**\\ //(diesen Absatz entfernen, wenn die Übersetzung abgeschlossen wurde)// | ||
- | |||
====== Basics for creating a plugin ====== | ====== Basics for creating a plugin ====== | ||
{{entwickler: | {{entwickler: | ||
- | **If you understand how this code works, you can develop a LoxBerry plugin! | + | **If you understand how this code works, you can develop a LoxBerry plugin!** |
Developing LoxBerry plugins is not too difficult for anyone who has ever scripted or programmed anything. Conveniently, | Developing LoxBerry plugins is not too difficult for anyone who has ever scripted or programmed anything. Conveniently, | ||
- | Some LoxBerry plugins, for example, have emerged from already existing scripts or programs from the Internet, which primarily required a web interface for the configuration of these scripts. | + | Some LoxBerry plugins, for example, have emerged from already existing scripts or programs from the Internet, which primarily required a web interface for the configuration of these scripts. |
If you are planning a plugin for the first time, break down the development into the following parts: | If you are planning a plugin for the first time, break down the development into the following parts: | ||
- | * The program that executes the actual function of your plugin. | + | * The program that executes the actual function of your plugin. |
* A configuration file from which your program reads the parameters it needs. | * A configuration file from which your program reads the parameters it needs. | ||
Zeile 20: | Zeile 18: | ||
* A web interface to read and write the configuration file | * A web interface to read and write the configuration file | ||
* If necessary, a cronjob to execute your program at intervals | * If necessary, a cronjob to execute your program at intervals | ||
+ | |||
==== Step 0: Update your LoxBerry to the latest pre-release ==== | ==== Step 0: Update your LoxBerry to the latest pre-release ==== | ||
Zeile 27: | Zeile 26: | ||
==== Step 1: Create plugin directory ==== | ==== Step 1: Create plugin directory ==== | ||
- | Start by downloading (not installing!) the sample plugin and unpacking it on your PC. It contains Perl or PHP code, but any language can be used for the implementation. Perl and PHP have the advantage that LoxBerry offers an SDK for this, which makes many tasks easier (e.g. creating the web interface or reading the LoxBerry configuration and creating log files). | + | Start by downloading (not installing!) the sample plugin and unpacking it on your PC. It contains Perl or PHP code, but any language can be used for the implementation. Perl and PHP have the advantage that LoxBerry offers an SDK for this, which makes many tasks easier (e.g. creating the web interface or reading the LoxBerry configuration and creating log files). |
- | ==== Step 2: customize plugin.cfg ==== | + | In your copy of the sample plugin, adjust the name of the plugin, author, version number, etc. By changing this data, it is now **your** plugin. |
- | + | ||
- | In your copy of the sample plugin, adjust the name of the plugin, author, version number, etc. | + | |
- | + | ||
- | By changing this data, it is now **your** plugin. | + | |
==== Step 3: Install your plugin ==== | ==== Step 3: Install your plugin ==== | ||
- | Zip the directory and install it on the LoxBerry. Ignore any installation errors - these come from the sample data of the sample plugin and can be corrected later. | + | Zip the directory and install it on the LoxBerry. Ignore any installation errors - these come from the sample data of the sample plugin and can be corrected later. |
- | + | ||
- | You will then find your plugin in the plugin administration. | + | |
- | + | ||
- | LoxBerry has created directories corresponding to the name of your plugin on the Raspberry. | + | |
- | + | ||
- | ^Folder | + | |
- | |/ | + | |
- | |/ | + | |
- | |/ | + | |
- | |/ | + | |
- | |/ | + | |
- | |/ | + | |
- | |/ | + | |
+ | ^Folder | ||
+ | |/ | ||
+ | |/ | ||
+ | |/ | ||
+ | |/ | ||
+ | |/ | ||
+ | |/ | ||
+ | |/ | ||
==== Step 4: Implement function ==== | ==== Step 4: Implement function ==== | ||
Zeile 57: | Zeile 47: | ||
Decide whether the function of your plugin should be triggered time-controlled or via a web call. | Decide whether the function of your plugin should be triggered time-controlled or via a web call. | ||
- | | + | * Time-controlled: |
- | * Web call: Develop your program in your webfrontend/ | + | |
+ | |||
Program your functionality and use a config file in your config directory for everything that should later be customizable by the user on the web. | Program your functionality and use a config file in your config directory for everything that should later be customizable by the user on the web. | ||
Zeile 68: | Zeile 58: | ||
==== Step 5: Implementing the web interface ==== | ==== Step 5: Implementing the web interface ==== | ||
- | When your functions are running, develop your web interface for them. | + | When your functions are running, develop your web interface for them. |
Use the Perl-Lib LoxBerry:: | Use the Perl-Lib LoxBerry:: | ||
Zeile 74: | Zeile 64: | ||
Use readlanguage (Perl, PHP) to offer alternative languages for your plugin. | Use readlanguage (Perl, PHP) to offer alternative languages for your plugin. | ||
- | ==== Schritt | + | ==== Step 6: Customize installation |
+ | |||
+ | If your things work reasonably well on the installed LoxBerry, update your plugin package: | ||
- | Wenn am installierten LoxBerry deine Sachen halbwegs funktionieren, aktualisiere dein Plugin-Paket: | + | * Copy the new program files into the directory from which you initially created the ZIP with the modified plugin.cfg. |
+ | * If special steps are required during the installation or during the plugin update, update the install scripts in this directory (e.g. save the config during the update) | ||
+ | * If special Debian packages are required for your plugin, update the apt file in the apt folder and add the package names there. | ||
- | * Kopiere die neuen Programmdateien in das Verzeichnis, | + | ==== Step 7: Test and continue ==== |
- | * Wenn während der Installation, | + | |
- | * Wenn spezielle Debian-Pakete für dein Plugin nötig sind, aktualisiere im Ordner apt das apt-File und füge dort die Paketnamen ein. | + | |
- | ==== Schritt 7: Testen und weitermachen ==== | + | //Before you rezip and install your source folder, make sure that all files from the LoxBerry are really in your source on the PC - during the update, all folders on the LoxBerry are deleted in order to recreate them during the installation.// |
- | //Bevor zu deinen Quellordner neu zippst und installierst, | + | You can then test the installation. This usually reveals any errors in the installation scripts. You can then test everything |
- | Danach kannst du die Installation testen. Meist kommt man dabei auf etwaige Fehler in den Installationsscripten drauf. Du kannst danach alles so durchtesten, | + | ==== Step 8: Get help ==== |
- | ==== Schritt 8: Hilfe holen ==== | + | Some things are unusual the first time, so don't despair but seek advice. |
- | Manche Sachen sind beim ersten Mal ungewöhnlich, | + | All LoxBerry plugin developers regularly check the LoxForum in the developer area for LoxBerry: |
- | Alle LoxBerry-Plugin-Entwickler schauen regelmäßig im LoxForum in den Entwickler-Bereich für LoxBerry: https://www.loxforum.com/forum/projektforen/loxberry/ | + | We also run a WhatsApp group for LoxBerry |
- | Außerdem betreiben wir eine WhatsApp-Gruppe für LoxBerry-Entwickler, | + | ==== Step 9: Public test ==== |
- | ==== Schritt 9: Öffentlicher Test ==== | + | Finally, we would first offer your alpha/beta version in the LoxForum for testing (with a corresponding disclaimer that it is still alpha). Once the major problems have been resolved, you should create and document your new plugin in the LoxWiki. Do it like the other plugin authors do. |
- | Schlussendlich würden wir vorerst deine Alpha/ | + | ===== Recommendations ===== |
- | ===== Empfehlungen ===== | + | ==== Code management with GitHub |
- | ==== Codeverwaltung mit GitHub | + | With the Windows software |
- | Mit der Windows-Software | + | LoxBerry' |
- | Die in LoxBerry eingebaute Update-Funktion für Plugins ist für GitHub optimiert. | ||