"Member of" does not work in OH 2.1

(Michal Szymanski) #1

Hi,
I tried to rewrite my old rule to use constrution “Member of”. Such construction was presented in

I created such rule:

rule “Low_battery_alarm”
when
Member of gLowBattery changed
then
logInfo( “FILE”, “Low_battery_alarm: -START-”)

I’ve got such error:

2018-08-13 23:51:56.129 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘General.rules’ has errors, therefore ignoring it: [8,3]: no viable alternative at input ‘Member’

Does it work only in new OH versions?

Michal Szymanski

0 Likes

(Markus Storm) #2

I don’t see “Member” to be a valid trigger point according to OH2 docs. @rlkoshak please share your knowledge if you think this is supposed to work.

Now while I don’t know your application, maybe a standard ‘when Item gLowBattery changed’ will also do what you want it to (as changes to group members will change the group’s status, too).

0 Likes

(Daniel Walters) #3

As far as I know “Member of” trigger was only introduced in OH2.3

0 Likes

(Michal Szymanski) #4

So far I had:

rule "Low_battery_alarm"
	when 
		Item gLowBattery received update 
	then
		val sensor = gLowBattery. members.filter[sensor | sensor.lastUpdate != null].sortBy[lastUpdate].last

but using "Member of " looks more elegant :slight_smile:

Michal

0 Likes

(SiHui) #5

:+1:

Availability

“Member of” is an openHAB 2.3 feature. It is not available in any current release build. It is available in snapshot builds starting with openHAB 2.3.0 Build #1212.

1 Like

(Rossko57) #6

I resisted moving from OH1 to OH2 for various reasons, but the introduction of that method was the clincher for me. I’ve rewritten about three quarters of my rules to take advantage of it.

As 2.3 is currently stable release, go for the update.

0 Likes

(Michal Szymanski) #7

I’ve spent weekend to migrate to 2.3 but I’m block by MCP23017 binding , it has some bugs and I wait for fix. I’ve notice also many errors during boot process e.g I have hundred error logs that persistence is not registered but after several minutes persistence works without any problem :slight_smile:

BTW It is pity that OH release version so seldom, ok you can use snapshot version but it is little dangerous for serious installation. They should release major version once a severel month but patches every several weeks.

Michal Szymanski

0 Likes

(Rich Koshak) #8

It was added in 2.3 and will not work in 2.1. Member of and triggeringItem do not exist in 2.1.

I don’t think I’ve explicitly stated it anywhere but the DPs are assumed to work with the latest version of OH. So they should work with whatever was out at the date/time the DP was last edited. I should probably add a little note with the version the DP was written for/last updated for.

Has that still not yet been added to the docs? Grumble. We need to change that. I just submitted a PR.

0 Likes