diff --git a/lib/SensorDevice.js b/lib/SensorDevice.js index 7e07740..57ab2dc 100644 --- a/lib/SensorDevice.js +++ b/lib/SensorDevice.js @@ -119,14 +119,12 @@ module.exports = class SensorDevice extends GeneralDevice { getValueInfo(task, key) { const taskValue = task.TaskValues.find(t => t.Name == key); if (!taskValue) { - this.log('Could not find task value named', key); - return false; + throw new Error('Could not find task value named', task, key); } - const taskSettings = this.getDriver().taskTypes.find(t => t.name == task.Type); + const taskSettings = this.getDriver().taskTypes.find(t => t.name == task.normalizedType); if (!taskSettings) { - this.log('No settings found for this task', key); - return false; + throw new Error('No settings found for this task', task, key); } return [taskValue, taskSettings] @@ -137,7 +135,12 @@ module.exports = class SensorDevice extends GeneralDevice { return; } - const [taskValue, taskSettings] = this.getValueInfo(this.task, key); + try { + const [taskValue, taskSettings] = this.getValueInfo(this.task, key); + } catch (error) { + this.log('Failed to process new value for task', error); + return false; + } let capabilityName = null; if (taskSettings.values) {