openHAB 3 – Umstellung und Probleme

17. Januar 2021 at 16:11
Print Friendly, PDF & Email

Mein zweiter Versuch auf die openHAB Version 3 umzusteigen hat nun funktioniert.

Ich verwende das OH3 image von openhabian:
https://github.com/openhab/openhabian/releases
Hier muss man Version 1.6.2b verwenden. Davor gibt es zu viele Probleme.

Grundsätzlich gibt es zwei Wege: das aktuelle System migrieren oder eine Neuinstallation.
Ich habe die Neuinstallation gewählt, so dass das Produktivsystem weiterlaufen kann bis ich alle Problem auf dem neuem System behoben habe.

Die neue UI benutze ich nur zur Konfiguration. Ich greife weiterhin auf die alten Sitemaps zu. Diese findet man in der neuen Oberfläche nicht. Man kann sie aber wie folgt ansprechen:

http://192.168.xxx.yyy:8080/basicui/app

Im ersten Schritt habe ich alle bindings per Hand über die Oberfläche installiert. Danach die Konfigurationsdateien von dem alten System /etc/openhab2 auf das neue System /etc/openhab kopiert – außer den rules und persistence.

Probleme

Persistance

Für grafische Auswertungen verwende ich influxdb. Somit wollte ich die Persistenz auch über influxdb laufen lassen.
Dann kamen etliche Fehlermeldungen und ich dachte, meine Konfiguration von items oder things war falsch.
Lösung: Einfach die influxdb.persist rüberziehen. In der UI war die Konfiguration anscheinend nicht vollständig.

RULES

Die meisten Probleme kamen, als ich meine Regeln geholt habe.

 

ERROR: ‘toString’ is not a member of ‘DateTime’

Fehlermeldung

[codesyntax lang=”bash”]

2021-01-17 11:04:36.763 [ERROR] [internal.handler.ScriptActionHandler] – Script execution of rule with UID ‘admin-1’ failed: ‘toString’ is not a member of ‘DateTime’; line 14, column 51, length 19 in admin

[/codesyntax]

OH2 – Alter Code

[codesyntax lang=”bash”]

OH2 val DateTime MoveMoment = now

OH2 Temp_1W_Date.postUpdate(new DateTimeType(MoveMoment.toString))

[/codesyntax]

OH3 Lösung /Neuer Code

[codesyntax lang=”bash”]

Temp_1W_Date.postUpdate(now.toLocalTime.toString(“HH:mm”))

[/codesyntax]

ERROR: ‘millis’ is not a member of ‘java.time.ZonedDateTime’

Fehlermeldung

[codesyntax lang=”bash”]

2021-01-17 12:29:01.001 [ERROR] [internal.handler.ScriptActionHandler] – Script execution of rule with UID ‘sonoffHeating-6’ failed: ‘millis’ is not a member of ‘java.time.ZonedDateTime’; line 217, column 26, length 10 in sonoffHeating

[/codesyntax]

OH2 – Alter Code

[codesyntax lang=”bash”]

t_begin    = now.millis

[/codesyntax]

OH3 Lösung /Neuer Code

[codesyntax lang=”bash”]

t_begin    = now.toInstant().toEpochMilli()

[/codesyntax]

Referenz

https://community.openhab.org/t/oh3-error-millis-is-not-a-member-of-java-time-zoneddatetime/111177

 

 

ERROR: array element type mismatch

Fehlermeldung

[codesyntax lang=”bash”]

2021-01-17 12:15:00.138 [ERROR] [internal.handler.ScriptActionHandler] – Script execution of rule with UID ‘1wire-2’ failed: An error occurred during the script execution: array element type mismatch in 1wire

[/codesyntax]

OH2 – Alter Code

[codesyntax lang=”bash”]

var String cmdExe=”cat “

var String cmdAll=cmdExe + ” /var/log/daemon.log”

var String cmdRet=executeCommandLine(cmdAll,1000)

[/codesyntax]

OH3 Lösung /Neuer Code

[codesyntax lang=”bash”]

var String cmdExe=”cat “

var String cmdAll=”/var/log/daemon.log”

var String cmdRet=executeCommandLine(Duration.ofSeconds(20),cmdExe,cmdAll)

[/codesyntax]

Referenz

https://github.com/openhab/openhab-docs/issues/1367

 

 

ERROR: Could not cast NULL

Fehlermeldung

[codesyntax lang=”bash”]

2021-01-17 10:41:16.820 [ERROR] [internal.handler.ScriptActionHandler] – Script execution of rule with UID ‘SMA-2’ failed: Could not cast NULL to org.openhab.core.library.types.DecimalType; line 33, column 27, length 34 in SMA

[/codesyntax]

OH2 – Alter Code

[codesyntax lang="bash"]
if (SMA_Day_Start.state==NULL) { SMA_Day_Start.postUpdate(0)
[/codesyntax]

OH3 Lösung /Neuer Code

[codesyntax lang=”bash”]

if(SMA_Day_Start.state==NULL || SMA_Day_Start.state == UNDEF) { SMA_Day_Start.postUpdate(0) }

[/codesyntax]