AMoo-Miki / homebridge-tuya-lan

Homebridge plugin for IoT devices that use Tuya Smart's platform
MIT License
204 stars 52 forks source link

Error with two SimpleLight entries in configure.json #26

Closed AlainKaim closed 5 years ago

AlainKaim commented 5 years ago

Hello

I get an error when I declare in the config.json file two devices as SimpleLight. The error is : /usr/local/lib/node_modules/homebridge-tuya-lan/lib/SimpleLightAccessory.js:24 const characteristicOn = service.getCharacteristic(Characteristic.On) ^

TypeError: Cannot read property 'getCharacteristic' of undefined at SimpleLightAccessory._registerCharacteristics (/usr/local/lib/node_modules/homebridge-tuya-lan/lib/SimpleLightAccessory.js:24:42) at TuyaAccessory.BaseAccessory.device.once (/usr/local/lib/node_modules/homebridge-tuya-lan/lib/BaseAccessory.js:22:18) at Object.onceWrapper (events.js:285:13) at TuyaAccessory.emit (events.js:197:13) at TuyaAccessory._change (/usr/local/lib/node_modules/homebridge-tuya-lan/lib/TuyaAccessory.js:240:18) at TuyaAccessory._msgHandler (/usr/local/lib/node_modules/homebridge-tuya-lan/lib/TuyaAccessory.js:176:26) at /usr/local/lib/node_modules/homebridge-tuya-lan/node_modules/async/dist/async.js:4096:9 at Object.process (/usr/local/lib/node_modules/homebridge-tuya-lan/node_modules/async/dist/async.js:2344:17) at /usr/local/lib/node_modules/homebridge-tuya-lan/node_modules/async/dist/async.js:2252:19 at Immediate. (/usr/local/lib/node_modules/homebridge-tuya-lan/node_modules/async/dist/async.js:119:16)

If I change the type of either of the device to Outlet, everything works well. (I just have to change the in the Home app). So it is not a big deal, but I wanted to let you know.

Thanks for your work !

AMoo-Miki commented 5 years ago

Can you please paste the entire block from your config file that relates to this plugin? put xxxxx for your device id and key values.

There is a scenario where the details that Homebridge has cached about your device, cause conflicts. Solving it involves deleting the cachedAccessories file. However, in the latest and yet unreleased version of the plugin, I have tried to identify and handle these bad cached devices. I don't have enough information to say for sure this is your problem but it is, in my view, the most common problem using Homebridge and its plugins.

I would recommend you first try updating the plugin with npm i -g AMoo-Miki/homebridge-tuya-lan and restarting Homebridge.

If that doesn't solve the problem, clear the cache manually; delete the file named cachedAccessories which is in a folder named accessories beside your config.json file. Then restart Homebridge.

AlainKaim commented 5 years ago

Thanks for your answer.

Updating he plugin was not enough, but deleting the cache file worked. :)

If you still need my config file, just ask.

Best, Alain

Le 13 mars 2019 à 23:09, Miki notifications@github.com a écrit :

Can you please paste the entire block from your config file that relates to this plugin? put xxxxx for your device id and key values.

There is a scenario where the details that Homebridge has cached about your device, cause conflicts. Solving it involves deleting the cachedAccessories file. However, in the latest and yet unreleased version of the plugin, I have tried to identify and handle these bad cached devices. I don't have enough information to say for sure this is your problem but it is, in my view, the most common problem using Homebridge and its plugins.

I would recommend you first try updating the plugin with npm i -g AMoo-Miki/homebridge-tuya-lan and restarting Homebridge.

If that doesn't solve the problem, clear the cache manually; delete the file named cachedAccessories which is in a folder named accessories beside your config.json file. Then restart Homebridge.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AMoo-Miki/homebridge-tuya-lan/issues/26#issuecomment-472625558, or mute the thread https://github.com/notifications/unsubscribe-auth/AuPv9fE8pI33N2DOJ--xuhWC242zh9Tyks5vWXcdgaJpZM4brow4.