OpenHab and PHP

Hey all,

I’ve recently started with openHab and I think it’s the best tool to manage your smart home environment.
Now I want to build my own webinterface with HTML/PHP/JS.

Some general questions:

  • Which PHP version comes with openHab?
  • Where to put the custom webpage files?
  • Can you give me an example how to get all devices via php?

Thanks in advance!

No PHP version comes with OpenHAB.

If you want to control OpenHAB, you should have a look at the REST API.

Hi Christian,
You will want to install and LAMP server which will included PHP
In the web folder of your server then create an html with PHP code

The PHP code to call the list of all items in openhab is:

$response = http://openhab:8080/rest/items?recursive=false

You can then convert this into a PHP array with JSON_response:

$response = json_decode($response);

Hope that helps