Hi all,
I tried searching for “Display Openhab data on website” but the only results I got was how to extract data from a website to Openhab.
What I want is to display 2 temperature items on a website so my guests can see this data. There must be a simple way to do this and I’m probably not searching hard enough. So my apologies for that in advance.
Or is there a way to point someone to the page url. Or to display the page in a way no one can edit something?
Thanks
Hi @Koensk,
you can load states or entire items by using the rest api. A get request to http://openhab:8080/rest/items/temperature_outside/state
will give you the state of the item temperature_outside.
Does that already help you?
First we have to know what is possible on this website: PHP, SQL ???
With “sendHttpGetRequest” it is possible to call a PHP script, which save some data in SQL or a file.
SQL or the file can be called on load of your webiste, to display the data sent by openhab.
Thanks guys.
The things is. I don’t have a website yet. So in fact I think I could make a special Openhab page and make that somehow public so people could navigate to this page. Or is this a bad idea as we far as security goes
Otherwise I would just need to make a simple website and pull the data as Jan suggests.
That’s exactly what I meant.
I wrote my own webpage with NextJS because I know that toolkit quite well. NextJS is a React toolkit that allows you to write server side code. You do not need to expose openhab to the internet, only to the web server.
Choose a technology and we try to help you get openhab working with it.
- PHP
- NextJS / React
- Vanilla Javascript (Vanilla means pure js, the code you write is really the code in the browser)
- many, many more
I created some simple webpage with wordpress and Elementor. Would I be able to use your mentioned methode in this way?
Hi @Koensk
that should be possible but I do not know wordpress or any configuration of it. So I am not even sure what the wp_remote_get function is for, is it something for developers or something you can use?
So a simple way would be to create an OpenHAB 3 page and make a link or iframe.
Or if I just make a very very simple HTML website would that be an idea?
Maybe a better idea is to ask my website builder to take care of this. As this goes beyond all my knowledge ;-). So I have tot tell him to make a simple php website?
Show him the document about the REST API ( openHAB REST API | openHAB ). Show him the REST API Explorer, let him know the items to be displayed on the page and he will know what to do … If it is php, java, javascript, python or whatever doesn’t matter.
Thank you
-19 degree C for a swimming pool isn’t that a bit too cold ? Could do ice skating.
Haha yes it is. That’s the temp sensor of the freezer.