I am trying to use a dynamic URL to fetch some data from pvoutput.org about my solar panel production. In services/http.cfg I have this config:
http:pvoutputb.url=https://pvoutput.org/service/r2/getoutput.jsp?df=%1$tY%1$tm%1$td?tz=Europe/Amsterdam{X-Pvoutput-Apikey=string-API-key&X-Pvoutput-SystemId=numeric-id}
%1$tY%1$tm%1$td should expand to todays date as YYYYMMDD I think, but it does not.
This is used in my items as:
Number Solar_production_D "Solar [%.1f KWh]" { http="<[pvoutputb:60000:JS(getProduction.js)]" }
transform/getProduction.js reads the CSV output from pvoutput.org:
(function(i) {
var array = i.split(",");
var solardate = array[0]
var solarproduction = array[1] / 1000
return solarproduction;
})(input)
In the log file I see that the date is not expanded in the URL:
2017-10-06 09:56:08.069 [DEBUG] [ab.binding.http.internal.HttpBinding] - item 'Solar_production_D' is fetched from cache
2017-10-06 09:56:08.069 [DEBUG] [ab.binding.http.internal.HttpBinding] - updating cache for 'pvoutputb' ('https://pvoutput.org/service/r2/getoutput.jsp?df=%1$tY%1$tm%1$td?tz=Europe/Amsterdam')
2017-10-06 09:56:08.474 [WARN ] [org.openhab.io.net.http.HttpUtil ] - Method failed: HTTP/1.1 500 Server Error
2017-10-06 09:56:08.485 [DEBUG] [ab.binding.http.internal.HttpBinding] - transformed response is 'NaN'
2017-10-06 09:56:08.485 [DEBUG] [ab.binding.http.internal.HttpBinding] - Couldn't create state for item 'Solar_production_D' from string 'NaN'
How can I fix my config so the date gets inserted in the URL so I only see today’s output from pvoutput.org?
Many thanks for your help.