Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[Nextcloud] Docker update 30.0.11 to 31.0.5 – Encryption issues / MariaDB ROW_FORMAT=Dynamic

Today I updated to the latest Nextcloud docker container, as there were massive problems with the encryption app in previous versions. User couldn’t login and file versions could not be opened… Read more about it in the following two issues:

https://github.com/nextcloud/server/issues/51066
https://github.com/nextcloud/server/issues/52161

Allthough some users reported, that they still have issues, I tried the latest version. Luckily, in my case the update finished without issues and it solved all my problems related to the encryption app.

After the update, I got the usual warnings that I have to run some occ commands:

docker exec --user www-data nextcloud-app php occ db:add-missing-indices
docker exec --user www-data nextcloud-app php occ maintenance:repair --include-expensive

But then there was also a very long warning:

Falsches Zeilenformat in deiner Datenbank gefunden. ROW_FORMAT=Dynamic bietet die beste Datenbankleistung für Nextcloud. Bitte aktualisiere das Zeilenformat in der folgenden Liste: oc_richdocuments_template, oc_direct_edit, oc_flow_operations, oc_migrations, oc_talk_sessions, oc_circles_remote, oc_circles_member, oc_trusted_servers, oc_richdocuments_direct, oc_directlink, oc_talk_invitations, oc_cards, oc_filecache, oc_oauth2_clients, oc_storages_credentials, oc_login_flow_v2, oc_group_admin, oc_files_trash, oc_deck_labels, oc_deck_stacks, oc_ocsms_sendmessage_queue, oc_weather_city, oc_collres_collections, oc_jobs, oc_deck_assigned_users, oc_phonetrack_points, oc_deck_cards, oc_ldap_group_mapping_backup, oc_ocsms_config, oc_mail_mailboxes, oc_accounts, oc_twofactor_providers, oc_calendarchanges, oc_gpodder_subscriptions, oc_appconfig, oc_mail_coll_addresses, oc_polls_notif, oc_calendarobjects, oc_addressbookchanges, oc_calendars, oc_twofactor_totp_secrets, oc_user_status, oc_talk_internalsignaling, oc_vcategory_to_object, oc_dav_cal_proxy, oc_calendar_resources, oc_talk_commands, oc_mail_message_tags, oc_authtoken, oc_polls_log, oc_ocsms_smsdatas, oc_phonetrack_proxims, oc_share, oc_text_steps, oc_polls_preferences, oc_preferences, oc_weather_config, oc_twofactor_backupcodes, oc_circles_circle, oc_deck_boards, oc_webauthn, oc_federated_reshares, oc_activity, oc_mimetypes, oc_collres_resources, oc_notifications, oc_mail_classifiers, oc_notes_meta, oc_schedulingobjects, oc_circles_mount, oc_circles_membership, oc_talk_attendees, oc_news_folders, oc_deck_assigned_labels, oc_mail_aliases, oc_oauth2_access_tokens, oc_phonetrack_geofences, oc_news_items, oc_polls_options, oc_filecache_extended, oc_phonetrack_pubshares, oc_news_feeds, oc_groups, oc_text_documents, oc_files_lock, oc_polls_polls, oc_calendarsubscriptions, oc_text_sessions, oc_whats_new, oc_phonetrack_shares, oc_onlyoffice_filekey, oc_polls_share, oc_calendar_reminders, oc_bruteforce_attempts, oc_share_external, oc_systemtag_object_mapping, oc_systemtag, oc_cards_properties, oc_calendar_rooms, oc_talk_bridges, oc_mail_attachments, oc_polls_comments, oc_storages, oc_ocsms_user_datas, oc_flow_operations_scope, oc_calendar_rooms_md, oc_richdocuments_assets, oc_calendarobjects_props, oc_phonetrack_sessions, oc_mail_local_messages, oc_comments_read_markers, oc_calendar_appt_configs, oc_calendar_invitations, oc_richdocuments_wopi, oc_gpodder_episode_action, oc_recent_contact, oc_circles_event, oc_circles_share_lock, oc_calendar_resources_md, oc_circles_token, oc_circles_mountpoint, oc_deck_board_acl, oc_authorized_groups, oc_phonetrack_filtersb, oc_activity_mq, oc_flow_checks, oc_profile_config, oc_accounts_data, oc_announcements_map, oc_mail_accounts, oc_known_users, oc_collres_accesscache, oc_mail_provisionings, oc_announcements, oc_onlyoffice_permissions, oc_addressbooks, oc_group_user, oc_ldap_user_mapping, oc_notifications_settings, oc_calendar_appt_bookings, oc_deck_attachment, oc_file_locks, oc_ratelimit_entries, oc_polls_votes, oc_ocsms_conversation_read_states, oc_dav_shares, oc_phonetrack_tileserver, oc_talk_rooms, oc_polls_watch, oc_notifications_pushhash, oc_mail_tags, oc_privacy_admins, oc_systemtag_group, oc_ldap_group_mapping, oc_mail_messages, oc_mail_recipients, oc_onlyoffice_instance, oc_comments, oc_ldap_group_members, oc_users, oc_properties, oc_user_transfer_owner, oc_mail_trusted_senders, oc_phonetrack_devices, oc_vcategory, oc_mounts. Weitere Informationen findest du in der Dokumentation ↗.

