PRO: Openweather Forecast – weather at a location

current time at Augsburg: 01.02.2023, 09:54:14, timezone: Europe/Berlin
sunrise: 08:13:18
sunset: 17:00:49
temp: 4.93 Celcius, feels_like -0.42 Celsius
windspeed: 9.69
Deutscher Wetterdienst 01:00 – 18:00:
There is a risk of gale-force gusts (Level 2 of 4). Max. gusts: 55-70 km/h; Wind direction: west; Increased gusts: near showers and in exposed locations < 85 km/h

See how this is done:


JCI-Template:

  • urlparam4twig: lat#lon#su
  • URL:
{% set lat = 48.1371079 %}{% if urlparam.lat %}{% set lat = (urlparam.lat | e) %}{% endif %}
{% set lon =11.5753822 %}{% if urlparam.lon %}{% set lon = (urlparam.lon | e) %}{% endif %}
https://api.openweathermap.org/data/2.5/onecall?lat={{lat}}&lon={{lon}}&appid=...
  • twig-template:
current time at {{urlparam.su|e}}: {{ (current.dt+timezone_offset) | date("d.m.Y, H:i:s")   }}, timezone: {{timezone}}<hr>
sunrise: {{ (current.sunrise+timezone_offset) | date("H:i:s")   }}<br>
sunset: {{ (current.sunset+timezone_offset) | date("H:i:s")   }}<br>
temp: {{current.temp-273.15}} Celcius, feels_like {{current.feels_like-273.15}} Celsius<br>
windspeed: {{current.wind_speed}}<br>
{% if (alerts|length)>0 %}
{{alerts.0.sender_name}} {{(a.start+timezone_offset)| date("H:i") }} - {{(alerts.0.end+timezone_offset) | date("H:i") }}: <br>{{alerts.0.description}}
{% endif %}