weather day-report: No-data an trockenen Tagen abfangen
- Bewertungs-Banner: LEFT JOIN von der immer vorhandenen Temperatur-Reihe statt CROSS JOIN; leeres gw3000a_daily_rain killt die Zeile nicht mehr. Ergebnis als numerischer Code 0-4 mit Value-Mapping auf Text+Farbe (robust gegen Strings). - Regen-Karte: noValue "0 mm" statt "No data", wenn keine Regen-Samples vorliegen. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
"tags": ["weather", "ecowitt", "homeassistant", "report"],
|
||||
"timezone": "Europe/Berlin",
|
||||
"schemaVersion": 39,
|
||||
"version": 4,
|
||||
"version": 5,
|
||||
"refresh": "",
|
||||
"time": { "from": "now-1d/d", "to": "now/d" },
|
||||
"templating": { "list": [] },
|
||||
@@ -35,11 +35,11 @@
|
||||
"thresholds": { "mode": "absolute", "steps": [ { "color": "#868e96", "value": null } ] },
|
||||
"mappings": [
|
||||
{ "type": "value", "options": {
|
||||
"Sonnig & warm": { "color": "#ff922b", "index": 0 },
|
||||
"Warm": { "color": "#fab005", "index": 1 },
|
||||
"Regnerisch": { "color": "#4dabf7", "index": 2 },
|
||||
"Kalt": { "color": "#74c0fc", "index": 3 },
|
||||
"Unauffaellig": { "color": "#868e96", "index": 4 }
|
||||
"0": { "text": "Sonnig & warm", "color": "#ff922b", "index": 0 },
|
||||
"1": { "text": "Warm", "color": "#fab005", "index": 1 },
|
||||
"2": { "text": "Regnerisch", "color": "#4dabf7", "index": 2 },
|
||||
"3": { "text": "Wechselhaft", "color": "#868e96", "index": 3 },
|
||||
"4": { "text": "Kalt", "color": "#74c0fc", "index": 4 }
|
||||
} }
|
||||
]
|
||||
},
|
||||
@@ -60,7 +60,7 @@
|
||||
"datasource": { "type": "influxdb", "uid": "ha-weather-influx" },
|
||||
"rawQuery": true,
|
||||
"format": "table",
|
||||
"rawSql": "WITH s AS (SELECT max(value) AS smax FROM \"W/m²\" WHERE entity_id = 'gw3000a_solar_radiation' AND $__timeFilter(time)), u AS (SELECT max(value) AS uvmax FROM \"UV index\" WHERE entity_id = 'gw3000a_uv_index' AND $__timeFilter(time)), t AS (SELECT max(value) AS tmax FROM \"°C\" WHERE entity_id = 'gw3000a_outdoor_temperature' AND $__timeFilter(time)), r AS (SELECT max(value) AS rain FROM \"mm\" WHERE entity_id = 'gw3000a_daily_rain' AND $__timeFilter(time)) SELECT CASE WHEN s.smax >= 700 AND u.uvmax >= 6 THEN 'Sonnig & warm' WHEN t.tmax >= 25 THEN 'Warm' WHEN coalesce(r.rain, 0) >= 5 THEN 'Regnerisch' WHEN t.tmax <= 5 THEN 'Kalt' ELSE 'Unauffaellig' END AS \"Bewertung\" FROM s CROSS JOIN u CROSS JOIN t CROSS JOIN r"
|
||||
"rawSql": "WITH t AS (SELECT 1 AS k, max(value) AS tmax FROM \"°C\" WHERE entity_id = 'gw3000a_outdoor_temperature' AND $__timeFilter(time)), s AS (SELECT 1 AS k, max(value) AS smax FROM \"W/m²\" WHERE entity_id = 'gw3000a_solar_radiation' AND $__timeFilter(time)), u AS (SELECT 1 AS k, max(value) AS uvmax FROM \"UV index\" WHERE entity_id = 'gw3000a_uv_index' AND $__timeFilter(time)), r AS (SELECT 1 AS k, max(value) AS rain FROM \"mm\" WHERE entity_id = 'gw3000a_daily_rain' AND $__timeFilter(time)) SELECT CASE WHEN s.smax >= 700 AND u.uvmax >= 6 THEN 0 WHEN coalesce(r.rain, 0) >= 5 THEN 2 WHEN t.tmax >= 25 THEN 1 WHEN t.tmax <= 5 THEN 4 ELSE 3 END AS code FROM t LEFT JOIN s ON s.k = t.k LEFT JOIN u ON u.k = t.k LEFT JOIN r ON r.k = t.k"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -145,6 +145,7 @@
|
||||
"unit": "lengthmm",
|
||||
"decimals": 1,
|
||||
"displayName": "Regen",
|
||||
"noValue": "0 mm",
|
||||
"color": { "mode": "thresholds" },
|
||||
"thresholds": { "mode": "absolute", "steps": [
|
||||
{ "color": "#868e96", "value": null },
|
||||
|
||||
Reference in New Issue
Block a user