Whats New in V2.2.1

Konkrete Version: 2.2.1.2 RELEASE

Für Benutzer | For users

Notfall-Webserver | Emergency Webserver

Im Falle, dass der normale Webserver "Apache" nicht mehr funktionert, läuft nun standardmäßig ein "Mini-Webserver" für den Notfall auf Port 64995 (http://loxberry:64995). 

Der Notfall-Webserver zeigt den Status des letzten LoxBerry Selbsttests, und man kann ad hoc einen Selbsttest ausführen lassen, sowie einen Reboot durchführen.

Zusätzlich wurde das normale Webinterface verändert, sodass eine volle RAM-Disk nicht sofort das Webinterface außer Gefecht setzt.


If the normal webserver "Apache" fails to load, another mini webserver, called the "Emergency Webserver", is listening to port 64995 (http://loxberry:64995).

The Emergency Webserver displays the status of the last LoxBerry Healthcheck, and can run an ad hoc Healthcheck on demand. It additionally allows to reboot your LoxBerry.

Furthermore, we changed the normal web interface that a full ram disk does not stall our web interface anymore.

Fremde Logdateien werden verkleinert statt gelöscht | Foreign logfiles get shrinked instead of deleted

Eine Ursache, dass immer wieder mal die RAM-Disk durch Drittapplikationen voll wurde, haben wir (hoffentlich!) adressiert. Durch das bisherige Löschen von großen Log-Dateien (z.B. von FHEM) während des Betriebs dieser Dienste blieben diese Logs als versteckte "Leichen" liegen und belegten weiterhin Platz. Mit der Änderung, dass wir diese Dateien nun nicht mehr löschen, sondern verkleinern, sollte bei vielen Benutzern das Problem der vollen RAM-Disk gelöst sein.


One cause of full ram disks we could (hopefully!) address. Deleting large logfiles of services like FHEM during run-time created ghosts that still used the ram-disk space. We changed that to now shrink that files, so many users should have got fixed the "full ram-disk" issue.      

Read-Only Filesystem

Bereits in Version 2.2 haben wir eine potentielle Ursache für den Fehler "Read-Only filesystem" (und damit Folgefehler wie nicht richtig funktionierende Plugins) behoben. Meist passierte das, wenn jemand den Raspberry ohne Herunterfahren einfach ausgesteckt hat. 

In LB 2.2.1 haben wir dies weiter optimiert. Wird beim Boot ein Read-Only Datenträger erkannt, wird zuerst die aktuelle Datenträger-Konfigurations-Datei fstab geprüft. Bei einem Fehler (oder nicht Vorhandensein) wird ein bereits existierendes Backup dieser Datei wiederhergestellt. Sollte auch das Backup fehlerhaft sein, wird eine Standard-Datei für den Raspberry erzeugt. Im Webinterface macht sich dies dadurch bemerkbar, dass LoxBerry dich um einen unverzüglichen Reboot bittet, um die Korrektur abzuschließen.

Wenn alle Schritte nicht erfolgreich sind, ist das Dateisystem wahrscheinlich endgültig defekt.


In LoxBerry 2.2 we already fixed a potential issue that could have caused "Read-Only filesystem" (and follow-up issues non-working plugins). Usually that happened, if Raspberry was powered of without regular shutdown.

In LB 2.2.1 we have further optimized this by some kind of auto-recovery function. If a read-only device is detected at boot time, the filesystem configuration file fstab is first checked for existcnce and validity. On error of this check, an existing fstab backup will be restored. If the backup also is invalid, a default fstab file for Raspberry's will be created. You'll get in touch with this auto-recovery, as the web interface will ask you to do an immediate reboot to finish this process.

Wenn du drei oder mehr Miniserver in LoxBerry eingerichtet hast, kannst du mit Links am Seitenanfang jetzt direkt zu diesen Miniservern springen. Wenn du 10 oder mehr Miniserver hast (wer hat das nicht?  ), wird die Miniserverliste jetzt richtig sortiert.


If you have three or more Miniservers defined in LoxBerry, you now can directly jump to these with links at the top. Furthermore, if you have 10 or more Miniservers (who has not?  ), they are now correctly sorted. 

Netzwerk-Freigaben: Serverliste | Netshares widget: Server list

Im Netzwerk-Freigaben Widget werden jetzt oben klarer die bereits konfigurierten Server und eingerichteten Benutzer angezeigt. Außerdem haben wir den Durchsuchen-Button in der Freigabe-Liste gefixt.


The Netshares widget now shows clearly the configured servers and users. Besides, we have fixed the Browse-Button in the Shares list. 

Weitere Korrekturen und Verbesserungen (English below)

  • USB Datenträger: Bei großen Festplatten wurden die Speicherplatz-Infos nicht richtig ausgelesen. Das wurde nun korrigiert.
  • Der yarn-Key (yarn ist ein Paket-Installer von Node.js) wird jetzt regelmäßig automatisch aktualisiert. yarn hat immer wieder mal eine Warnung wegen eines abgelaufenen Keys während der Plugin-Installation geworfen.
  • Das Ausführen von Plugin-Installationen und LoxBerry Update wird nun auch dann verhindert, wenn im Hintergrund gerade Linux-Sicherheits-Updates eingespielt werden. Das erkennst du am roten Kreisel in der Fußzeile.  Gerade nach einer Neuinstallation von LoxBerry hat das gleichzeitige Laufen von Linux-Updates und einer Plugin-Installation zu Fehlern geführt.
  • Die LoxBerry Healthcheck-Information, die vom Miniserver per HTTP abgerufen werden kann, wird nun auch nach dem LoxBerry-Neustart aktualisiert. Bislang war diese Information nach einem Neustart erst beim nächsten täglichen Lauf wieder verfügbar. 

Further fixes and improvements (English)

  • USB storage: On bigger disks, the free and used diskspace infos were scrambled. This is fixed now.
  • The yarn key (yarn is a package installer of Node.js) had thrown warnings during plugin installations because the key was expired. We fixed this by regularly updating the yarn key.
  • Plugin installations and LoxBerry Update now is also prevented during Linux is updating security patches in the background. In some situations, the background updates of Linux prevented a successful installation/update of plugins and LoxBerry. You'll see background updates now also with the red "spinner" in the footer .
  • LoxBerry Healthcheck informations are now updated also after a reboot of LoxBerry. Until now, no information was available up to the time of the daily healthcheck. 

LoxBerry XL - EXtended Logic

XL-Logo-Version-2.png?version=1&modificationDate=1583261899000&api=v2

  • Fix: Bei MQTT hat das Retain-Flag nicht funktioniert.

Schau dir LoxBerry XL an → LoxBerry XL - EXtended Logic


  • Fix: On MQTT, the retain flag did not work.

Check out LoxBerry XL → LoxBerry XL - EXtended Logic (sorry, currently German documentation only)

For developers

Startup behaviour of daemons and cronjobs

Especially on testing with virtual machines, we could recognize that cronjobs may start before the disk layout (especially the log folders) were finally prepared. Also the daemon startup of one plugin could delay or even totally freeze the startup of other plugin daemons.

Therefore we optimised:

  • All cronjobs in the prepared folders (cron.reboot, cron.01min,…) now will wait until all system and plugin mountpoints and log folders are fully prepared. This does only apply to LoxBerry‘s prepared folders (cron.reboot, cron.01min, cron.daily,…) , not normal crontab files in cron.d!
  • All cronjobs are now started in parallel, instead of one plugin cronjob by one plugin cronjob
  • Cronjobs do not need to have no file extension anymore, so now it is allowed to have a runme.sh or a dothat.php inside the cron folders. The shebang still needs to be set in the script.
  • All deamon scripts are now run in parallel, with 1 second delay each.

MQTT Gateway sneaks into LoxBerry-Core (step 3 of ?)

Slowly but steady, the MQTT Gateway plugin is migrated into LoxBerry-Core. In LoxBerry 2.0, the first functions arrived at LoxBerry-Core with mqtt_connectiondetails (Perl, PHP) and mqtt libraries for Perl and PHP. In this Release, you'll find some further, useful mqtt functions to easify the communication to mqtt. Still, MQTT Gateway plugin is required for LoxBerry::IO's / loxberry_io.php's mqtt functions.

Starting with MQTT Gateway 2.0 Release, developers of other languages (Python, Node.js,…) don't need to do somersaults aquiring the mqtt connection settings from MQTT Gateway's folders/files. They are now directly stored in LoxBerry's general.json.

MQTT Gateway plugin has many documented interfaces in use by users and other plugins, and we won't break any of these with the migration to LoxBerry-Core. Therefore, migration is a process that needs time and is done step-by-step.  

MQTT: Publish messages in one line: LoxBerry::IO / loxberry_io.php (Perl, PHP)

Inspired from LoxBerry XL, four new features are included in LoxBerry 2.2.1 for both Perl and PHP:

Perl: LoxBerry::IO::mqtt_publish/mqtt_retain/mqtt_set and LoxBerry::IO::mqtt_get
PHP: mqtt_publish/mqtt_retain/mqtt_set and mqtt_get

mqtt_publish($topic, $value)
mqtt_retain($topic, $value)
mqtt_set($topic, $value, $retain)
mqtt_get($topic)

There is no need to first aquire mqtt broker settings somewhere and do connection things - as this is done in-place from the MQTT Gateway broker settings from the user, and completely and fully integrated inside of the functions.

So
use LoxBerry::IO; / require_once "loxberry_io.php";
mqtt_publish("to/my/topic", "my value");

will directly publish that value.

MQTT: Easy mqtt connection with Net::MQTT::Simple (Perl) and Bluerhinos/phpMQTT (PHP)

LoxBerry::IO::mqtt_connect (Perl), mqtt_connect (PHP)

$mqtt = mqtt_connect(); 

will automatically create an mqtt object and connect to the broker set in MQTT Gateway without any connection and user/password handling.

In Perl, the $mqtt object is from Net::MQTT::Simple.

In PHP, the $mqtt object is from the Bluerhinos phpMQTT object class. 

Both libraries are included with LoxBerry. 

MQTT: mqtt_connectiondetails (Perl, PHP)

LoxBerry::IO::mqtt_connectiondetails (Perl), mqtt_connectiondetails (PHP)

  • In the returning hash/array the broker websocketport was added. 
  • Perl: If MQTT Gateway was not installed, the mqtt_connectiondetails function had thrown an exception. Now, the function returns undef as designed in that situation.

LoxBerry::IO::mshttp_call2 (Perl)

LoxBerry::IO::mshttp_call2

Based on the function mshttp_call we did a major rework of the http function with added functionality for requests to the Miniserver.

The new mshttp_call2 function fully is compatible to /jdev/ requests (including considering UTF8), with new options for request timeouts and the possibility to directly write the response to a file.

It better parses http response codes and generates success/error messages.

For easy http API calls to IOs, you still should prefer mshttp_send_mem and mshttp_get, but for access to other APIs beside /dev/sps/io/ with full access to the response, you should prefer mshttp_call2 instead.  

LoxBerry::System::write_file (Perl)

LoxBerry::System::write_file

According to the already existing function read_file, there is now also a write_file

Changes and enhancements for LoxBerry::JSON (Perl)

LoxBerry::JSON full documentation

  • If LoxBerry::JSON fails to load a json because the content is invalid, the class now fails with an exception. Before, this was silently ignored. Non-existing or empty json files continue to be correctly handled without exception.
  • LoxBerry::JSON will now always do shared file-locks on reading, and exclusive file-locks on writing.
  • New features:
    • Parameter lockexclusive => 1:  This will exclusively lock the file from opening to closing. Therefore, you can lock the file exclusive, read the content, handle the content and write it back. No other process can open the file during your exclusive lock. This is important on any parallel threads or scripts processing the same json file.
    • Parameter locktimeout => <seconds> : If a locktimeout is given (this is not depending to lockexclusive!), LoxBerry::JSON will wait until the locktimeout to get the file-lock. After the timeout, the function will return undef, if the lock could not be set. Without the parameter, a failed lock will return undef immediately.

Further fixes and improvements

  • The Log Viewer is now also allowed to show logfiles from the plugin's data folder. As the log folder is cleared on a reboot, this satisfies the requirement, that some logs should survive a reboot. 
  • The shipped default file mail.json.default had invalid json. In case that your mail.json was lost for some reason, your new mail.json generated from mail.json.default was invalid. 
  • Updated PHP Bluerhinos\phpMQTT library

Pre-Announcement for deprecation

In some of the next LoxBerry minor releases, the Perl LoxBerry::System library will not auto-use Config::Simple anymore. If you use Config::Simple in your Perl code, and it does not explicitly have a use Config::Simple; on the top, please add this line. (The Config::Simple library itself will stay on LoxBerry of course!)


Commit Log: https://github.com/mschlenstedt/Loxberry/compare/2.2.0.5...2.2.1