Skip to content

Commit

Permalink
Do not catch command cache errors, throw the original error
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Jul 10, 2020
1 parent 364c005 commit 6a9106d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/src/modules/tasmota/tasmotaHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ export class TasmotaHandler extends BrandModuleBase {
private async getAcStatus(minion: Minion): Promise<MinionStatus | ErrorResponse> {
try {
await request(`http://${minion.device.pysicalDevice.ip}/cm?cmnd=State`);
return await this.commandsCacheManager.getCachedStatus(minion);

} catch (error) {
logger.warn(`Sent Tasmota command ${minion.minionId} fail, ${JSON.stringify(error.message)}`);
Expand All @@ -113,6 +112,7 @@ export class TasmotaHandler extends BrandModuleBase {
message: 'tasmota request fail.',
} as ErrorResponse;
}
return await this.commandsCacheManager.getCachedStatus(minion);
}

private async setSwitchStatus(minion: Minion, setStatus: MinionStatus): Promise<void | ErrorResponse> {
Expand All @@ -128,8 +128,8 @@ export class TasmotaHandler extends BrandModuleBase {
}

private async setAcStatus(minion: Minion, setStatus: MinionStatus): Promise<void | ErrorResponse> {
const hexCommandCode = await this.commandsCacheManager.getIrCommand(minion, setStatus) as string;
try {
const hexCommandCode = await this.commandsCacheManager.getIrCommand(minion, setStatus) as string;
// Convert the broadlink command format to the pules array
const pulesArray = broadlinkToPulesArray(hexCommandCode);

Expand Down

0 comments on commit 6a9106d

Please sign in to comment.