Skip to content

Commit da81f34

Browse files
committed
Limit Fan speed (1..3)
1 parent 438a9c0 commit da81f34

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/SinricProFanUS.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,17 @@ bool SinricProFanUS::handleRequest(const char* deviceId, const char* action, Jso
7878
if (actionString == "setRangeValue" && setRangeValueCallback) {
7979
int rangeValue = request_value["rangeValue"] | 0;
8080
success = setRangeValueCallback(String(deviceId), rangeValue);
81+
if (rangeValue < 1) rangeValue = 1;
82+
if (rangeValue > 3) rangeValue = 3;
8183
response_value["rangeValue"] = rangeValue;
8284
return success;
8385
}
8486

8587
if (actionString == "adjustRangeValue" && adjustRangeValueCallback) {
8688
int rangeValueDelta = request_value["rangeValueDelta"] | 0;
8789
success = adjustRangeValueCallback(String(deviceId), rangeValueDelta);
90+
if (rangeValueDelta < 1) rangeValueDelta = 1;
91+
if (rangeValueDelta > 3) rangeValueDelta = 3;
8892
response_value["rangeValue"] = rangeValueDelta;
8993
return success;
9094
}

0 commit comments

Comments
 (0)