Skip to content

Commit 4ba2a9d

Browse files
committed
bugfix: start-stop not working
1 parent a0abd1c commit 4ba2a9d

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

src/Capabilities/OpenCloseController.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,11 @@ bool OpenCloseController<T>::sendOpenCloseEvent(int openPercent, String cause) {
238238
*/
239239
template <typename T>
240240
bool OpenCloseController<T>::handleOpenCloseController(SinricProRequest &request) {
241-
if (request.action != FSTR_OPEN_CLOSE_setOpenClose && request.action != FSTR_OPEN_CLOSE_adjustOpenClose) {
242-
return false;
243-
}
244-
245241
T* device = static_cast<T*>(this);
246242

247243
bool success = false;
248244

249-
if ((directionOpenCloseCallback || openCloseCallback) && request.action == FSTR_OPEN_CLOSE_setOpenClose) {
245+
if (request.action == FSTR_OPEN_CLOSE_setOpenClose) {
250246
bool hasOpenDirection = !request.request_value[FSTR_OPEN_CLOSE_openDirection].isNull();
251247
int openPercent = request.request_value[FSTR_OPEN_CLOSE_openPercent];
252248

@@ -259,9 +255,11 @@ bool OpenCloseController<T>::handleOpenCloseController(SinricProRequest &request
259255
success = openCloseCallback(device->deviceId, openPercent);
260256
request.response_value[FSTR_OPEN_CLOSE_openPercent] = openPercent;
261257
}
258+
259+
return success;
262260
}
263261

264-
if ((adjustOpenCloseCallback || adjustDirectionOpenCloseCallback) && request.action == FSTR_OPEN_CLOSE_adjustOpenClose) {
262+
if (request.action == FSTR_OPEN_CLOSE_adjustOpenClose) {
265263
bool hasOpenDirection = !request.request_value[FSTR_OPEN_CLOSE_openDirection].isNull();
266264
int openRelativePercent = request.request_value[FSTR_OPEN_CLOSE_openRelativePercent];
267265

@@ -274,9 +272,11 @@ bool OpenCloseController<T>::handleOpenCloseController(SinricProRequest &request
274272
success = adjustOpenCloseCallback(device->deviceId, openRelativePercent);
275273
request.response_value[FSTR_OPEN_CLOSE_openPercent] = openRelativePercent;
276274
}
275+
276+
return success;
277277
}
278278

279-
return success;
279+
return false;
280280
}
281281

282282
} // SINRICPRO_NAMESPACE

src/Capabilities/StartStopController.h

+4-7
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,6 @@ bool StartStopController<T>::sendPauseUnpauseEvent(bool pause, String cause) {
148148

149149
template <typename T>
150150
bool StartStopController<T>::handleStartStopController(SinricProRequest &request) {
151-
if (request.action != FSTR_START_STOP_setStartStop || request.action != FSTR_START_STOP_setPauseUnpause) {
152-
return false;
153-
}
154-
155151
T* device = static_cast<T*>(this);
156152

157153
bool success = false;
@@ -162,14 +158,15 @@ bool StartStopController<T>::handleStartStopController(SinricProRequest &request
162158
request.response_value[FSTR_START_STOP_start] = start;
163159
return success;
164160
}
165-
else if (startStopCallbackCallback && request.action == FSTR_START_STOP_setPauseUnpause) {
161+
162+
if (pauseUnpauseCallback && request.action == FSTR_START_STOP_setPauseUnpause) {
166163
bool pause = request.request_value[FSTR_START_STOP_pause];
167-
success = startStopCallbackCallback(device->deviceId, pause);
164+
success = pauseUnpauseCallback(device->deviceId, pause);
168165
request.response_value[FSTR_START_STOP_pause] = pause;
169166
return success;
170167
}
171168

172-
return success;
169+
return false;
173170
}
174171

175172
} // SINRICPRO_NAMESPACE

0 commit comments

Comments
 (0)