Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.

Commit 9338a07

Browse files
committed
Move OpenWeather api key to homie setting
1 parent d66d5c4 commit 9338a07

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Settings.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// OpenWeather details
22
#define OPEN_WEATHER_DISPLAYED_CITY_NAME "Vancouver"
33
#define OPEN_WEATHER_LANGUAGE "en"
4-
#define OPEN_WEATHER_MAP_APP_ID ""
54
#define OPEN_WEATHER_MAP_LOCATION_ID "6173331"
65

76
// Define data display formats

src/main.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ time_t dstOffset = 0;
99
uint8_t moonAge = 0;
1010
String moonAgeImage = "";
1111

12+
HomieSetting<const char*> owApiKey("ow_api_key", "Open Weather API Key");
13+
1214
void setup() {
1315
Serial.begin(115200);
1416

@@ -313,14 +315,14 @@ void updateData() {
313315
currentWeatherClient.setMetric(IS_METRIC);
314316
currentWeatherClient.setLanguage(OPEN_WEATHER_LANGUAGE);
315317
currentWeatherClient.updateCurrentById(
316-
&currentWeather, OPEN_WEATHER_MAP_APP_ID, OPEN_WEATHER_MAP_LOCATION_ID);
318+
&currentWeather, owApiKey.get(), OPEN_WEATHER_MAP_LOCATION_ID);
317319

318320
drawProgress(70, F("Updating forecasts..."));
319321
forecastClient.setMetric(IS_METRIC);
320322
forecastClient.setLanguage(OPEN_WEATHER_LANGUAGE);
321323
uint8_t allowedHours[] = {12, 0};
322324
forecastClient.setAllowedHours(allowedHours, sizeof(allowedHours));
323-
forecastClient.updateForecastsById(forecasts, OPEN_WEATHER_MAP_APP_ID,
325+
forecastClient.updateForecastsById(forecasts, owApiKey.get(),
324326
OPEN_WEATHER_MAP_LOCATION_ID,
325327
MAX_FORECASTS);
326328

0 commit comments

Comments
 (0)