For example, I am using OpenWeather. Now those API calls seem to return metric units (for example meters per second for wind speed) by default. The API caller can request imperial (miles per hour) by appending &units=imperial to the URL.
Within KLWP, my settings are for units to be automatic. As I am in the USA, I expect the results to me, for example, in MPH. Can someone explain what is being done inside of KLWP when things are automatic?
Thanks
Hello,
As far as I know, KLWP uses local unit, based on our own location (or phone's location).
Have you tried to use this formula to get local unit?
$li(spdu)$
Alternatively, you can use if() formula to check the unit and display the converted value (ie. wind speed).
EXAMPLE
mph ➞ km/h
$if(li(spdu)=mph, 1.61*wi(wspeed), wi(wspeed))$km/h
km/h ➞ mph
$if(li(spdu)=mph, wi(wspeed), 0.62*wi(wspeed))$mph
Hope this helps.
Thanks but this proves incorrect. I checked the logcat and found KLWP making the following calls. So as you can now see, Kustom is specifically requesting results always in metric. Now, it is possible that it internally converts them to the current locale. But that was not my question. Cheers
https://api.openweathermap.org/data/2.5/weather?mode=json&lat=47.95
72&lon=-122.2394&units=metric&lang=en&APPID=K00
https://api.openweathermap.org/data/2.5/forecast/daily?mode=json&la
t=47.9572&lon=-122.2394&units=metric&lang=en&cnt=14&APPID=K00