I have two window contact sensors, and I want to use a push notification to see if one of them is open.
My rule looks like this:
Member of gSensor changed
val String zeit = now.withZone(DateTimeZone.forID("Europe/Berlin")).toString("dd.MM.yyyy' 'HH:mm:ss")
val ContactItem opendoor = gSensor.members.sortby[ lastUpdate ].findFirst[ i | i.state == OPEN ]
logInfo("notifications", "Sending notification via pushover.")
sendPushoverMessage(pushoverBuilder(opendoor+ "wurde am"+zeit+"geöffnet."))
I get the
There is no context to infer the closure's argument types from. Consider typing the arguments or put
the closures into a typed context.
I don’t think that link is the root cause of the problem here. In that sortBy thread the error would be a null error. This error is different.
This error is saying that it can’t figure out the type of either lastUpdate or i. It is most likely i because sortBy expects a method, not an Object. Try giving i a state. findFirst[ ContactItem i | i.state == OPEN ].
True, but in those cases, if persistence were not set up correctly they would be getting null errors. And once they fix the original problem they very well might have persistence problems. The error they are receiving is happening before the code gets that far.