OpenHAB2 update

Hello!
Previously, I saw immediately what the latest release:
https://oss.jfrog.org/webapp/#/builds/openHAB-Distribution
Updates are frequent, and now for a long time no update, I have a current 789, and on page 792. Is this normal? or something has changed, and I missed?
Updated: apt update && apt upgrade
Thank you!

Are there OH2 Updates between a new release? I think i only get updates between 2.0 and 2.1 if i´m on the snapshot update channel?

With regular update channel i only get big updates like 2.1, 2.2 and so on?

Or am i wrong?

Hello!
I have set up as follows:
/etc/apt/sources.list.d/openhab2.list

deb http://dl.bintray.com/openhab/apt-repo2 unstable main

Thank you!

Sorry, but i can´t read cyrillic characters.

You are on the unstable repo. So you get much more updates. I´m on the regular repo, so i get only major updates with new version number (e.g. 2.1 will be my next update).

It moved. Not on dl.bintray.com any longer.

Thank you! This is what you need!

If i want to change from stable-repo to snapshot-repo, i only have to change the path and after that make “sudo appt-get update/upgrade”?

Indeed just doing this:

did the trick for me.

Where can i see the changelog in every build?

Or is there a big changelog from the latest stable build to latest snapshot?

Damn!

I changed to snapshot and now OH2 isn´t working properly anymore. No more rules are working. No log entrys in openhab, only a few astro resheduling, but nothing more.

Not showing ntp time on webinterface anymore.

Events.log looks ok.

Is there another log to search for errors?

2017-03-01 12:51:50.235 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'strom.rules'
2017-03-01 12:51:50.236 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'strom.rules' is either empty or cannot be parsed correctly!
2017-03-01 12:51:50.345 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'strom.rules' has errors, therefore ignoring it: [419,6]: String literal is not properly closed

2017-03-01 12:51:50.631 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'strom.rules' has errors, therefore ignoring it: [448,33]: missing ')' at '{'
[471,32]: missing ')' at '{'
[487,36]: missing ')' at '{'
[491,37]: missing ')' at '{'

2017-03-01 12:51:50.668 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'strom.rules' has errors, therefore ignoring it: [448,33]: missing ')' at '{'
[471,32]: missing ')' at '{'
[487,36]: missing ')' at '{'
[491,37]: missing ')' at '{'

But rule file works with 2.0.0 without problems…

rule-file:

// heutiger Verbrauch Haus
rule "power meter Hausverbrauch des heutigen Tages"
	when
		Time cron "0 * * * * ?" // this one cycles every 1 minutes. depends on your needs
	then
		// logInfo("Power Meter 1 Minute 0002", "0002 - 1. Meldung noch vor allem")
		var hausverbrauch_heute = stromzaehler1_erzeugung.deltaSince(now.toDateMidnight) - stromzaehler0_einspeisung.deltaSince(now.toDateMidnight) + stromzaehler0_bezug.deltaSince(now.toDateMidnight)
		var einspeisung_heute = stromzaehler0_einspeisung.deltaSince(now.toDateMidnight)
		var erzeugung_heute = stromzaehler1_erzeugung.deltaSince(now.toDateMidnight)
		var bezug_heute = stromzaehler0_bezug.deltaSince(now.toDateMidnight)
		var eigenverbrauch_heute = stromzaehler1_erzeugung.deltaSince(now.toDateMidnight) - stromzaehler0_einspeisung.deltaSince(now.toDateMidnight)
		stromzaehler0_hausverbrauch_heute.postUpdate(hausverbrauch_heute)
		stromzaehler0_einspeisung_heute.postUpdate(einspeisung_heute)
		stromzaehler1_erzeugung_heute.postUpdate(erzeugung_heute)
		stromzaehler0_bezug_heute.postUpdate(bezug_heute)
		stromzaehler0_eigenverbrauch_heute.postUpdate(eigenverbrauch_heute)
end