For all these tables a row format adjustment was required. I used ChatGPT to generate the ALTER TABLE commands for all tables that were mentioned in the warning and used the following commands to enter the MariaDB Container:

# Access MariaDB, check your .env file for user and password
docker exec -it nextcloud-db mysql -u nextcloud -p

# Display database 
SHOW DATABASES;

# select the nextcloud database
USE NEXTCLOUD;

# alter row format
ALTER TABLE oc_richdocuments_template ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_direct_edit ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_flow_operations ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_migrations ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_talk_sessions ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_circles_remote ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_circles_member ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_trusted_servers ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_richdocuments_direct ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_directlink ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_talk_invitations ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_cards ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_filecache ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_oauth2_clients ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_storages_credentials ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_login_flow_v2 ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_group_admin ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_files_trash ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_deck_labels ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_deck_stacks ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_ocsms_sendmessage_queue ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_weather_city ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_collres_collections ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_jobs ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_deck_assigned_users ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_phonetrack_points ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_deck_cards ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_ldap_group_mapping_backup ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_ocsms_config ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_mail_mailboxes ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_accounts ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_twofactor_providers ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_calendarchanges ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_gpodder_subscriptions ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_appconfig ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_mail_coll_addresses ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_polls_notif ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_calendarobjects ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_addressbookchanges ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_calendars ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_twofactor_totp_secrets ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_user_status ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_talk_internalsignaling ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_vcategory_to_object ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_dav_cal_proxy ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_calendar_resources ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_talk_commands ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_mail_message_tags ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_authtoken ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_polls_log ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_ocsms_smsdatas ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_phonetrack_proxims ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_share ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_text_steps ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_polls_preferences ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_preferences ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_weather_config ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_twofactor_backupcodes ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_circles_circle ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_deck_boards ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_webauthn ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_federated_reshares ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_activity ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_mimetypes ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_collres_resources ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_notifications ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_mail_classifiers ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_notes_meta ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_schedulingobjects ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_circles_mount ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_circles_membership ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_talk_attendees ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_news_folders ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_deck_assigned_labels ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_mail_aliases ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_oauth2_access_tokens ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_phonetrack_geofences ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_news_items ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_polls_options ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_filecache_extended ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_phonetrack_pubshares ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_news_feeds ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_groups ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_text_documents ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_files_lock ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_polls_polls ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_calendarsubscriptions ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_text_sessions ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_whats_new ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_phonetrack_shares ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_onlyoffice_filekey ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_polls_share ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_calendar_reminders ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_bruteforce_attempts ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_share_external ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_systemtag_object_mapping ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_systemtag ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_cards_properties ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_calendar_rooms ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_talk_bridges ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_mail_attachments ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_polls_comments ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_storages ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_ocsms_user_datas ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_flow_operations_scope ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_calendar_rooms_md ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_richdocuments_assets ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_calendarobjects_props ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_phonetrack_sessions ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_mail_local_messages ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_comments_read_markers ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_calendar_appt_configs ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_calendar_invitations ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_richdocuments_wopi ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_gpodder_episode_action ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_recent_contact ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_circles_event ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_circles_share_lock ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_calendar_resources_md ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_circles_token ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_circles_mountpoint ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_deck_board_acl ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_authorized_groups ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_phonetrack_filtersb ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_activity_mq ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_flow_checks ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_profile_config ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_accounts_data ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_announcements_map ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_mail_accounts ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_known_users ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_collres_accesscache ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_mail_provisionings ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_announcements ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_onlyoffice_permissions ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_addressbooks ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_group_user ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_ldap_user_mapping ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_notifications_settings ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_calendar_appt_bookings ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_deck_attachment ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_file_locks ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_ratelimit_entries ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_polls_votes ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_ocsms_conversation_read_states ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_dav_shares ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_phonetrack_tileserver ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_talk_rooms ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_polls_watch ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_notifications_pushhash ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_mail_tags ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_privacy_admins ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_systemtag_group ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_ldap_group_mapping ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_mail_messages ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_mail_recipients ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_onlyoffice_instance ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_comments ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_ldap_group_members ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_users ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_properties ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_user_transfer_owner ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_mail_trusted_senders ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_phonetrack_devices ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_vcategory ROW_FORMAT=DYNAMIC;
ALTER TABLE oc_mounts ROW_FORMAT=DYNAMIC;

