NOOB http configuration not discovering device

  • Platform information:
    • Hardware: RaspberryPI 3B+/1GB Mem/32GB disk
    • OS: Raspbian GNU/Linux 10 (buster)
    • Java Runtime Environment:OpenJDK Runtime Environment (build 11.0.12+7-post-Raspbian-2deb10u1)
    • openHAB version: openHAB 3.1.0 Release
  • Issue of the topic: HTTP configuration not finding item
  • Please post configurations (if applicable):
UID: http:url:85fb01a1b2
label: HTTP URL Thing
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: true
  headers:
    - bus=1
    - addr=0x76
  baseURL: http://hastings2:5000/i2c/thermometer/bme280
  delay: 0
  stateMethod: GET
  refresh: 30
  commandMethod: GET
  stateTransformation: JSONPATH:$.bme280.thermometer
  contentType: application/json
  timeout: 3456
  bufferSize: 4096
  • Items configuration related to the issue
  • Sitemap configuration related to the issue
  • Rules code related to the issue
  • Services configuration related to the issue
  • If logs where generated please post these here using code fences:

I have BME280 device on the same host as the openHAB server. The url is http://hastings2:5000/i2c/thermometer/bme280?addr=0x76&bus=1
which returns:
{“bme280”:"{“hostname”: “hastings2”, “ip”: “127.0.0.1”, “mac”: “b8:27:eb:c1:f2:4d”, “bus”: 1, “address”: 118, “chip_id”: 96, “chip_version”: 0, “temperature”: 23.92, “temperature_scale”: “C”, “pressure”: 1016.7327165724124, “pressure_scale”: “hPa”, “humidity”: 44.896159593430646, “humidity_scale”: “%”, “expiry”: “2021-09-30T21:25:45.246724-04:00”, “time”: “2021-09-30T21:25:44.246724-04:00”}"}
in the browser. I haven’t done an item config. I’m not sure what it should look like. I’ve turned on debug for as much as I see that might be reasonable:

openhab> log:list
Logger                                             │ Level
───────────────────────────────────────────────────┼──────
ROOT                                               │ INFO
javax.jmdns                                        │ ERROR
javax.mail                                         │ ERROR
org.apache.karaf.jaas.modules.audit                │ INFO
org.apache.karaf.kar.internal.KarServiceImpl       │ ERROR
org.apache.karaf.shell.ssh.SshUtils                │ ERROR
org.apache.karaf.shell.support                     │ OFF
org.apache.sshd                                    │ WARN
org.eclipse.lsp4j                                  │ OFF
org.eclipse.smarthome                              │ INFO
org.jupnp                                          │ ERROR
org.openhab                                        │ DEBUG
org.openhab.ui.paper                               │ DEBUG
org.openhab.ui.paper.internal                      │ DEBUG
org.ops4j.pax.url.mvn.internal.AetherBasedResolver │ ERROR
org.ops4j.pax.web.pax-web-runtime                  │ OFF
smarthome.event                                    │ DEBUG
smarthome.event.InboxUpdateEvent                   │ DEBUG
smarthome.event.InboxUpdatedEvent                  │ DEBUG
smarthome.event.ItemAddedEvent                     │ DEBUG
smarthome.event.ItemRemoveEvent                    │ DEBUG
smarthome.event.ItemRemovedEvent                   │ DEBUG
smarthome.event.ItemStateEvent                     │ DEBUG
smarthome.event.ThingAddedEvent                    │ DEBUG
smarthome.event.ThingRemovedEvent                  │ DEBUG
smarthome.event.ThingStatusInfoEvent               │ DEBUG
openhab>

I don’t get anything in the logs that indicates anything to do with the HTTP binding.

  1. For http things, after you configure the thing, you also have to configure channels manually. From the item config you’ve posted, it doesn’t look like you have any channels configured yet. Click on the channel tab on the thing page and then click Add Channel
  2. It looks like your jsonPath and the json payload you’ve posted don’t match:

Do you have the JSONPath transform installed?
image

It’s under settings>>transformatons.

Comment: start simple. Make a temporary string channel, link it a string Item, no transformations and see that you get the expected message.
When that is working, start on the JSONPATH stuff.

Duh! I thought I had put the channel definition in, but obviously it’s not there. Adding the channel def at least caused data to start flowing in the logs. Here’s the new definition:

UID: http:url:85fb01a1b2
label: HTTP URL Thing
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: false
  baseURL: http://hastings2:5000/i2c/thermometer/bme280?bus=1&addr=0x76
  delay: 0
  stateMethod: GET
  refresh: 30
  commandMethod: GET
  contentType: application/json
  timeout: 3456
  bufferSize: 4096
channels:
  - id: Temperature
    channelTypeUID: http:string
    label: Temperature
    description: ""
    configuration: {}

I defined an item in the UI as follows:

Name: HTTPURLThing
Label: HTTP URL Thing
Type: Number:Temperature
Category:
Semantic Class: Equipment

There is also an item:

HTTPRULThing_Temperature
Direct Parent Groups: HTTPURLThing
Channel Links: HTTP URL THING/Temperature/http:url:85fb01a1b2:Temperature

When I click on the channel link I get Temperature/HTTP URL Thing with 2 channels listed, the first is a Temperature channel listed as ONLINE, the second is:
Temperature/String/HTTPURLThing_Temperature
I’ve set the profile to JSONPath, the JSONPath Expression to $.bme280.temperature and the State Formatter to %.1f °C.

The resultant log entry is
16:11:21.941 [WARN ] [rofiles.JSonPathTransformationProfile] - Could not transform state '{“bme280”:"{“hostname”: “hastings2”, “ip”: “127.0.0.1”, “mac”: “b8:27:eb:c1:f2:4d”, “bus”: 1, “address”: 118, “chip_id”: 96, “chip_version”: 0, “temperature”: 24.11, “temperature_scale”: “C”, “pressure”: 1016.7128832107587, “pressure_scale”: “hPa”, “humidity”: 46.7051686445871, “humidity_scale”: “%”, “expiry”: “2021-10-01T16:11:22.931260-04:00”, “time”: “2021-10-01T16:11:21.931260-04:00”}"}
’ with function ‘$.bme280.temperature’ and format ‘%.1f °C’

If i leave the State Formatter empty, I get the same with:

’ with function ‘$.bme280.temperature’ and format ‘%s’

There is a small bug with transformation profiles

but you don’t need to use any profile at all, HTTP binding allows you to do transformation in the channel settings.
See stateTransformation