Metainformationen zur Seite
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
en:entwickler:grundlagen_zur_erstellung_eines_plugins [2025/01/23 19:05] – 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 ====== | ||
Zeile 7: | Zeile 5: | ||
**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. | ||
+ | |||
+ | 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. | ||
+ | * A configuration file from which your program reads the parameters it needs. | ||
+ | |||
+ | This gives you the true functionality. Now all the details are missing, so the next steps are: | ||
+ | |||
+ | * A web interface to read and write the configuration file | ||
+ | * If necessary, a cronjob to execute your program at intervals | ||
+ | |||
+ | |||
+ | ==== Step 0: Update your LoxBerry to the latest pre-release ==== | ||
+ | |||
+ | This will give you all the bug fixes and new functions on your Raspberry. | ||
+ | |||
+ | ==== 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). | ||
+ | |||
+ | 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 ==== | ||
+ | |||
+ | 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. | ||
+ | |||
+ | ^Folder | ||
+ | |/ | ||
+ | |/ | ||
+ | |/ | ||
+ | |/ | ||
+ | |/ | ||
+ | |/ | ||
+ | |/ | ||
+ | |||
+ | ==== Step 4: Implement function ==== | ||
+ | |||
+ | 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. | ||
+ | |||
+ | For Perl and PHP, include the LoxBerry library LoxBerry:: | ||
+ | |||
+ | **Look through the SDK for your language** - For example, if you need the miniserver configuration from LoxBerry, there is the SDK function get_miniservers. To create log files there is LogBerry:: | ||
+ | |||
+ | ==== Step 5: Implementing the web interface ==== | ||
+ | |||
+ | When your functions are running, develop your web interface for them. | ||
- | * The program that executes the actual function of your plugin. | + | Use the Perl-Lib LoxBerry:: |
- | * A configuration file from which your program reads the parameters it needs. | + | |
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 |
- | Wenn am installierten | + | If your things work reasonably well on the installed |
- | * Kopiere die neuen Programmdateien in das Verzeichnis, | + | * Copy the new program files into the directory from which you initially created the ZIP with the modified |
- | * Wenn während der Installation, | + | * If special steps are required during the installation or during the plugin update, update the install scripts |
- | * Wenn spezielle | + | * If special |
- | ==== Schritt | + | ==== Step 7: Test and continue |
- | //Bevor zu deinen Quellordner neu zippst und installierst, stelle sicher, dass wirklich alle Dateien vom LoxBerry in deiner Quelle am PC sind - während des Updates werden alle Ordner am LoxBerry gelöscht, um diese bei der Installation wieder anzulegen.// | + | //Before you rezip and install your source folder, make sure that all files from the LoxBerry |
- | Danach kannst du die Installation testen. Meist kommt man dabei auf etwaige Fehler | + | You can then test the installation. This usually reveals any errors |
- | ==== Schritt | + | ==== Step 8: Get help ==== |
- | Manche Sachen sind beim ersten Mal ungewöhnlich, deswegen nicht verzweifeln sondern Rat einholen. | + | Some things are unusual the first time, so don't despair but seek advice. |
- | Alle LoxBerry-Plugin-Entwickler schauen regelmäßig im LoxForum in den Entwickler-Bereich für LoxBerry: | + | All LoxBerry |
- | Außerdem betreiben wir eine WhatsApp-Gruppe für LoxBerry-Entwickler, wo das Troubleshooting viel schneller geht. Bitte dafür mit [[https:// | + | We also run a WhatsApp |
- | ==== Schritt | + | ==== Step 9: Public test ==== |
- | Schlussendlich würden wir vorerst deine Alpha/Beta-Version im LoxForum | + | Finally, we would first offer your alpha/beta version in the LoxForum |
- | ===== Empfehlungen | + | ===== Recommendations |
- | ==== Codeverwaltung mit GitHub ==== | + | ==== Code management with GitHub ==== |
- | Mit der Windows-Software | + | With the Windows |
- | Die in LoxBerry | + | LoxBerry's built-in update function for plugins is optimized for GitHub. |