Skip to content

Commanding

vbier edited this page Jun 16, 2019 · 4 revisions

Commanding HabPanelViewer

Send a command from openHAB

Commands can be sent using different mechanisms. One way is to send commands with rules. An example rule that triggers on motion detection and turns on the screen could look like this:

rule "HABPanelViewer Screen"
when
Item Motion_Contact changed from OPEN to CLOSED
then
Tablet_Command.sendCommand("SCREEN_ON");
end

This assumes that there is a contact item named Motion_Contact (that is configured as motion contact in HPV) and that the command item is named Tablet_Command.

You can send the same command using the openHAB console by typing:

smarthome:send Tablet_Command "SCREEN_ON"

Make sure to quote the complete command in the console as shown above.

If commanding does not work

Things to check in case HPV does not receive commands:

  • Make sure you have the server URL (without path) in the Server URL preference, e.g. https://openhabserver:443
  • Make sure this URL is shown in the menu (instead of "not connected")
  • Check the Status Information if other values can be obtained from openHAB. All reported items are also subscribed from openHAB and shown in square brackets. You might need to activate one of the sensors if you have not already done so.

If these are okay, then the connection to openHAB is working and you should check in the openHAB events log if openHAB is actually sending commands. There should be an entry like this in the events.log:

2018-07-08 07:21:57.923 [ome.event.ItemCommandEvent] - Item 'Tablet_Command' received command SCREEN_ON

If Status Information does show no subscribed values at all, the next thing to check is whether HPV can get updates from the server:

  • Open the following URL in chrome on your device:
    server URL/rest/events?topics=smarthome/items/name of command item/command
    (make sure you replace server URL and name of command item with correct values)

This should look as if the page is loading. If you now send a command to the command item with openHAB, you should see the command in the browser. Use a rule and sendCommand in order to send a command (not postUpdate!). If this does not work, check if your firewall allows your devices to communicate in the network.

Clone this wiki locally