Umrechnung der Windgeschwindigleit in km/h
Anzeige des aktuellen Wertes in der Grafik
This commit is contained in:
25
api/main.py
25
api/main.py
@@ -136,7 +136,11 @@ async def get_latest_weather():
|
||||
try:
|
||||
with conn.cursor() as cursor:
|
||||
cursor.execute("""
|
||||
SELECT * FROM weather_data
|
||||
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
|
||||
FROM weather_data
|
||||
ORDER BY datetime DESC
|
||||
LIMIT 1
|
||||
""")
|
||||
@@ -166,7 +170,11 @@ async def get_weather_history(
|
||||
try:
|
||||
with conn.cursor() as cursor:
|
||||
cursor.execute("""
|
||||
SELECT * FROM weather_data
|
||||
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
|
||||
FROM weather_data
|
||||
WHERE datetime >= NOW() - make_interval(hours => %s)
|
||||
ORDER BY datetime DESC
|
||||
LIMIT %s
|
||||
@@ -219,8 +227,8 @@ async def get_weather_statistics(
|
||||
MAX(temperature) as max_temperature,
|
||||
AVG(humidity) as avg_humidity,
|
||||
AVG(pressure) as avg_pressure,
|
||||
AVG(wind_speed) as avg_wind_speed,
|
||||
MAX(wind_gust) as max_wind_gust,
|
||||
AVG(wind_speed * 1.60934) as avg_wind_speed,
|
||||
MAX(wind_gust * 1.60934) as max_wind_gust,
|
||||
SUM(rain) as total_rain,
|
||||
COUNT(*) as data_points
|
||||
FROM weather_data
|
||||
@@ -252,8 +260,8 @@ async def get_daily_statistics(
|
||||
MAX(temperature) as max_temperature,
|
||||
AVG(humidity) as avg_humidity,
|
||||
AVG(pressure) as avg_pressure,
|
||||
AVG(wind_speed) as avg_wind_speed,
|
||||
MAX(wind_gust) as max_wind_gust,
|
||||
AVG(wind_speed * 1.60934) as avg_wind_speed,
|
||||
MAX(wind_gust * 1.60934) as max_wind_gust,
|
||||
SUM(rain) as total_rain,
|
||||
COUNT(*) as data_points
|
||||
FROM weather_data
|
||||
@@ -299,7 +307,10 @@ async def get_wind_data(
|
||||
try:
|
||||
with conn.cursor() as cursor:
|
||||
cursor.execute("""
|
||||
SELECT datetime, wind_speed, wind_gust, wind_dir
|
||||
SELECT datetime,
|
||||
wind_speed * 1.60934 as wind_speed,
|
||||
wind_gust * 1.60934 as wind_gust,
|
||||
wind_dir
|
||||
FROM weather_data
|
||||
WHERE datetime >= NOW() - make_interval(hours => %s)
|
||||
ORDER BY datetime ASC
|
||||
|
||||
Reference in New Issue
Block a user