64 lines
2.0 KiB
C
64 lines
2.0 KiB
C
// weather.h
|
|
#ifndef WEATHER_H
|
|
#define WEATHER_H
|
|
|
|
#include "tls_certificates.h"
|
|
#include <Arduino.h>
|
|
#include <WiFiClientSecure.h>
|
|
#include <HTTPClient.h>
|
|
#include <ArduinoJson.h>
|
|
|
|
// Struct for current weather data
|
|
struct CurrentWeather {
|
|
String time; // e.g., "2024-11-26T20:30"
|
|
int interval; // e.g., 900
|
|
float temperature_2m; // e.g., 7.1°C
|
|
};
|
|
|
|
// Struct for daily weather data
|
|
struct DailyWeather {
|
|
String time; // Date as string e.g., "2024-11-26"
|
|
int weather_code; // e.g., 61 (WMO code)
|
|
float temperature_2m_max; // e.g., 10.9°C
|
|
float temperature_2m_min; // e.g., 6.5°C
|
|
String sunrise; // e.g., "2024-11-26T06:47"
|
|
String sunset; // e.g., "2024-11-26T14:59"
|
|
float precipitation_sum; // e.g., 2.3 mm
|
|
float wind_speed_10m_max; // e.g., 11.5 km/h
|
|
float wind_gusts_10m_max; // e.g., 25.6 km/h
|
|
};
|
|
|
|
// Main weather data structure
|
|
struct WeatherData {
|
|
float latitude; // e.g., 52.52
|
|
float longitude; // e.g., 13.419998
|
|
float elevation; // e.g., 38 meters
|
|
String timezone; // e.g., "Europe/London"
|
|
String timezone_abbreviation; // e.g., "GMT"
|
|
|
|
// Current weather data
|
|
CurrentWeather current;
|
|
|
|
// Daily weather data
|
|
DailyWeather daily;
|
|
};
|
|
|
|
// Bitmap Images
|
|
extern const unsigned char sun[] PROGMEM;
|
|
extern const unsigned char freezingRain[] PROGMEM;
|
|
extern const unsigned char partialCloud[] PROGMEM;
|
|
extern const unsigned char showers[] PROGMEM;
|
|
extern const unsigned char cloud[] PROGMEM;
|
|
extern const unsigned char snow[] PROGMEM;
|
|
extern const unsigned char rain[] PROGMEM;
|
|
extern const unsigned char hail[] PROGMEM;
|
|
extern const unsigned char fog[] PROGMEM;
|
|
extern const unsigned char heavyRain[] PROGMEM;
|
|
extern const unsigned char hi[] PROGMEM;
|
|
extern const unsigned char lo[] PROGMEM;
|
|
extern const unsigned char wind[] PROGMEM;
|
|
|
|
WeatherData getWeather(float latitude, float longitude);
|
|
const unsigned char* getWeatherBitmap(int weatherCode);
|
|
|
|
#endif |