From e1bcbcb00780372996057b824e79cfe21b2d4688 Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Wed, 23 Dec 2020 08:21:12 +0100 Subject: [PATCH] fix: writeValue logs undefined valueId --- lib/ZwaveClient.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/ZwaveClient.js b/lib/ZwaveClient.js index 455c1b6393c..81786ab2556 100644 --- a/lib/ZwaveClient.js +++ b/lib/ZwaveClient.js @@ -761,7 +761,7 @@ function removeValue (zwaveNode, args) { /** * Get the device id of a specific node * - * @param {Object} node Internal node object + * @param {any} node Internal node object * @returns A string in the format `--` that unique identifhy a zwave device */ function getDeviceID (node) { @@ -789,8 +789,8 @@ function findTargetValue (zwaveValue, definedValueIds) { /** * Get a valueId from a valueId object * - * @param {Object} v Zwave valueId object - * @param {Boolean} nodeId Add node identifier + * @param {any} v Zwave valueId object + * @param {boolean} nodeId Add node identifier * @returns The value id unique identifier */ function getValueID (v, withNode) { @@ -933,9 +933,9 @@ ZwaveClient.prototype.heal = function () { /** * Used to Update an hass device of a specific node * - * @param {Object} hassDevice The Hass device - * @param {Integer} nodeId The nodeid - * @param {Boolean} deleteDevice True to remove the hass device from node hass devices + * @param {any} hassDevice The Hass device + * @param {number} nodeId The nodeid + * @param {boolean} deleteDevice True to remove the hass device from node hass devices */ ZwaveClient.prototype.updateDevice = function ( hassDevice, @@ -1890,7 +1890,7 @@ ZwaveClient.prototype.callApi = async function (apiName, ...args) { */ ZwaveClient.prototype.writeValue = async function (valueId, value) { if (this.driverReady) { - logger.info(`Writing ${value} to ${valueId.id}`) + logger.info(`Writing ${value} to ${getValueID(valueId)}`) let result = false @@ -1923,13 +1923,13 @@ ZwaveClient.prototype.writeValue = async function (valueId, value) { } } catch (error) { logger.error( - `Error while writing ${value} on ${valueId.id}: ${error.message}`, + `Error while writing ${value} on ${getValueID(valueId)}: ${error.message}`, error ) } // https://zwave-js.github.io/node-zwave-js/#/api/node?id=setvalue if (result === false) { - logger.error(`Unable to write ${value} on ${valueId.id}`) + logger.error(`Unable to write ${value} on ${getValueID(valueId)}`) } } }