# exit MariaDB
EXIT;

After a refresh in the NC webinterface, all warnings were gone.

[Homelab] Notes on “How To Run A Server At Home Without An IPv4 Address”

Since my domain provider does not support DynDNS, I can only create subdomains for my VPS with a static IP address, but not for any of my services hosted at home. Fortunately, there is a really cool workaround I’ve been using for some years, which I got from here: https://blog.wirelessmoves.com/2019/06/how-to-run-a-server-at-home-without-an-ipv4-address.html

Now with the migration to a new server running Ubuntu 24.04, I had to redo the steps and noticed three minor differences.

# The .ssh folder and authorized_keys file did not exist per default
mkdir .ssh
sudo nano .ssh/authorized_keys

# The systemd command to restart the ssh service
sudo systemctl restart ssh.service

# Insted of netstat I had to use 'ss' to monitor the tcp ports
watch -n 0.5 "ss -tulpn"

Since I’m really not a Linux or command line expert and would surely forget about it otherwise, I’m writing it down for my next server migration 🙂

[NAS] IPMI Docker

In my TrueNAS Server I use an ASRock Rack C2550D4I motherboard, which is quite old. It has a Java IPMI Interface, which was/is really handy. The problem is that it requires an old version of Java, and I haven’t had a computer in the household with Java installed at all for a few years, let alone a version that old. But luckily I recently stumbled across this docker project: https://github.com/solarkennedy/ipmi-kvm-docker

The setup is super easy and with the help of this cool project, I can finally use the IPMI functionality of my NAS again.

version: '3.9'
services:
    ipmi-kvm-docker:
        image: solarkennedy/ipmi-kvm-docker
        environment:
            - RES=1600x900x24
        ports:
            - '8080:8080'

[Proxmox] Upgrade 7.4 to 8.0 – Failed to run lxc.hook.pre-start for container

After updating my Proxmox Server to PVE8.0, suddenly two lxc containers did not start anymore.

root@pve:~# pct start 192
run_buffer: 322 Script exited with status 2
lxc_init: 844 Failed to run lxc.hook.pre-start for container "192"
__lxc_start: 2027 Failed to initialize container "192"
startup for container '192' failed

I tried to view the error.log but couldn’t find any helpful information.

lxc-start -lDEBUG -o error.log -F -n 192

When googling, I stumbled across this reddit post. Although the issue was a bit different, I tried the recommended steps. The first command, directly led me to the right direction…

root@pve:~# pct mount 192
mounting container failed
directory '/mnt/nfs/data/folder' does not exist

For whatever reason, after restarting proxmox it did not mount the nfs shares properly on the host. And of course, after this hint, I noticed that both containers were trying to mount some of these folders, which were actually nfs shares from my NAS. A simple mount -a on the host fixed it immediately. Besides of this little problem, everything went well with the proxmox upgrade!

[Home Assistant] Stromzähler auslesen: LOGAREX LK13BE803049

Wurde der Stromzähler in den letzten Jahren getauscht, solltet ihr eine moderne Messeinrichtung haben, welche eine Infrarot (IR) Schnittstelle für das Auslesen von Daten anbietet. Dazu gibt es bereits eine große Anzahl an Anleitungen, z. B. hier und hier. Daher nur kurz zusammengefasst, welche Schritte notwendig waren für meinen LOGAREX LK13BE803049 (Baujahr 2018).

Stromzähler vorbereiten

Um Zugriff auf alle Daten, die der Stromzähler so sammelt zu bekommen, benötigt man eine PIN. Diese PIN kann man über das Online-Portal des Messstellenbetreibers herausfinden, alternativ geht das auch via Hotline oder Mail. Hat man seine PIN, am besten in der Anleitung nachschlagen, wie die PIN eingeben (Seite 6) und wie der “vollständiger Datensatz” (Seite 8) aktiviert wird. Ansonsten bekommt man nur einen Bruchteil der vorhanden Daten zurück.

IR Lese-Schreibkopf

