I have one question: Is it possible to program a server- client system with java. I want to code my own Java program, with this program I want to control my Smart Home. Because of this, I want to create a server-client connection with openHAB, so that when something happens the server(openHab) sends it to the client(Java Programm).
Thank you for your help.
Can your app simply subscribe to an Item using the Rest API in openHAB2 or can it receive command line messages?
Or TCP / UDP packets?
It can recive commands
You might need to give a little more information before you get any useful replies…
I want to create an external APP where you can switch some ligths, for example. So I think the best way to do this is to create a server client connection, where the server sends a command (for example: "/item switch ") and the client something like: "/item updatestate ". So my question is can you do this and if yes how and with which commands.
Use the rest api commands in openHAB that is the purpose of the rest api.
i know but this is only json and i want a live time update
The existing UI use the REST API to issue live commands and get live status.
If you are stuck with JSON, you can’t use that.
But it would probably be easier for you to write a JSON-to-REST broker than to create some new openHAB service.
I did mention Subscribe, not poll