You probably don’t need a binding for something like this. Take a look at Comprehensive Wunderground using HTTP Binding Example and see if something like that would work for you. It polls Wunderground and parses out the data from the returned JSON to populate various OH Items.
If you want to push the data rather than poll for it, you will need to make changes to your server that generates the JSON to publish the data in some way. One of the easiest ways would be to post the JSON to an OH Item using OH’s REST API and write a Rule to parse out and update Items as appropriate.
Especially if you are not super familiar with OH and/or Java programming, doing the above will be WAY less work.
You can learn and experiment with the OH REST API through the REST API Docs which not only documente the API but let you exercise and test the REST API right from the docs. You can install it from the Misc tab in Add ons in PaperUI.
Yes I have a server provides information in JSON format.
I want to read the status of each item (e.g. I have “light01” with the status of “ON”) using OpenHAB2 and I also need to be able to change the status (e.g. I have “light01” change the status to “OFF”) using OpenHAB2.
ok. all right - then I wanted to tell you exactly that, what Rich already wrote - but he wrote it better than me!
use the weather-binding example and retrieve your JSON with http-binding and then split it in items.
in fact, that one is very simple, because it has only one hierarchy. What I find weird, but it could be your browser changing the " to “ ”…
Ok. So I guess, you want at least three items, then you grab it like this:
in your http.cfg
yourname.updateInterval=60000 // one minute
maybe this link could be helpful regarding JSON, http://www.jsonschema2pojo.org/
Please, let me know if you find something ‘no good’ about the produced code, I have sometimes used it and I have not found anything suspected so far, the code has just worked, so just in case.
http.cfg sets the HTTP binding up to periodically poll the HTTP address and cache the address. In Thomas’s example it is configured to poll the URL once per minute.
This is so you can have multiple Items populated with the results from a single poll on the URL. Otherwise there would be a separate HTTP GET to the server for each Item.
Items are not defined in cfg files.
There is no binding.xml
Please review the Beginner’s Tutorial, the Concepts section of the User’s Guide, and the Items page under Configuration. To be successful with OH and to make progress you must have a basic understanding of Items, Things, and how they are related to each other and to Bindings.
Then review the HTTP Binding README which explains how the HTTP binding works and how to configure it.
In this particular case, the thing that is holding you back the most is a lack of understanding of some basic OH concepts. It will be hard for you to progress and hard for us to help until you have this basic understanding.
To provide high-level answers to some of your questions:
HTTP binding is a 1.x binding so there is nothing you can do to manage it in PaperUI beyond installation.
Items that use 1.x bindings must be defined in .items files.
The HTTP Binding README fully documents how to set up polling on an HTTP address (see Thomas’s example) as well as how to issue a command on a URL on demand.
One puts Items in .items files and then the Items can be put on your User’s UI (NOT PaperUI) based on how the UI works. In the case of BasicUI this means writing a .sitemap file. In HABPanel you can build up the UI in the browser.