OpenHAB2 and HTTP binding: Minimal setup not working


I’m currently using OpenHAB 1 for my smart home installation. I’m thinking about migrating to OpenHAB2 and ran some tests, but I’m struggling with a simple HTTP item:

  1. I cannot receive an reading. In the console:
openhab> smarthome:items
L1_Voltage (Type=NumberItem, State=NULL, Label=L1:, Category=null)
openhab> smarthome:status L1_Voltage
  1. In the {Classic|Basic}UI, I don’t see my sitemap.

I’m running a fresh install of OpenHABian. I’m using GoSDM630 to read my smart meter. The JSON interface of this software is up and running:

$ curl

I have the HTTP and JSONPATH bindings installed. My (minimal) configuration looks like this:

  1. powergrid.items:
Number L1_Voltage "L1: [%.1f V]" { http="<[$.voltage.L1)]" } 
  1. smartmeter.thing:
Thing http:device:smartmeter "Smart Meter" @ "Keller" [] 
  1. default.sitemap:
sitemap default label="Smart Meter Demo" {                                                                                              
    Frame label="Strom" {                                                                                                               
        Text item=L1_voltage                                                                                                            

I don’t see anything unusual in the log:

2017-06-22 13:18:17.202 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'test.items'
2017-06-22 13:18:50.615 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'default.sitemap'
2017-06-22 13:18:53.715 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'SmartMeter.things'
2017-06-22 13:19:16.395 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
2017-06-22 13:19:30.108 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2017-06-22 13:19:33.656 [INFO ] [assic.internal.servlet.WebAppServlet] - Started Classic UI at /classicui/app
2017-06-22 13:19:38.180 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2017-06-22 13:19:43.173 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin
2017-06-22 13:19:45.332 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2017-06-22 13:21:26.091 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Stopped HABmin servlet
2017-06-22 13:21:26.609 [INFO ] [basic.internal.servlet.WebAppServlet] - Stopped Basic UI
2017-06-22 13:22:03.213 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2017-06-22 13:22:07.253 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin
2017-06-22 14:23:57.015 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'default.sitemap'

I’m clearly missing something. I tried to figure out how to link the smartmeter thing to the L1_voltage item, but the documentation of the HTTP binding does not give me any hint how to do this. Any thoughts?


The HTTP binding is a 1.x version binding. 1.x version bindings do not have Things. They work just the same way as they always have. So your 2. is invalid and unnecessary. There is no linking necessary because this binding doesn’t support Things.

I doubt the existence of this invalid Thing is causing the problem though. But just to be thorough, you link an Item to a Thing by using { channel="channel ID" } where channel ID is the Thing ID (in your invalid example that would be “http:device:smartmeter:channel”. The available channels are defined by the binding.

The Item looks correct to me so I’m not sure what is going on. First I would put the HTTP binding into TRACE logging to see if you can get some more information about the requests it is making.

Another alternative debugging approach might be setting up a Rule and use sendHttpGetRequest which will give you some more information you can log out that might give more information such as the return code, headers, etc.

1 Like


This actually put me on the right track. The problem was within my JSON transformation. After setting

openhab> log:set TRACE org.openhab.binding.http

within karaf I found the problem: JSONPATH queries are case sensitive (duh!). Now, my voltages are received correctly:

openhab> smarthome:items
L1_Voltage (Type=NumberItem, State=234.39999389648438, Label=L1:, Category=null)
L2_Voltage (Type=NumberItem, State=0, Label=L2:, Category=null)
L3_Voltage (Type=NumberItem, State=0, Label=L3:, Category=null

Thanks a lot!