AMoo-Miki / homebridge-tuya-lan

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

TypeError: Cannot read property 'devices' of null #29

Closed lemaygabriel closed 5 years ago

lemaygabriel commented 5 years ago

Hello all ! Here's what I get when I try to load Homebridge. Any idea what the problem can be ?


[2019-3-14 21:06:08] Loaded config.json with 0 accessories and 0 platforms. [2019-3-14 21:06:08] --- [2019-3-14 21:06:09] Loaded plugin: homebridge-tuya-lan [2019-3-14 21:06:09] Registering platform 'homebridge-tuya-lan.TuyaLan' [2019-3-14 21:06:09] --- Load homebridge-tuya-lan.TuyaLan Setup Payload: X-HM://0023IZFXXA6M8 Scan this code with your HomeKit app on your iOS device to pair with Homebridge: (XXXXXXXXX)
Or enter this code with your HomeKit app on your iOS device to pair with Homebridge: (XXXXXXXXX)
/usr/local/lib/node_modules/homebridge-tuya-lan/index.js:47 this.config.devices.forEach(device => { ^ TypeError: Cannot read property 'devices' of null at TuyaLan.discoverDevices (/usr/local/lib/node_modules/homebridge-tuya-lan/index.js:47:21) at API.TuyaLan.api.on (/usr/local/lib/node_modules/homebridge-tuya-lan/index.js:39:18) at API.emit (events.js:180:13) at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:99:13) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:45:10) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:649:30) at Object.Module._extensions..js (module.js:660:10) at Module.load (module.js:561:32) at tryModuleLoad (module.js:501:12)

Thank you very much !

lemaygabriel commented 5 years ago

Found the issue ! Problem with my .json file. Here's the good one:

{ "bridge": { "name": "HomebridgeSwitch", "username": "XXXXX", "port": XXXXX, "pin": "XXXXX" },

    "accessories":[],

    "platforms": [
    {
    "platform": "TuyaLan",
    "devices": [{
            "name": "Tuya Dimmer Switch Device 1",
            "type": "SimpleLight",
            "manufacturer": "CE Smart",
            "model": "LA-WF3",
            "id": "XXXXXXXXXX",
            "key": "XXXXXXXXXX"
    }]

}] }

AMoo-Miki commented 5 years ago

I am glad you solved the problem.