Unit-Support, KNX 2, Karaf 4.1.5 Upgrade and more!

All,

I’d like to share some details on the latest new features that made it into the 2.3 snapshot build (#1230):

  1. First of all, it includes a new update from Eclipse SmartHome with quite some changes (see the details here) - most of them being small fixes, not worth to mention individually.
  2. The one really big change coming from Eclipse SmartHome is the newly introduced support for units on numbers - you can now choose your measurement system and have any sensor values automatically converted for you and you can also do unit-safe calculations within rules. @henning wrote a blog post about this feature and he will also soon add some details to the openHAB documentation.
    Important for all binding developers: In order to have full support of this feature, bindings should be enhanced in a way that they declare the units of the values that they are providing. Please see here for an example how it is done in the YahooWeather binding. There are still a few known limitations of this feature, so please be aware of them. If anyone is interested in helping to implement those missing parts, please leave a comment on the issue - it would be very welcome.
  3. We have a new KNX binding! This has been in the works for at least 2 years and is now finally merged. It replaces the KNX 1 binding, which has now be moved to the legacy bindings (so if you are using it, please make sure to enable legacy add-ons in your addons.cfg file). We tried to keep the configuration similar to the 1.x KNX binding, so that it is not too hard to migrate - the config strings with the GAs are mainly moved to *.things files, where they can be structured per device. Nonetheless, depending on the size of your setup, the migration might keep you busy for a moment. I have myself done this excercise a few weeks ago and have the binding running in my production environment since then and can assure you that it is working pretty smoothly. So if you are using snapshot builds of openHAB, please have a go and test this binding yourself.
  4. Karaf has been upgraded from 4.1.3 to 4.1.5, which brings a couple of fixes for the console (see release notes of 4.1.4 and 4.1.5).

As it is quite a big update, please keep an eye on any regression that you might encounter and enter issues on Github for them.

Enjoy the update!
Kai

17 Likes

YEAH!
Great stuff. Thanks to all involved!

BR Mehmet

Hey guys,

i made the update about 10mins ago and I have the following error now. I tried to eliminate it but there is no chance. Thats the rule file excerpt:

val Functions$Function5<StringItem, NumberItem, NumberItem, NumberItem, SwitchItem, String> //
generateSummary = (Heater_Mode, Heater_Act_Temp, Heater_Set_Temp, Heater_Valve_Position, Window_Mode |
    var String summary = "(fehlende Daten)"
    if (Heater_Act_Temp.state instanceof Number && Heater_Set_Temp.state instanceof Number && Heater_Valve_Position.state instanceof Number) {
        val actTemp = (Heater_Act_Temp.state as DecimalType).floatValue
        val setTemp = (Heater_Set_Temp.state as DecimalType).floatValue
        val valvePos = (Heater_Valve_Position.state as DecimalType).floatValue
        val mode = Heater_Mode.state as StringType
        
        summary = //
            if (Windows.state == OPEN)   	String::format("( ↻ Fenster offen ) %.1f °C", actTemp)
            else if (mode == "BOOST-MODE") 	String::format("( 🔥 Boost ) %.1f °C", actTemp)
            else if (mode == "AUTO-MODE")  	String::format("( ⚙ %.1f °C ) %.1f °C", setTemp, actTemp)
            else if (valvePos > 60)        	String::format("( ⟰ %.1f °C ) %.1f °C", setTemp, actTemp)
            else if (valvePos > 40)        	String::format("( ⤊ %.1f °C ) %.1f °C", setTemp, actTemp)
            else if (valvePos > 20)        	String::format("( ⇈ %.1f °C ) %.1f °C", setTemp, actTemp)
            else if (valvePos > 0)         	String::format("( ↑ %.1f °C ) %.1f °C", setTemp, actTemp)
            else if (setTemp > actTemp)    	String::format("( • %.1f °C ) %.1f °C", setTemp, actTemp)
            else String::format("%.1f °C", actTemp)
    }
    return summary
)

Credit to @ThomDietrich

And here is the error (its concerning the second line in the excerpt above. Where the generateSummary = is defined):

00:29:54.376 [WARN ] [del.core.internal.ModelRepositoryImpl] - Configuration model 'heizung.rules' has errors, therefore ignoring it: [15,31]: mismatched input ',' expecting ')'
[17,5]: missing EOF at 'if'

I hope you can help me out in this case.
Thank you very much!

Replace your parenthesis with square brackets. Here is an example…

Edit: Updating to #1231 solved the issues.

Thanks for all the work!

@Kai Is this the impact caused by this ESH PR?

2018-03-16 20:42:24.831 [ERROR] [org.openhab.binding.bigassfan       ] - [org.openhab.binding.bigassfan.internal.discovery.BigAssFanDiscoveryService(237)] The activate method has thrown an exception
java.lang.IncompatibleClassChangeError: Expected static field org.openhab.binding.bigassfan.internal.discovery.BigAssFanDiscoveryService.scheduler

2018-03-16 20:48:17.749 [ERROR] [org.eclipse.smarthome.core.thing    ] - [org.eclipse.smarthome.core.thing.internal.ThingManager(91)] The addThingHandlerFactory method has thrown an exception
java.lang.IncompatibleClassChangeError: Expected static field org.openhab.binding.squeezebox.internal.discovery.SqueezeBoxPlayerDiscoveryParticipant.scheduler

Both these bindings were in my addons directory, and were built several days/weeks ago using mvn install in my dev environment.

Is this a consequence of the above-mentioned PR being source compatible, but not binary compatible? Can I infer from this that any binding that references scheduler that was built using anything but the most current ESH sources (such as bindings currently available on the marketplace) will have this problem?

To resolve this, do I need to update my dev environment to the latest ESH version, then rebuild these bindings?

Yes, it indeed is. In consequence, bindings in addons need to be recompiled against the latest ESH stable. This is quite some nasty impact, but I don’t see any other good way to deal with it as the static declaration was definitely a bug that had to be fixed.

To resolve this, do I need to update my dev environment to the latest ESH version, then rebuild these bindings?

You either simply run your addons build through Maven or if you exported your jar from the IDE, you should pull the latest master from openhab-distro (i.e. the “launch” project in your workspace) which should do an update on the openhab.target (make sure to apply the newly resolved target platform).

Note that it is not yet available in a released version of openHAB, only in the current snapshots. So you need to use the “unstable” apt repository.

Since this snapshot build i have a error message with all my image items.

sample of my items file :

Image  Lms_cover                              (Squeeze)   {channel="squeezebox:squeezeboxplayer:myServer:myplayer:coverartdata"}

and i have this error :

2018-03-17 09:10:48.268 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model '_default.items' has errors, therefore ignoring it: [175,1]: missing EOF at 'Image'

It’s a ‘warning’ but in PaperUI in my control PANEL all my items disappeared

Now I have inserted square brackets. Thats the current error now (at the Heater_Mode):

09:54:02.740 [WARN ] [del.core.internal.ModelRepositoryImpl] - Configuration model 'heizung.rules' has errors, therefore ignoring it: [15,19]: mismatched character '_' expecting ']'
[15,31]: missing EOF at ','

SOLVED! There needs to be a space after the opening square bracket!

Agreed. :cry:, but I understand why it needed to be done.

So, what about the marketplace? Won’t bindings that are downloaded from the marketplace, or installed through Paper UI, have a problem until they are rebuilt. At least the portion of those bindings that reference scheduler.

Yes, that did it. Easier than I thought. :ok_hand:

Yes, I’m also seeing this on Image items.

2018-03-17 06:47:27.186 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'squeezebox.items' has errors, therefore ignoring it: [18,1]: missing EOF at 'Image'

2018-03-17 06:48:58.200 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'zoneminder.items' has errors, therefore ignoring it: [22,1]: missing EOF at 'Image'

@Kai Is there a change that might’ve had this as a side effect? I didn’t see anything immediately obvious in the change list.

Edit: All I can see is that the introduction of QuantityType made changes to the Item grammar. And I see that the most recent change dropped the | ID from the BaseModelItemType. Odd that there is and was no Image in the grammar.

I opened an issue for this.

I think it is important to mention that the Weather Underground weather binding was massively impacted by the new unit system.
I have not yet tested it since this change but it is more than probable that without an update of things / items definitions, the binding will no more work. It would be cool and important to mention it in case my assumption is correct.

1 Like

@Lolodomo I was planning to do some testing with the Weather Underground binding but I got sidetracked with the Image issue mentioned above…

Hi,
I have upgraded to #1231 (from #1224).

Several rules now throw these errors in openhab.log:

[71,38]: no viable alternative at input '[lastUpdate]'

Excerpt from my rule:

when   
	Item gKE_Ramen received update
then
	var event = gKE_Ramen.members.sortBy[lastUpdate].last
	var event_update = event.lastUpdate.toDateTime.toString("yyyy-MM-dd HH:mm:ss")
	var event_status = transform("MAP","windows.map",event.state.toString)
	var event_label = event.label.toString.split("   ")

They worked before the upgrade.

Does anyone else have the same issue?

[EDIT]
And I also noticed a second issue:

In openhab.log I get a lot of these:

[26,96]: mismatched input ']' expecting '}'
[13,39]: mismatched character '|' expecting ']'
[158,32]: mismatched character ' ' expecting ']'

In all cases, they worked fine before the upgrade. I also don’t see what could be wrong with my rules.

Given this error:

[26,96]: mismatched input ']' expecting '}'

Is generated by this rule:

rule "Alarm interface via UDP"
when   
    Item  Tex_UDP_Receive received update
then
	var in_UDPmsg = Tex_UDP_Receive.state.toString.trim
    if(in_UDPmsg.startsWith("\"Z0")) {
LINEWITH ERROR	val itemName = gAllecontacten.allMembers.filter[sw|sw.name.contains(in_UDPmsg.substring(1, 5))].head
    postUpdate(itemName, in_UDPmsg.substring(5))
    }

just a note for people still staying on knx1: when you upgrade, the knx1 will be uninstalled, so make sure that you re-install the addon. it works fine afterwards.

1 Like

You need to add a space after [ and before ].

3 Likes

Thanks! That was indeed the problem.

For all users, it is now confirmed that most of the items for the Yahoo weather and WU weather bindings have to be updated to be compatible with the new snapshot.
The documentation for these bindings has to be updated.

@Dries confirmed!!

Updated today to openHAB 2.3.0 Build #1231 and all my rules stopped working :flushed:

I could reduce it now to this line:

val lastItem = Windows.members.sortBy[lastUpdate].last