Files
thermostat-hw/main/api/ambient_weather.h
2026-08-03 20:31:28 -07:00

33 lines
776 B
C

#ifndef AMBIENT_WEATHER_H
#define AMBIENT_WEATHER_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <time.h>
#include "esp_err.h"
/*
* Fields mirror the Ambient Weather device data spec:
* https://github.com/ambient-weather/api-docs/wiki/Device-Data-Specs
*
* Note the API reports no textual "condition" or "icon" -- it is a personal
* weather station feed, not a forecast service.
*/
typedef struct {
float temp_f;
float humidity; /* percent */
float wind_mph;
bool has_temp;
bool has_humidity;
bool has_wind;
time_t last_update;
} weather_data_t;
esp_err_t weather_init(void);
esp_err_t weather_update(weather_data_t *data);
void weather_get_string(const weather_data_t *data, char *buf, size_t len);
#endif