Skip to content

Commit

Permalink
fix always on mode
Browse files Browse the repository at this point in the history
  • Loading branch information
sidoh committed Dec 29, 2017
1 parent 5b37d08 commit d53af7d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void updateTemperature(uint8_t* deviceId, float temp) {
if (settings.sensorPaths.count(strDeviceId) > 0) {
HTTPClient http;

String sensorPath = settings.sensorPaths[strDeviceId];
String sensorPath = settings.sensorPaths[deviceName];
time_t now = timestamp();
String url = String(settings.gatewayServer) + sensorPath;

Expand Down Expand Up @@ -86,6 +86,11 @@ void startSettingsServer() {
}

bool isSettingsMode() {
if (settings.opMode == OperatingMode::ALWAYS_ON) {
operatingState = OperatingState::SETTINGS;
return true;
}

if (operatingState != OperatingState::UNCHECKED) {
return operatingState == OperatingState::SETTINGS;
}
Expand Down Expand Up @@ -174,7 +179,7 @@ void loop() {

tempIface.loop();

if (isSettingsMode() || settings.opMode == OperatingMode::ALWAYS_ON) {
if (isSettingsMode()) {
time_t n = now();

if (n > (lastUpdate + settings.updateInterval)) {
Expand Down

0 comments on commit d53af7d

Please sign in to comment.