Controlling openHAB2 with your voice

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.acceptedDataTypes.contains(finalState.class)).forEach[item|
            logInfo("VoiceControl","item  "" found")

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
  • 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?