HTTP3: how to add channels

Using openhab3.RC1 and tried to play around with my HTTP-items a bit, but am lost… :wink:
Still trying to find my way in UI-based configuration! :wink:
I’d like to simply get the answer of an http-request into an item.

So I:

  1. added the Thing
  2. tried to add an channel
  3. bind that channel to an item
UID: http:url:mowas
label: HTTP Gefahren MoWas
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: false
  baseURL: https://warnung.bund.de/bbk.mowas/gefahrendurchsagen.json
  refresh: 600
  commandMethod: GET
  contentType: application/json
  timeout: 3000
channels:
  - id: mowasJSON
    channelTypeUID: http:string
    label: JSON von Mowas
    description: ""
    configuration: {}

but in the end, the item stays NULL

My working string channel for the actual tasmota version looks like this:

UID: http:url:TasmotaReleaseVersion
label: Tasmota Release Version
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: false
  refresh: 43200000
  baseURL: https://api.github.com/repos/arendst/Tasmota/tags
  commandMethod: GET
  timeout: 3000
channels:
  - id: Version
    channelTypeUID: http:string
    label: Version
    description: ""
    configuration:
      stateTransformation: JSONPATH:$[0].name

Note that it is updated twice a day only! Your update rate of 600 msec seems rather short.

thanks for the hint, I don’t know it’s the default? or did I change it? :wink: thought it was secs, not msecs.
the only thing I can see, is you have an stateTransformation, but I’d like to have the http-response (JSON) as a whole in the string and then do the magic in a rule (because the response could be empty sometime after Covid and I only need the warnings for my region…)

Reading the docs, I seem to be wrong! Refresh is in seconds, only the timeout is in msec!

In this case I don’t see a reason why you do not get any response!

1 Like

So, after playing around a bit, I now got to see the WARN in the log:

2020-12-15 13:34:33.920 [WARN ] [p.internal.http.HttpResponseListener] - Requesting 'https://warnung.bund.de/bbk.mowas/gefahrendurchsagen.json' (method='GET', content='null') failed: Buffering capacity 2097152 exceeded

I can’t see, where I can define the buffer size…?

Hi there!
I also started with OH3 with some of my http items.
For me it is not possible to define a channel via textual configuration. Could someone give me a working example config?
Thing definition is ok and working, but the defined channel does not appear in the UI and nothing happens to the linked items…

Thing http:url:WVStainztal1 "Wasserhärte" [baseURL="https://www.xxx.xxx/information-wasserhaerte", refresh=30] {
Channels:
	String : hardness "Wasserhärte" [stateTransformation="REGEX:xxxx"]
}

Thanks,
MW

It looks like i was able to solve my problem.
Channel definition has to be done with predefined channel type definitions, so
Type string : xxx
has to be used!

BR, MW