Barometer-Trend mit eingeführt
This commit is contained in:
@@ -59,6 +59,7 @@ class WeatherData(BaseModel):
|
||||
wind_dir: Optional[float] = None
|
||||
rain: Optional[float] = None
|
||||
rain_rate: Optional[float] = None
|
||||
bar_trend: Optional[int] = None
|
||||
received_at: datetime
|
||||
|
||||
|
||||
@@ -138,7 +139,7 @@ async def get_latest_weather():
|
||||
SELECT id, datetime, temperature, humidity, pressure,
|
||||
wind_speed * 1.60934 as wind_speed,
|
||||
wind_gust * 1.60934 as wind_gust,
|
||||
wind_dir, rain, rain_rate, received_at
|
||||
wind_dir, rain, rain_rate, bar_trend, received_at
|
||||
FROM weather_data
|
||||
ORDER BY datetime DESC
|
||||
LIMIT 1
|
||||
@@ -172,7 +173,7 @@ async def get_weather_history(
|
||||
SELECT id, datetime, temperature, humidity, pressure,
|
||||
wind_speed * 1.60934 as wind_speed,
|
||||
wind_gust * 1.60934 as wind_gust,
|
||||
wind_dir, rain, rain_rate, received_at
|
||||
wind_dir, rain, rain_rate, bar_trend, received_at
|
||||
FROM weather_data
|
||||
WHERE datetime >= NOW() - make_interval(hours => %s)
|
||||
ORDER BY datetime DESC
|
||||
|
||||
@@ -139,6 +139,11 @@
|
||||
margin: 0.2rem -0.5rem -0.5rem -0.5rem;
|
||||
}
|
||||
|
||||
.bar-trend {
|
||||
font-size: 0.9em;
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.dashboard-footer {
|
||||
/* margin-top: 2rem;
|
||||
*/ padding-top: 1rem;
|
||||
|
||||
@@ -218,6 +218,21 @@ const WeatherDashboard = ({ data, currentData = [], rainData = [], timeRange = '
|
||||
return { yMin: min, yMax: max }
|
||||
}
|
||||
|
||||
// Hilfsfunktion: BarTrend-Wert (Davis VantagePro) → Pfeil + Label
|
||||
// Werte laut Davis Serial Communication Reference Rev 2.6.1:
|
||||
// -60 = Falling Rapidly, -20 = Falling Slowly, 0 = Steady,
|
||||
// 20 = Rising Slowly, 60 = Rising Rapidly, 80/'P' = kein Trend
|
||||
const barTrendArrow = (trend) => {
|
||||
switch (trend) {
|
||||
case -60: return { arrow: '⬇⬇', label: 'Fällt schnell' }
|
||||
case -20: return { arrow: '⬇', label: 'Fällt langsam' }
|
||||
case 0: return { arrow: '→', label: 'Stabil' }
|
||||
case 20: return { arrow: '⬆', label: 'Steigt langsam' }
|
||||
case 60: return { arrow: '⬆⬆', label: 'Steigt schnell' }
|
||||
default: return null
|
||||
}
|
||||
}
|
||||
|
||||
// Gemeinsame Chart-Optionen (angepasst an Zeitraum)
|
||||
const getCommonOptions = () => {
|
||||
// Prüfe, ob es ein custom range ist
|
||||
@@ -999,7 +1014,7 @@ const WeatherDashboard = ({ data, currentData = [], rainData = [], timeRange = '
|
||||
<div className="chart-item">
|
||||
<div className="current-value">Aktuell: {current.pressure?.toFixed(0) || '-'} hPa</div>
|
||||
<div className="chart-container">
|
||||
<h3><span>🌐 Luftdruck{aggregationSuffix}</span><span className="unit">[hPa]</span></h3>
|
||||
<h3><span>🌐 Luftdruck{aggregationSuffix}{(() => { const t = barTrendArrow(current.bar_trend); return t ? <span className="bar-trend" title={t.label}> {t.arrow}</span> : null })()}</span><span className="unit">[hPa]</span></h3>
|
||||
<div className="chart-wrapper">
|
||||
<HighchartsReact highcharts={Highcharts} options={pressureOptions} />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user