rule "Alle Stromzähler auslesen - neu"
	when
			Item PowerMeter_new received update // String Item linked to exec:command channel that runs above script
	then
			//logInfo("Powermeter-new", "TEST " + PowerMeter_new)
			var lines = PowerMeter_new.state.toString.split('\n')
			logInfo("Powermeter-new", "alles ok - lines --> " + lines.size('\n'))
			if ((lines.size('\n') == 10) {
					val counterStr = lines.get(0).split('#').get(1)
					val supplyStr = lines.get(1).split('#').get(1)
					val consumptionStr = lines.get(4).split('#').get(1)
					val solarcounterStr = lines.get(5).split('#').get(1)
					val solar1Str = lines.get(6).split('#').get(1)
					val solarpowerStr = lines.get(9).split('#').get(1)
					stromzaehler0_bezug.sendCommand(counterStr)
					stromzaehler0_einspeisung.postUpdate(supplyStr)
					stromzaehler0_leistung.postUpdate(consumptionStr)
					stromzaehler1_leistung.postUpdate(solarpowerStr)
					stromzaehler1_leistung1.postUpdate("-" + solarpowerStr)
					stromzaehler1_erzeugung.sendCommand(solarcounterStr)
					stromzaehler1_ungenutzt.postUpdate(solar1Str)
					var hausverbrauch_aktuell = (Double::parseDouble(consumptionStr)) + (Double::parseDouble(solarpowerStr))
					if (hausverbrauch_aktuell < 0) {
							logInfo("Powermeter-new", "Fehler - Verbrauch negativ --> " + hausverbrauch_aktuell + " kW")
							stromzaehler_haus_leistung.postUpdate(0)
					}
					else {
							stromzaehler_haus_leistung.postUpdate(hausverbrauch_aktuell)
					}
			}
			if ((lines.size('\n') == 9) {
					val counterStr = lines.get(0).split('#').get(1)
					val supplyStr = lines.get(1).split('#').get(1)
					val consumptionStr = lines.get(4).split('#').get(1)
					val solarcounterStr = lines.get(5).split('#').get(1)
					val solar1Str = lines.get(6).split('#').get(1)
					// Updating the items
					stromzaehler0_bezug.sendCommand(counterStr)
					stromzaehler0_einspeisung.postUpdate(supplyStr)
					stromzaehler0_leistung.postUpdate(consumptionStr)
					stromzaehler1_leistung.postUpdate(0)
					stromzaehler1_leistung1.postUpdate(0)
					stromzaehler1_erzeugung.sendCommand(solarcounterStr)
					stromzaehler1_ungenutzt.postUpdate(solar1Str)
					stromzaehler_haus_leistung.postUpdate(consumptionStr)
			}
			else if ((lines.size('\n') < 9) {
					logInfo("Powermeter-new", "*** Fehler 1 *** - lines --> " + lines.size('\n'))
					logInfo("Powermeter-new", "*** Fehler 1 *** Inhalt Powermeter --> " + PowerMeter_new_test)
			}
			else if ((lines.size('\n') > 10) {
					logInfo("Powermeter-new", "*** Fehler 2 *** - lines --> " + lines.size('\n'))
					logInfo("Powermeter-new", "*** Fehler 2 *** Inhalt Powermeter --> " + PowerMeter_new_test)
			}
end

I found out a little bit:

Seems that 2.1 snapshod introduced a rules-checker and ignores rules with errors. In 2.0 all rules were working properly. I checked all rules and changed a little bit, only rule i can´t get running is this rule above.

Error must be something in this area:

Logfile

2017-03-01 13:19:42.518 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'strom_new.rules'
2017-03-01 13:19:42.518 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'strom_new.rules' is either empty or cannot be parsed correctly!
2017-03-01 13:19:42.732 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'strom_new.rules' has errors, therefore ignoring it: [42,33]: missing ')' at '{'
[65,32]: missing ')' at '{'
[81,36]: missing ')' at '{'
[85,37]: missing ')' at '{'
[89,1]: mismatched input '<EOF>' expecting 'end'

2017-03-01 13:19:42.769 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'strom_new.rules' has errors, therefore ignoring it: [42,33]: missing ')' at '{'
[65,32]: missing ')' at '{'
[81,36]: missing ')' at '{'
[85,37]: missing ')' at '{'

2017-03-01 13:19:42.808 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'strom_new.rules' has errors, therefore ignoring it: [42,33]: missing ')' at '{'
[65,32]: missing ')' at '{'
[81,36]: missing ')' at '{'
[85,37]: missing ')' at '{'

rule-file
starting line is 35. So 42,33 is this
if ((lines.size(’\n’) == 10) {

rule "Alle Stromzähler auslesen - neu"
	when
			Item PowerMeter_new received update // String Item linked to exec:command channel that runs above script
	then
			//logInfo("Powermeter-new", "TEST " + PowerMeter_new)
			var lines = PowerMeter_new.state.toString.split('\n')
			logInfo("Powermeter-new", "alles ok - lines --> " + lines.size('\n'))
			if ((lines.size('\n') == 10) {
					val counterStr = lines.get(0).split('#').get(1)
					val supplyStr = lines.get(1).split('#').get(1)
					val consumptionStr = lines.get(4).split('#').get(1)
					val solarcounterStr = lines.get(5).split('#').get(1)
					val solar1Str = lines.get(6).split('#').get(1)
					val solarpowerStr = lines.get(9).split('#').get(1)
					stromzaehler0_bezug.sendCommand(counterStr)
					stromzaehler0_einspeisung.postUpdate(supplyStr)
					stromzaehler0_leistung.postUpdate(consumptionStr)
					stromzaehler1_leistung.postUpdate(solarpowerStr)
					stromzaehler1_leistung1.postUpdate("-" + solarpowerStr)
					stromzaehler1_erzeugung.sendCommand(solarcounterStr)
					stromzaehler1_ungenutzt.postUpdate(solar1Str)
					var hausverbrauch_aktuell = (Double::parseDouble(consumptionStr)) + (Double::parseDouble(solarpowerStr))
					if (hausverbrauch_aktuell < 0) {
							logInfo("Powermeter-new", "Fehler - Verbrauch negativ --> " + hausverbrauch_aktuell + " kW")
							stromzaehler_haus_leistung.postUpdate(0)
					}
					else {
							stromzaehler_haus_leistung.postUpdate(hausverbrauch_aktuell)
					}
			}
			if ((lines.size('\n') == 9) {
					val counterStr = lines.get(0).split('#').get(1)
					val supplyStr = lines.get(1).split('#').get(1)
					val consumptionStr = lines.get(4).split('#').get(1)
					val solarcounterStr = lines.get(5).split('#').get(1)
					val solar1Str = lines.get(6).split('#').get(1)
					// Updating the items
					stromzaehler0_bezug.sendCommand(counterStr)
					stromzaehler0_einspeisung.postUpdate(supplyStr)
					stromzaehler0_leistung.postUpdate(consumptionStr)
					stromzaehler1_leistung.postUpdate(0)
					stromzaehler1_leistung1.postUpdate(0)
					stromzaehler1_erzeugung.sendCommand(solarcounterStr)
					stromzaehler1_ungenutzt.postUpdate(solar1Str)
					stromzaehler_haus_leistung.postUpdate(consumptionStr)
			}
			else if ((lines.size('\n') < 9) {
					logInfo("Powermeter-new", "*** Fehler 1 *** - lines --> " + lines.size('\n'))
					logInfo("Powermeter-new", "*** Fehler 1 *** Inhalt Powermeter --> " + PowerMeter_new_test)
			}
			else if ((lines.size('\n') > 10) {
					logInfo("Powermeter-new", "*** Fehler 2 *** - lines --> " + lines.size('\n'))
					logInfo("Powermeter-new", "*** Fehler 2 *** Inhalt Powermeter --> " + PowerMeter_new_test)
			}
end

That’s exactly right, you’ve got three “(” but only two “)”. All similar if statements need an extra closing bracket, or just get rid of very first opening one.

Ok, i looked through all rules.

The error first comes up, if i open a rules-file, change 1 character and save it agein. On a fresh OH2 start there are no errrors…

Now all rule-files are error-free. But i get many warnings.

Here is a small list:

The use of wildcard imports is deprecated.
The import 'java.util.concurrent.locks.ReentrantLock' is never used.
The import 'java.lang.Math' is never used.
The method toDateMidnight() from the type DateTime is deprecated

My imports look like this:

import org.openhab.model.script.actions.*
import java.lang.Math
import java.util.concurrent.locks.ReentrantLock

— What do i have to change with the wildcards?
— When i do some math in a rule, i need this import?
— The concurrent.locks error even appears in a rule where it is used.
— new way to write —> toDateMidnight() —> toDateTimeAtStartOfDay() <---- also not working

Did you found solution for?

The method toDateMidnight() from the type DateTime is deprecated

I have changed the rule to this and it works:

rule "Kompressor Starts zählen täglich"
		when
				Item HeatPump_compressor_count received update
		then
				var count_today = HeatPump_compressor_count.deltaSince(now.toLocalDate.toDateTimeAtStartOfDay, "db4o")
				HeatPump_counts_today.postUpdate(count_today)
end
1 Like