Kann man selber basteln für wenige Euro oder alternativ fertig kaufen. Ich habe diesen (WIFI lese-schreib-Kopf EHZ Volkszähler Hichi Smartmeter) gekauft, da hier ein ESP32 dabei ist und dieser sogar bereits mit Tasmota geflasht wurde. Um Abstürze im Betrieb zu verhindern, darauf achten, dass das Netzteil der Micro-USB Stromversorgung genug Leistung hat. Ist die Stromversorgung sichergestellt, mittels Smartphone mit dem vom ESP32 geöffneten Access Point verbinden und die WLAN Daten des Heimnetzes im Tasmota Webinterface eingeben (sollte sich automatisch öffnen nach der AP Verbindung). Nun kann das ganze Teil mithilfe des Magneten am Stromzähler über der IR Schnittstelle (Optische Datenschnittstelle D0) angebracht werden. Im Idealfall hat man dafür noch eine freie Steckdose in der Nähe des Stromzählers.

Script anlegen in Tasmota

Erneut das Tasmota Webinterface aufrufen, am besten diesmal vom Desktop PC, und über den Button Consoles zu Edit Script navigieren. Dort müssen nun einige Zeilen eingetragen werden, die sich je nach Stromzähler unterscheiden können. Eine Übersicht der möglichen Werte des LOGAREX Zählers findet ihr in der Anleitung auf Seite 10. Bei mir sah das Ergebnis dann so aus:

