[SOLVED] Execute a rule wait and execute another rule

Hello All,

First general question. Is there some documentation on the openhab2 rule syntax with nice examples that I can refer to, so that i do not need to bother anybody :slight_smile: But, of course this is a great community.

My problem is the following.
I have a PTZ from Foscam that i do not allow access to the internet (Model is R2). A 1 second snapshot is put onto my sitemap just using and Image URL.

For those how are interested the URL for this model is:

Now I want to be able to control the PTZ of the camera. Unfortunately the camera does not have url-commands that reflect the button in the GUI of the camera. The command is to either move the camera to the maximum level (for example to the very right) or to stop. My idea now is to create an item

Number		F0_NI_CA_01_FE_CMD		"PTZ Nico's room Fast Ethernet"		<oremote>

that has the mappings on the sitemap

Switch	item=F0_NI_CA_01_FE_CMD label="Control Camera" icon="oremote" mappings=[0="Left", 1="Right", 2="Up", 3="Down"]

With the example of pushing the button “Right” is want the camera to do the following:

  1. Execute
  2. wait for 1 second
  3. Execute

Can someone point me into the right direction on this problem.

Thanks already in advance.

Best regards

  • Platform information:
    • Hardware: Raspberry PI 3 b+
    • OS:Rasbian
    • Java Runtime Environment: 1.8.0_201-b09
    • openHAB version: 2.4.0-1

Not the best one, but I use something similar with executeCommandLine. It stops at this line until 8sec. are ended and then goes to the next line in the rule

executeCommandLine("...", 8000)

maybe this will work with HTTP too?

One can use Thread::sleep(1000) to pause for a second. It would be better to use a Timer though.

    createTimer(now.plusSeconds(1), [ | sendHttpGetRequest(... ]

Look at the Actions HomeAutomation posted for the correct arguments to sendHttpGetRequest.

Not quite right. It waits for up to 8 seconds for the script you call to execute to finish before killing it. If the script returns in only 1 seconds, executeCommandLine will return in 1 second.

Thanks. Works like a charm for up down left and right.

Also the design pattern library looks really good.