Webhook changing a switch item


I am trying to get a webhook to change a switch item to ON (I will use a rule to turn it off).
I have this at the moment and it works well when I fire it from a web browser, (the security is set to security:option=EXTERNAL so no issues with authentication)

Item File:
Switch MotionEye

I have tested the webhook via this process and it works really well triggering IFTTT, it sends email notifications well on motion detection.
When I put my openHAB URL in it does not trigger.

I am using MotionEyeOS as the trigger for both occasions.
Does anyone have this running? What HTTP method is needed to work withthe restAPI?

Any push in the right direction would be great.

Kind Regards,

Are you trying to have IFTTT call your URL? If so, it won’t be able to invoke a 192.168.x.x address. That’s for private LAN usage.


No I was just testing that the motion did fire the webhook. The IFTTT was just a test, confirmed it fires a URL.

Trying to figure out the right URL to trigger the switch item.
I would much prefer for the webhook to talk with openHAB directly on the LAN.


If you use the HTTPS connection you must supply username and password. Even with security set to EXTERNAL the HTTPS connection still requires username/password.

You can provide that as part of the URL though:


It worked from the browser probably because you had logged into your sitemap at somepoint in the recent past so your authorization was cached.


Thanks for that, makes perfect sense.

The URL (https://user:password@ works perfectly when triggered from a browser (that hadn’t been logged in).

It does not work when I put it in MotionEyeOS though (the motion is being triggered as I am getting emails from MotionEyeOS).

Does openHAB need any specific config settings or does it need to be a specific HTTP method for openHAB to work? There are several options for the webhook, GET, POST (query), POST (form) & POST (json). I did give them all a go without luck.


The CMD syntax should be a GET.

The MotionEye may not work with a self signed certificate. If that is the case it won’t establish the SSL/TLS connection to your OH. If this is the case you will need to get a cert and install it to OH. You can get a free one from letsencrypt.org.

Thanks Rick, I currently have my openhab on a windows box and am struggling a bit with understanding how to get a certificate installed, after a fair bit of reading.

I might stick with the IFTTT process for a bit and start to think about setting up a linux box for openhab.

Thanks again.


i am using a command instead of a webhook and it works fine:

curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "ON" ""

I run motionEye on raspi 3b+ and openhab on an other Raspi 4.
Now I try to get the motion detection information into openhab but this does not appear.
What I did:

  1. I created an Item in openhab Switch MotionDetection "Bewegungsmeldung Kamera" (gKamera)

  2. I added a new frame and this Item to my sitemap Frame { Text item=MotionDetection label="Bewegungsmeldung Kamera" icon="motion" visibility=[MotionDetection==ON] }

  3. I added run a command under Motion Notification curl -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "ON" "http://ip_Raspi_4:8080/rest/items/MotionDetection/state" Switch MotionDetection "Bewegungsmeldung Kamera" (gKamera) p

  4. I added run and end a command under Motion Notification curl -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "OFF" "http://ip_Raspi_4:8080/rest/items/MotionDetection/state"

Unfortunately nothing arrives in Openhab after a motion is detected in motioneye.
Any idea what is wrong?

Thanks, I was just looking for something like this, works great :slight_smile: