Control Items using the zapier webhooks

Is there any way to control items using the rest api and zapier webhooks?

I really got no idea of it but maybe it could work. This is what I found:

You can use Zapier to define triggers. The action then would need to call the OH REST API. This means your system needs to be reachable from the internet.
The OH REST API is described here: https://www.openhab.org/docs/configuration/restdocs.html

So how do i need to configure the webhook?

  • we talk about the action that you would like to do, right ?
  • what is the action you would like to do ?
  • what is the URL of your REST item ?
  • what is your user name ?
  • what is your password ?

You can use the REST API on your OH instance ( /doc/index.html ) to collect all the paramerters or like described in the docs by using the curl command line.

curl -X POST --header “Content-Type: text/plain” --header “Accept: application/json” -d “ON” “http://openhab:8080/rest/items/TelegramSwitch

This is the curl I use. It works using the console but I don’t really know how to get this into zapier or webhooks. Everything I tried so far failed. Hmm

1 Like

URL: http://externalip:8080/rest/items/TelegramSwitch

DATA: ON
HEADER:
Left field: Accept
Right field: application/json
Left field: Content-Type
Right field: text/plain

Basic Auth: YourUser|YourPassword

Okay great!

But how to get the external ip for openhab?

You need to open a port on your router and allow port forwarding to your OH instance.
But this means OH is accessible from the internet so you need to take the right measures to secure your instance: https://www.openhab.org/docs/installation/security.html

@Fabian_Birkert, I don’t know what your level of technical expertise is, but if you have to ask how to open an external IP to openHAB then you should almost certainly not do it.

I say the same thing for myself. I don’t know enough about the security implications of exposing openHAB to the Internet, so I’m not going to do it. All it takes is one little mistake on my part to make my entire home network and all of the devices on it accessible to hackers around the world.

So before you go down this path, ask yourself how important it is to connect Zapier to openHAB, and if the risk is worth it. Then, go to the effort of learning all about opening router ports and the risks that come with doing that–don’t just figure out the bare minimum and then expose your network to the world. If you do that, then you’ve only yourself to blame if/when you get hacked.

1 Like