HTTP Binding http.cfg error

Hi,

Getting the following eror when starting openhab 2.2.0-SNAPSHOT:

2017-12-20 21:29:04.901 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedService, org.osgi.service.event.EventHandler, id=308, bundle=215/mvn:org.openhab.binding/org.openhab.binding.http/1.12.0-SNAPSHOT]: Unexpected problem updating configuration org.openhab.http
java.lang.NumberFormatException: For input string: "5000.0"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:?]
        at java.lang.Integer.parseInt(Integer.java:580) [?:?]
        at java.lang.Integer.valueOf(Integer.java:766) [?:?]
        at org.openhab.binding.http.internal.HttpBinding.updated(HttpBinding.java:507) [215:org.openhab.binding.http:1.12.0.201712180210]
        at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189) [7:org.apache.felix.configadmin:1.8.16]
        at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152) [7:org.apache.felix.configadmin:1.8.16]
        at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85) [7:org.apache.felix.configadmin:1.8.16]
        at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1479) [7:org.apache.felix.configadmin:1.8.16]
        at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1435) [7:org.apache.felix.configadmin:1.8.16]
        at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [7:org.apache.felix.configadmin:1.8.16]
        at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [7:org.apache.felix.configadmin:1.8.16]
        at java.lang.Thread.run(Thread.java:748) [?:?]

I have my following config in http.cfg:

timeout=6000
granularity=1000
format=true

froniusrtd.url=http://192.168.1.180/solar_api/v1/GetInverterRealtimeData.cgi?Scope=System
froniusrtd.updateInterval=4000

beckhoff.url=https://raspberrypi/update.php{Authorization=Basic xyz}
beckhoff.updateInterval=2000

beckhoff http binding works.
but froniusrtd not… where is the 5000 comming from in the exception ?
is it possible to configure on raspberrypi at another path as /etc/openhab2/services/http.cfg ?
thanks,

What are your Item configs?

many item configs, but for the fronius inverter only this one:

Number PV_DaySumCalculated "Tagessumme [%.1f kWh]" <inverter>
Number PV_YearSumCalculated "Jahressumme [%.1f MWh]" <inverter>
Number PV_TotalCalculated "Gesamtsumme [%.1f MWh]" <inverter>
Number PV_Prozent "Auslastung [%.2f %%]" <inverter>
Number  PV_Current      "Aktuelle Leistung [%0f W]"     <inverter>      (PV)    { http="<[froniusrtd:4000:JSONPATH($.Body.Data.PAC.Values.1)]" }
Number  PV_DaySum       "Tagessumme [%0f Wh]"   <inverter>      (PV)            { http="<[froniusrtd:30000:JSONPATH($.Body.Data.DAY_ENERGY.Values.1)]" }
Number  PV_YearSum      "Jahressumme [%0f Wh]"  <inverter>      (PV)            { http="<[froniusrtd:30000:JSONPATH($.Body.Data.YEAR_ENERGY.Values.1)]" }
Number  PV_Total        "Gesamtsumme [%0f Wh]"  <inverter>      (PV)            { http="<[froniusrtd:30000:JSONPATH($.Body.Data.TOTAL_ENERGY.Values.1)]" }

rule:

rule "pv-berechnung in kWh"
when
	Item PV_DaySum received update
then
	PV_DaySumCalculated.postUpdate((PV_DaySum.state as Number)/1000);
end

rule "pv-berechnung in MWh"
when
	Item PV_YearSum received update
then
	PV_YearSumCalculated.postUpdate((PV_YearSum.state as Number)/1000000);
end

rule "pv-berechnung total in MWh"
when
	Item PV_Total received update
then
	PV_TotalCalculated.postUpdate((PV_Total.state as Number)/1000000);
end

rule "auslastung"
when
	Item PV_Current received update
then
	PV_Prozent.postUpdate((PV_Current.state as Number)/8100*100);
end

I don’t have any clues. It looks right to me.

thank you. already updated to 2.2.0-SNAPSHOT made an update a few minutes ago.
Inverter does not change data at the moment because of night modus :slight_smile: maybe something is cached?
Before stopping working to show the data, I enabled format at paper UI http configuration.

cached value is a good hunch. The error line number appears to indicate the 5000.0 is a value for updateInterval.

I noticed that in my version (openhab 2.2.0-SNAPSHOT) there is no configuration for http available.
I changed under bindings HTTP BINDING the format. now tried to set it back to false and using http.cfg with format=true.

I do get some errors when changing http.cfg in the log.
So where exactly is the 5000.0 value configured in which file ?
I read in this forum that another person hat exactly the same problem caused by double configuration of http.cfg under /userdata/…
he deleted the userdata file and problem was solved…
I do only have /etc/openhab2/ directory on my raspberrypi, or is there anywhere else another http.cfg ?
thanks,

SOLVED !!!
Each time I saved http.cfg I got this error:

dler, id=320, bundle=215/mvn:org.openhab.binding/org.openhab.binding.http/1.12.0-SNAPSHOT]: Unexpected problem updating configuration org.openhab.http
java.lang.NumberFormatException: For input string: "5000.0"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:?]
        at java.lang.Integer.parseInt(Integer.java:580) [?:?]
        at java.lang.Integer.valueOf(Integer.java:766) [?:?]
        at org.openhab.binding.http.internal.HttpBinding.updated(HttpBinding.java:507) [215:org.openhab.binding.http:1.12.0.201712210210]
        at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189) [7:org.apache.felix.configadmin:1.8.16]
        at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152) [7:org.apache.felix.configadmin:1.8.16]
        at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85) [7:org.apache.felix.configadmin:1.8.16]
        at org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1792) [7:org.apache.felix.configadmin:1.8.16]
        at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [7:org.apache.felix.configadmin:1.8.16]
        at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [7:org.apache.felix.configadmin:1.8.16]
        at java.lang.Thread.run(Thread.java:748) [?:?]

Solved by rewriting the URLs and updateInverval again. (not copy paste!).
Maybe there was an unicode symbol or anything else…
now everything works again !

Hopefully I can help someone with the same problem.

2 Likes