Interesting error... Anyone see this before?

java.lang.IllegalArgumentException: Property 'Aeon Multisensor' too ambiguous for this device @ line 1686

This is the code at line 1686

if (settings.D_motion.latestValue.contains("active"))

Basically looking up a list of motion sensors to see if the list contains an active motion sensor…

It works fine for my smartness motion sensors… anyone know what could be going on here? Its like it can’t find the last value for a few of my motions sensors but can for others?

D_motion is a list?, if so suspecting that all the names are the same, so it can’t figure out which latest value to fetch. Maybe try?
settings.D_motion.each(){ it ->
//what the heck are you complaining about?
}

The problem is you’re using latestValue without the attribute you’re looking for, latestValue("motion"). That poorly worded error is complaining that for the multisensor it doesn’t know which latest value you want.

This works fine for devices that have only one value to report but for multi sensors it seems to fail. Basically from a group/list of motion sensors I need to be able to see if the last motion event was “active” or “inactive”. All help is appreciated :smile:

I could understand if it was saying “active” is too ambiguous… but why is the sensor type being mentioned here? lol

I just tried looking for “motion.active” and that didn’t work either.

if (settings.D_motion.latestValue.contains("motion")) is not working either.

LOL!

settings.D_motion.each(){ it ->
  log.debug "device:${it.displayName} isActive:${it.currentValue("motion") == "active"}"
}

Did you try changing .latestValue.contains("active") to .latestValue("motion").contains("active"). Sorry if I wasn’t clear that was my suggestion.

2 Likes

This worked! Thanks dude!

Now that I see it it makes sense. This was plaguing me alllllllll weekend lol

I’m curious about the question that @Mike_Maxwell raised: is settings.D_motion a list of motion sensors or a single object representing a set? Calling latestValue() on a list doesn’t work, does it? On a single device, the value will be returned and contains() would be evaluating whether “active” is a substring of the latestValue for that single device. So virtual device returning an array of values for the lastestValues of its children or single device where you expect to have a list?

settings.D_motion_list.collect({ it.latestValue("motion") }).contains("active")

…would be the sort of thing that would check for motion active on a list of devices (D_motion_list made up to differentiate).

I was able to pull this off:

activeHumidityDevices.currentValue(“humidity”).max()

In this case I’m looking for the maximum humidity from a list of humidity sensors…

Settings.someDevices is a list for sure…

1 Like