Generic Commit; Most likely a fix or small feature
This commit is contained in:
@@ -21,10 +21,12 @@ export class HomeAssistantService extends BaseService<HomeAssistantClient> {
|
|||||||
const position = positionResult.result as HomeAssistantDeskPositionResult;
|
const position = positionResult.result as HomeAssistantDeskPositionResult;
|
||||||
|
|
||||||
if (position.as_boolean) {
|
if (position.as_boolean) {
|
||||||
throw Error("desk is already in standing position");
|
throw Error(
|
||||||
|
`desk is already in standing position and has been for ${position.last_changed.toReadable(true)}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (position.last_changed.seconds < 120) {
|
if (position.last_changed.seconds < 300) {
|
||||||
throw Error("desk has moved too recently");
|
throw Error("desk has moved too recently");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +36,7 @@ export class HomeAssistantService extends BaseService<HomeAssistantClient> {
|
|||||||
|
|
||||||
return this.getSuccessfulResult(result);
|
return this.getSuccessfulResult(result);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const error_message = `error starting stand automation. ${error}`;
|
const error_message = `error starting stand automation. ${error instanceof Error ? error.message : error}`;
|
||||||
logWarning(error_message);
|
logWarning(error_message);
|
||||||
return this.getErrorResult(error_message);
|
return this.getErrorResult(error_message);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user