>D
>B
=>sensor53 r
>M 1
+1,3,o,0,9600,LOGAREX
1,1-0:1.8.0*255(@1,BEZUG,KWh,total_in,4
1,1-0:2.8.0*255(@1,EINSPEISUNG,KWh,total_out,4
1,1-0:16.7.0*255(@1,Verbrauch aktuell,W,current,16
1,1-0:1.8.0*96(@1,letzter Tag,KWh,total_day,1
1,1-0:1.8.0*97(@1,letzte Woche,KWh,total_week,1
1,1-0:1.8.0*98(@1,letzter Monat,KWh,total_month,1
1,1-0:1.8.0*99(@1,letztes Jahr,KWh,total_year,1
#

Home Assistant

Via MQTT und Tasmota Integration können die Werte direkt an Home Asisstant übertragen werden und z.B. im Energy Dashboard verwendet werden. Dafür einfach die Schritte unter 4b von dieser Anleitung umsetzten. Falls MQTT auf eurem Home Assistant noch nicht eingerichtet ist, müsst ihr das noch tun. Dafür gibt es auch einen Haufen Anleitungen oder Videos. Am besten einfach eine recht aktuelle Anleitung heraussuchen. Bei der Einrichtung legt ihr auch einen separaten User für MQTT an, welchen ihr dann angeben müsst in Tasmota. So sah es bei mir dann aus.

In der Tasmota Integration in Home Assistant wurde das Device mit entsprechen Entitäten direkt gefunden.

Da die Werte jedoch ohne Einheit übertragen werden, muss diese noch händisch in der configuration.yaml gepflegt werden. Wenn ich mich recht erinnere, ist danach ein Neustart von Home Assistent erforderlich.

 # Tasmota Stromzähler
homeassistant:
  customize:
    sensor.tasmota_logarex_total_in:
      device_class: energy 
      unit_of_measurement: "kWh"
      state_class: total_increasing
    sensor.tasmota_logarex_total_out:
      device_class: energy 
      unit_of_measurement: "kWh"
      state_class: total_increasing
    sensor.tasmota_logarex_current: 
      device_class: power 
      unit_of_measurement: "W"
    sensor.tasmota_logarex_total_day:
      device_class: energy 
      unit_of_measurement: "kWh"
      state_class: total_increasing
    sensor.tasmota_logarex_total_week:
      device_class: energy 
      unit_of_measurement: "kWh"
      state_class: total_increasing  
    sensor.tasmota_logarex_total_month:
      device_class: energy 
      unit_of_measurement: "kWh"
      state_class: total_increasing  
    sensor.tasmota_logarex_total_year:
      device_class: energy 
      unit_of_measurement: "kWh"
      state_class: total_increasing  

So sieht die Anzeige der Sensoren direkt etwas brauchbarer aus. 🙂

Die schöne Energieverteilungsanzeige vom Energy Dashboard kann auch in jedem anderen Dashboard verwendet werden via:

type: energy-distribution
link_dashboard: true

Einen Überblick der weiteren Energy Cards findet man hier.

Im Energy Dashboard kann auch ein Preis für die kWh hinterlegt werden. So sieht man direkt seinen Verbrauch für ausgewählte Zeiträume. Hier mal ein extremes Beispiel, an dem wir den ganzen Tag Äpfel eingekocht und Kuchen gebacken haben. So ein Verbrauch ist bei uns natürlich nicht die Regel. 🙂

Für mein Smartphone Dashboard habe ich dann noch die neue Statictics Card genutzt, um einen noch einfacheren Einblick in meine laufenden Kosten zu bekommen. Die Anordnung erfolgt durch eine Grid Card.

square: false
columns: 2
type: grid
cards:
  - type: statistic
    entity: sensor.tasmota_logarex_total_in_cost
    period:
      calendar:
        period: day
    stat_type: change
    name: Kosten heute
  - type: statistic
    entity: sensor.tasmota_logarex_total_in_cost
    period:
      calendar:
        period: day
        offset: -1
    stat_type: change
    name: Kosten gestern

[Nextcloud] Docker update 21.0.7 to 21.0.8

And again… a Nextcloud upgrade failed. After a docker-compose pull and docker-compose up -d the maintenance mode won’t turn off. So I tried to turn it off manually, but I still couldn’t finish the update via WebGUI. I also couldn’t find any errors via the log.

docker exec --user www-data nextcloud-app php /var/www/html/occ maintenance:mode --off

So I triggered the upgrade again from the terminal and finally got an exception.

$ docker exec --user www-data nextcloud-app_1 php /var/www/html/occ upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Turned on maintenance mode
Updating database schema
Updated database
Updating <user_ldap> ...
An unhandled exception has been thrown:
Error: Call to undefined method OC\DB\QueryBuilder\QueryBuilder::executeQuery() in /var/www/html/apps/user_ldap/lib/Migration/GroupMappingMigration.php:56
Stack trace:
#0 /var/www/html/apps/user_ldap/lib/Migration/Version1130Date20220110154717.php(54): OCA\User_LDAP\Migration\GroupMappingMigration->copyGroupMappingData('ldap_group_mapp...', 'ldap_group_mapp...')
#1 /var/www/html/lib/private/DB/MigrationService.php(528): OCA\User_LDAP\Migration\Version1130Date20220110154717->preSchemaChange(Object(OC\Migration\SimpleOutput), Object(Closure), Array)
#2 /var/www/html/lib/private/DB/MigrationService.php(426): OC\DB\MigrationService->executeStep('1130Date2022011...', false)
#3 /var/www/html/lib/private/legacy/OC_App.php(1012): OC\DB\MigrationService->migrate()
#4 /var/www/html/lib/private/Updater.php(347): OC_App::updateApp('user_ldap')
#5 /var/www/html/lib/private/Updater.php(262): OC\Updater->doAppUpgrade()
#6 /var/www/html/lib/private/Updater.php(134): OC\Updater->doUpgrade('21.0.8.3', '21.0.7.0')
#7 /var/www/html/core/Command/Upgrade.php(249): OC\Updater->upgrade()
#8 /var/www/html/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Upgrade->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/html/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/html/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Upgrade), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/html/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/html/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/html/console.php(100): OC\Console\Application->run()
#14 /var/www/html/occ(11): require_once('/var/www/html/c...')


Quick search on google and it seems that the image for 21.0.8 is broken and already withdrawn. Here and here. Great if users can still pull it from the docker repo…

I disabled the user_ldap addon via command line. This site helped me finding the right commands. After another occ upgrade and a few minutes, the instance finally came back online.

docker exec --user www-data nextcloud-app php /var/www/html/occ app:list
docker exec --user www-data nextcloud-app php /var/www/html/occ app:disable user_ldap
docker exec --user www-data nextcloud-app php /var/www/html/occ maintenance:mode --off
docker exec --user www-data nextcloud-app php /var/www/html/occ upgrade

In the end I also stumbled across the official nextcloud blog, where they announce 20.0.9 and that they had problems with 20.0.8…. But if the new docker image is not yet provided, and you can’t downgrade from your broken 20.0.8 back to 20.0.7, this doesn’t help you at all.

[Docker] OCI runtime create failed on Ubuntu 18.04.

Yesterday after rebooting my Server running Ubuntu 18.04. I couldn’t run most of my Docker Container. Strangely, some worked and some did not. If not I always got some OCI runtime error messages:

$ docker-compose up -d
ts3_teamspeak_1 is up-to-date
Creating ts3_teamspeak-db_1 ... error

ERROR: for ts3_teamspeak-db_1  Cannot start service teamspeak-db: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:402: getting the final child's pid from pipe caused: EOF: unknown

After googling a bit, I found the solution. I did an apt upgrade before rebooting and my Docker version was updated to v5.20. And it seems that Ubuntu 18.04. and Docker v5.20 are not working well together. Therefore I had to downgrade docker to v5.18. Find more here.

 apt install docker-ce=5:18.09.1~3-0~ubuntu-bionic
 apt install containerd.io=1.2.2-1