Migrating from DSL Rules to JavaScript - receivedCommand

  • Platform information:
    • openHAB version: 3
  • Issue of the topic: Migrating from DSL Rules to Javascript,
  • Please post configurations (if applicable):
    I want to migrate the DSL rule below to javascript.
    How can I access the variable receivedCommand in javascript?

Could you please help.

val actions = getActions(“lcn”,“lcn:module:aebcf08c79:S000M011”)
switch (receivedCommand) {
case OFF: {
actions.hitKey(“A”, 1, “HIT”)
logInfo(“Aussenlichter”, "Set to OFF ")
case ON: {
actions.hitKey(“A”, 2, “HIT”)
logInfo(“Aussenlichter”, "Set to ON ")


1 Like

Is there somewhere an overview on all the variables that are prefilled in the JavaScript (newState, oldState, event, …)

yes :slight_smile:


1 Like

Thanks :slight_smile:
But I can’t spot newstate and oldstate. Are there more of them?

For a changed event it should be:
newstate = event.itemState
oldstate = event.oldItemState

1 Like