Hey there =)
I am trying to send an Item a Command. The name of the item is dynamic and therefore set via a variable “item”. The declaration looks like this:
var item = “”
[…]
item = “Steckdosen_Ventilator”
The setting of the variable works; tested via logInfo:
23:36:35 [INFO] [org.eclipse.smarthome.model.script.] - Steckdosen_Ventilator
I am trying to send this item an ON or OFF command. However I can’t get that to work. I tried
-
item.state.sendCommand(ON) AND
item.state.toString.sendCommand(ON)
Error: Error during the execution of rule ‘Testrule’: ‘state’ is not a member of ‘java.lang.String’; -
item.toString.sendCommand(ON) AND
item.sendCommand(ON)
Error: Error during the execution of rule ‘Testrule’: An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.sendCommand(java.lang.String,java.lang.String) on instance: null
Can someone help my on how the syntax is? Thanks in advance.
Felix