OpenHab API


(Trevor Daniel) #1

Hi,

I am new to OpenHab. I have had a read through the website but don't seem to be able to find any documentation on API access.

I would like to be able to install OpenHab on a Raspberry Pi, open a firewall port on my router to the outside world, and send commands to the API to control my hardware.

Is this possible?

Could anyone point me to the API documentation so I can see when endpoints are available please?

Any help would be greatly appreciated!

Thanks

Trev


(Kiran Patil) #2

Refer the below link.

https://www.eclipse.org/smarthome/documentation/features/rest.html


(Trevor Daniel) #3

Are eclipse & OpenHab the same thing then?

Do they share a common API?

Trev


(Jürgen Baginski) #4

openHAB is build to work with different so called bindings in order to communicate with other devices. In your wording such a binding would hold the required API for the device. Different devices need different APIs or better bindings. The binding are the communication layer between openHAB and the devices.
What kind of devices do you have.
Why do you need to open the firewall, that would be necessary only if you which to control from outside the local net. There are other possibilities for that available.


(Trevor Daniel) #5

Thanks for taking the time to reply. I am new to this so apologies for my lack of knowledge.

I am a c#.net developer and am used to working with REST JSON APis... So, I was hoping that somehow I there was a "controller" of some type that enable me to send a command to it over my network saying, for example, turn light 1 on to 50%....

I would like to write my own custom app to send the commands. So trying to work out what going "in between" my application and the zwave devices...

Trev


(Rossko57) #6

This is what Openhab does overall. Openhab provides rules for self-contained automation, and a choice of UIs for interaction. Difficult to see what you are trying to achieve here.


(Erkan Balci) #7

For remote access, you can do everything you want via openhab cloud or namely myopenhab.org. You don't even need to open a port on the router or firewall for this. Also you can use android or ios app for this, again using openhab cloud. So you don't need to do anything on the REST API unless there's something special that openhab can't do at the moment...


(Harm Reck) #8

Do you already have openhab installed somewhere? If so i'd suggest you install the REST API Documentation in PaperUI under addons/misc. after that a link to it should appear on your landing page. The you have a fairly detailed doc of the api and can even make calls to it right there in your browser. I found that extremely helpful while writing my own little UI for it.

If you don't have a working installation you can use the link posted above. Openhab is built on top of eclipse smarthome, so the REST API is the same.

As for remote access i also would recommend myopenhab, that way you don't have to worry about authentification/security issues yourself.


(Olivier Leplus) #9

Hi,
I have installed the REST API Documentation.
I would like to create my own tablet-wall interface by using the API.
However, I have started to develop a web app in Angular 5 but I have CORS issues.

Failed to load http://localhost:8080/rest/events: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:4200’ is therefore not allowed access.

Dis anyone tried to access the API through Javascript before?

Thanks