Skip to content

Commit

Permalink
No longer blowing up on missing settings (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
climategadgets committed Apr 19, 2024
1 parent 258d976 commit ea6f10b
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import java.time.Clock;
import java.time.Duration;
import java.util.Optional;
import java.util.concurrent.CountDownLatch;

/**
Expand Down Expand Up @@ -206,7 +207,7 @@ private Boolean recordDeviceState(Signal<Boolean, ProcessController.Status<Doubl
var demand = stateSignal.payload == null ? 0 : stateSignal.payload.signal;

economizerStatus = new EconomizerStatus(
new EconomizerSettings(config.settings),
Optional.ofNullable(config.settings).map(EconomizerSettings::new).orElse(null),
sample,
demand,
stateSignal.getValue(),
Expand Down Expand Up @@ -277,6 +278,13 @@ private Signal<Double, Void> computeCombined(IndoorAmbientPair pair) {
return new Signal<>(clock.instant(), 0d);
}


if (config.settings == null) {

logger.trace("no settings, bailing out with 0");
return new Signal<>(clock.instant(), 0d);
}

// Let's take care of corner cases first

if (pair.indoor == null || pair.ambient == null) {
Expand Down

0 comments on commit ea6f10b

Please sign in to comment.