Skip to content

Commit

Permalink
Update wohumi.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker committed Jul 13, 2024
1 parent ad1e593 commit d007341
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/device/wohumi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ export class WoHumi extends SwitchbotDevice {

const onState = byte1 & 0b10000000 ? true : false; // 1 - on
const autoMode = byte4 & 0b10000000 ? true : false; // 1 - auto
const humidity = byte4 & 0b01111111; // 0-100%, 101/102/103 - Quick gear 1/2/3
const percentage = byte4 & 0b01111111; // 0-100%, 101/102/103 - Quick gear 1/2/3
const humidity = autoMode ? 0 : percentage === 101 ? 33 : percentage === 102 ? 66 : percentage === 103 ? 100 : percentage;

const data = {
model: SwitchBotBLEModel.Humidifier,
modelName: SwitchBotBLEModelName.Humidifier,
modelFriendlyName: SwitchBotBLEModelFriendlyName.Humidifier,
onState: onState,
autoMode: autoMode,
// @deprecated Use the humidity property instead.
percentage: autoMode ? 0 : humidity,
humidity: autoMode ? 0 : humidity,
percentage: autoMode ? 0 : percentage,
humidity: humidity,
};

return data;
Expand Down

0 comments on commit d007341

Please sign in to comment.