2021-01-23 10:45:55 +01:00
|
|
|
{% if forecast %}
|
|
|
|
{% set numSteps = forecast | calcNumSteps %}
|
2019-01-06 12:30:26 +01:00
|
|
|
{% set currentStep = 0 %}
|
2019-01-04 19:43:48 +01:00
|
|
|
<table class="{{ config.tableClass }}">
|
2021-08-01 09:39:07 +02:00
|
|
|
{% if config.ignoreToday %}
|
|
|
|
{% set forecast = forecast.splice(1) %}
|
|
|
|
{% endif %}
|
2019-01-06 12:30:26 +01:00
|
|
|
{% set forecast = forecast.slice(0, numSteps) %}
|
2018-12-27 17:14:03 +01:00
|
|
|
{% for f in forecast %}
|
2019-01-06 12:24:26 +01:00
|
|
|
<tr {% if config.colored %}class="colored"{% endif %} {% if config.fade %}style="opacity: {{ currentStep | opacity(numSteps) }};"{% endif %}>
|
2022-01-02 11:35:29 -07:00
|
|
|
{% if (currentStep == 0) and config.ignoreToday == false and config.absoluteDates == false %}
|
2020-10-12 09:10:51 +02:00
|
|
|
<td class="day">{{ "TODAY" | translate }}</td>
|
2022-01-02 11:35:29 -07:00
|
|
|
{% elif (currentStep == 1) and config.ignoreToday == false and config.absoluteDates == false %}
|
2020-10-12 09:10:51 +02:00
|
|
|
<td class="day">{{ "TOMORROW" | translate }}</td>
|
|
|
|
{% else %}
|
|
|
|
<td class="day">{{ f.date.format('ddd') }}</td>
|
|
|
|
{% endif %}
|
|
|
|
<td class="bright weather-icon"><span class="wi weathericon wi-{{ f.weatherType }}"></span></td>
|
|
|
|
<td class="align-right bright max-temp">
|
2021-04-12 18:34:33 +02:00
|
|
|
{{ f.maxTemperature | roundValue | unit("temperature") | decimalSymbol }}
|
2020-10-12 09:09:42 +02:00
|
|
|
</td>
|
2020-10-12 09:10:51 +02:00
|
|
|
<td class="align-right min-temp">
|
2021-04-12 18:34:33 +02:00
|
|
|
{{ f.minTemperature | roundValue | unit("temperature") | decimalSymbol }}
|
2020-10-12 09:10:51 +02:00
|
|
|
</td>
|
|
|
|
{% if config.showPrecipitationAmount %}
|
Tidy up precipitation (#3023)
Fixes #2953
This is an attempt to fix the issue with precipitation amount and
percentage mixup. I have created a separate
`precipitationPercentage`-variable where the probability of rain can be
stored.
The config options now has the old `showPrecipitationAmount` in addition
to a new setting: `showPrecipitationProbability` (shows the likelihood
of rain).
<details>
<summary>Examples</summary>
### Yr
I tested the Yr weather provider for a Norwegian city Bergen that has a
lot of rain. I have removed properties that are irrelevant for this demo
from the config-samples below.
Config:
```js
{
module: "weather",
config: {
weatherProvider: "yr",
type: "current",
showPrecipitationAmount: true,
showPrecipitationProbability: true
}
},
{
module: "weather",
config: {
weatherProvider: "yr",
type: "hourly",
showPrecipitationAmount: true,
showPrecipitationProbability: true
}
},
{
module: "weather",
config: {
weatherProvider: "yr",
type: "daily",
showPrecipitationAmount: true,
showPrecipitationProbability: true
}
}
```
Result:<br/>
<img width="444" alt="screenshot"
src="https://user-images.githubusercontent.com/34011212/216775423-4e37345c-f915-47e5-8551-7c544ebd24b1.png">
</details>
---------
Co-authored-by: Magnus Marthinsen <magmar@online.no>
Co-authored-by: Veeck <github@veeck.de>
2023-02-04 19:02:55 +01:00
|
|
|
<td class="align-right bright precipitationAmount">
|
|
|
|
{{ f.precipitationAmount | unit("precip", f.precipitationUnits) }}
|
|
|
|
</td>
|
|
|
|
{% endif %}
|
|
|
|
{% if config.showPrecipitationProbability %}
|
|
|
|
<td class="align-right bright precipitationProbability">
|
|
|
|
{{ f.precipitationProbability }}%
|
|
|
|
</td>
|
2020-10-12 09:10:51 +02:00
|
|
|
{% endif %}
|
2018-12-27 17:14:03 +01:00
|
|
|
</tr>
|
2019-01-06 12:30:26 +01:00
|
|
|
{% set currentStep = currentStep + 1 %}
|
2018-12-27 17:14:03 +01:00
|
|
|
{% endfor %}
|
|
|
|
</table>
|
2018-07-02 15:43:24 +02:00
|
|
|
{% else %}
|
2019-01-04 19:43:48 +01:00
|
|
|
<div class="dimmed light small">
|
2021-01-20 14:06:00 -05:00
|
|
|
{{ "LOADING" | translate }}
|
2019-01-04 19:43:48 +01:00
|
|
|
</div>
|
2018-05-21 10:57:22 +02:00
|
|
|
{% endif %}
|
2017-10-01 13:50:15 +02:00
|
|
|
|
2019-05-14 15:00:30 -05:00
|
|
|
<!-- Uncomment the line below to see the contents of the `forecast` object. -->
|
2018-05-21 10:57:22 +02:00
|
|
|
<!-- <div style="word-wrap:break-word" class="xsmall dimmed">{{forecast | dump}}</div> -->
|