sendCommand vs postUpdate

Here are the rules, extracted from source:

  • interface Command extends Type
  • interface State extends Type
  • interface PrimitiveType extends Type
  • enum OnOffType implements PrimitiveType, State, Command

But the method group.send needs a Command, not a State. But you can see that OnOffType is both a Command and a State, so it’s no harm to cast it:

import org.openhab.core.types.Command  // not sure if needed
...
group.send(switch.state as Command)
1 Like