Closed drumfreak closed 6 years ago
thisRequest.dps[options.dps.toString] = options.set;
Seems to be missing the () behind toString. This caused issues setting dps values with using this package from homebridge.
For example:
tuya.set({id: 'xxxxxxxxxxxxxxxxxxxx', 'dps': 2, set: true}).then(() => console.log('device was changed'))
Would fail because toString is not a function in prototype.
Proposed change:
thisRequest.dps[options.dps.toString()] = options.set;
or even:
if (options.dps === undefined) { thisRequest.dps = {1: options.set}; } else { thisRequest.dps = {}; thisRequest.dps[options.dps] = options.set; }
https://github.com/codetheweb/tuyapi/blob/290d6e937130d15e091a143cd094b6f8b2979eab/index.js#L233
Oops, thanks for the heads up. (I should really get around to adding test cases.) Should be fixed now.
Thank you @codetheweb
thisRequest.dps[options.dps.toString] = options.set;
Seems to be missing the () behind toString. This caused issues setting dps values with using this package from homebridge.
For example:
tuya.set({id: 'xxxxxxxxxxxxxxxxxxxx', 'dps': 2, set: true}).then(() => console.log('device was changed'))
Would fail because toString is not a function in prototype.
Proposed change:
thisRequest.dps[options.dps.toString()] = options.set;
or even:
https://github.com/codetheweb/tuyapi/blob/290d6e937130d15e091a143cd094b6f8b2979eab/index.js#L233