Trying to get an http request working.
Here’s my item:
String weather_air_quality_birchlane "Air Quality [%s]" <pollen> (g_weather) { http="<[http://hilltop.gw.govt.nz/Data.hts?Service=Hilltop&Request=GetData&Site=Birch%20Lane%20AQ&Measurement=PM10:600000:default]" }
I seem to get the following in the log (http log with debug on)
2018-11-26 08:16:59.706 [ERROR] [b.core.service.AbstractActiveService] - Error while executing background thread HTTP Refresh Service
java.util.UnknownFormatConversionException: Conversion = 'L'
at java.util.Formatter$FormatSpecifier.conversion(Formatter.java:2691) [?:?]
at java.util.Formatter$FormatSpecifier.<init>(Formatter.java:2720) [?:?]
at java.util.Formatter.parse(Formatter.java:2560) [?:?]
at java.util.Formatter.format(Formatter.java:2501) [?:?]
at java.util.Formatter.format(Formatter.java:2455) [?:?]
at java.lang.String.format(String.java:2940) [?:?]
at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:144) [241:org.openhab.binding.http:1.12.0]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) [218:org.openhab.core.compat1x:2.3.0]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [218:org.openhab.core.compat1x:2.3.0]
Just trying to pull any data at this stage. Then later there’s a specific value I want.
Number weather_air_quality_birchlane "Air Quality [%.2f ug/m3]" (g_weather) { http="<[http://hilltop.gw.govt.nz/Data.hts?Service=Hilltop&Request=GetData&Site=Birch%20Lane%20AQ&Measurement=PM10:60000:XPATH(/Hilltop/Measurement/Data/E[1]/I1/text() )]" }
Here’s the xml data:
<?xml version="1.0" ?>
<Hilltop>
<Agency>GWRC</Agency>
<Measurement SiteName="Birch Lane AQ">
<DataSource Name="PM10" NumItems="1">
<TSType>StdSeries</TSType>
<DataType>SimpleTimeSeries</DataType>
<Interpolation>Instant</Interpolation>
<ItemInfo ItemNumber="1">
<ItemName>PM10</ItemName>
<ItemFormat>F</ItemFormat>
<Units>ug/m3</Units>
<Format>###.##</Format>
</ItemInfo>
</DataSource>
<Data DateFormat="Calendar" NumItems="1">
<E>
<T>2018-11-26T07:00:00</T>
<I1>1.80</I1>
</E>
</Data>
</Measurement>
</Hilltop>