Where do I find documentation for Item commands?

However, I could not find a list of the actual commands. Is there one?

Have a look here.

I am not sure exactly what you are looking for, but here is an example to try to put it all together:

Let’s assume you have the following items:

Switch   aSwitch
Contact  aContact

You can then do the following in a rule:


What is listed as Command Types in http://docs.openhab.org/concepts/items.html might be a bit confusing, but this is the type of command or state that you can give as input to the .sendCommand() or .postUpdate() methods.

Please note that not all item types (e.g. the Contact) supports the sendCommand method.

If you scroll down it tells you which commands you can send to the relevant types.

Thanks Daniel, exactly what I was looking for. I was apparently on the wrong Items page, and my Google search did not work out either!

It seems I might be on the wrong path. What I’m trying to achieve is to make a rule that updates a String item with an exec binding. I want to forward a value from another item. postUpdate seems to work as intended in the log, but it has no effect. If I understand the documentation correctly, this action just updates what the state of an item is, but don’t trigger any actions.

sendCommand, on the other hand, does not seem to work with a value. As per the documentation Daniel referred to, the commands are a fixed set of statements.

Any pointers?

Could you post your items and rules please?


String Hc2_Stue_Sofalys
String Hc2_Stue_Sofalys_get { channel="exec:command:hc2gw_get_44:output" }
String Hc2_Stue_Sofalys_set { channel="exec:command:hc2gw_set_44:input" }


rule "a"                                                                                                                                                                         
    Item Hc2_Stue_Sofalys_get changed
   logInfo("HC2", "Sofalys changed: {}", Hc2_Stue_Sofalys_get.state)

rule "b"
    Item Hc2_Stue_Sofalys changed
    logInfo("HC2", "Sofalys manually changed: {}", Hc2_Stue_Sofalys.state)
    //sendCommand(Hc2_Stue_Sofalys_set, Hc2_Stue_Sofalys.state)

Console (when manipulating the first Item from Habpanel):

21:38:39.023 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'Hc2_Stue_Sofalys' received command 40
21:38:39.033 [INFO ] [marthome.event.ItemStateChangedEvent] - Hc2_Stue_Sofalys changed from 72 to 40
21:38:39.051 [INFO ] [g.eclipse.smarthome.model.script.HC2] - Sofalys manually changed: 40
21:38:39.056 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'b': An error occured during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.sendCommand(org.eclipse.smarthome.core.items.Item,java.lang.String) on instance: null

Could you try:

rule "b"
    Item Hc2_Stue_Sofalys changed
    logInfo("HC2", "Sofalys manually changed: {}", Hc2_Stue_Sofalys.state)
1 Like

Hi all, I would like to check an item’s last update timestamp inside a rule. Where can I find documentation of item methods and properties?