Referring to Controlling openHAB with your voice
I am attempting to implement this using OH2, and Automate(android app similar to Tasker).
I am getting numerous errors. The line “var State newState = null” is unloved by designer (X “State cannot be resolved to a type.”), so I modified it to “var String newState = null”, and made the necessary adjustments (from ON to “ON” and so on)
It still hates the section:
All?.allMembers.filter(s | s.name.contains(itemName) && s.acceptedDataTypes.contains(finalState.class)).forEach[item|
logInfo("VoiceControl","item "+item.name+" found")
sendCommand(item.name,finalState)
]
with the errors:
Multiple markers at this line
- There is no context to infer the closure’s argument types from.
Consider typing the arguments or put the closures into a typed
context. - The method or field acceptedDataTypes is undefined for the
type Object - The method or field All is undefined
- The method or field name is undefined for the type Object
I am kind of at a loss. Anyone out there used this code with OH2?
Craig