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

Commit e061316

Browse files
committed
Move attribute setting to setup since we no longer delete the clients
1 parent 9338a07 commit e061316

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/main.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ void setup() {
2525
carousel.disableAllIndicators();
2626
carousel.setTargetFPS(3);
2727

28+
currentWeatherClient.setMetric(IS_METRIC);
29+
currentWeatherClient.setLanguage(OPEN_WEATHER_LANGUAGE);
30+
forecastClient.setMetric(IS_METRIC);
31+
forecastClient.setLanguage(OPEN_WEATHER_LANGUAGE);
32+
uint8_t allowedHours[] = {12, 0};
33+
forecastClient.setAllowedHours(allowedHours, sizeof(allowedHours));
34+
2835
Homie_setFirmware("weather-station", "0.0.1");
2936
Homie_setBrand("IoT");
3037
Homie.onEvent(onHomieEvent);
@@ -312,16 +319,10 @@ void updateData() {
312319
dstOffset = UTC_OFFSET * 3600 + dstAdjusted.time(nullptr) - time(nullptr);
313320

314321
drawProgress(50, F("Updating conditions..."));
315-
currentWeatherClient.setMetric(IS_METRIC);
316-
currentWeatherClient.setLanguage(OPEN_WEATHER_LANGUAGE);
317322
currentWeatherClient.updateCurrentById(
318323
&currentWeather, owApiKey.get(), OPEN_WEATHER_MAP_LOCATION_ID);
319324

320325
drawProgress(70, F("Updating forecasts..."));
321-
forecastClient.setMetric(IS_METRIC);
322-
forecastClient.setLanguage(OPEN_WEATHER_LANGUAGE);
323-
uint8_t allowedHours[] = {12, 0};
324-
forecastClient.setAllowedHours(allowedHours, sizeof(allowedHours));
325326
forecastClient.updateForecastsById(forecasts, owApiKey.get(),
326327
OPEN_WEATHER_MAP_LOCATION_ID,
327328
MAX_FORECASTS);

0 commit comments

Comments
 (0)