From 204d823650c49e7b7edc26d10b5523f85fd96883 Mon Sep 17 00:00:00 2001 From: Andrey Klimov Date: Wed, 4 Mar 2020 17:15:40 +0300 Subject: [PATCH] fix: "Enum not found" (#9) * Add refrigerator support * Add method getDevice * Add dishwasher * Refactoring * Add dryer * Add washer * Fixed import paths in devices/ac * Fix Celsius to Fahrenheit convertion table * Fixed swing mode so they are mapped to the right enum. * Add the ACDevice to the client loader * Small fix * Update ac.ts * Update client.ts * All parameters to lowercase * Add multi language support * Fix for comments * Add localization support * Update README.md * Add tslint * Refactoring * Some fixes for tslint * Add devices to export * Fix "[DEP0091] DeprecationWarning: crypto.DEFAULT_ENCODING is deprecated." (https://github.com/nodejs/node/issues/23203) * Add more options for RefrigeratorDevice * Small fix for washer * Add parameter --token into cli * Add method setOn * Add OnOffEnum * Update README.md * Fix for lookupReference Add more device types * Fix for lookupEnum Co-authored-by: Tom Green --- lib/utils.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/utils.ts b/lib/utils.ts index 0284022..e23732a 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -26,6 +26,9 @@ export function asTime(hoursKey: string, minutesKey: string, data: any) { * @returns The enum value. */ export function lookupEnum(attr: string, data: any, device: Device) { + if (!(attr in data)) { + return null; + } return device.model.enumName(attr, data[attr]); }