howanghk / homebridge-ewelink

Homebridge plugin to control Sonoff relays with OEM firmware
MIT License
81 stars 46 forks source link

Catch error when statusupdate is failing #2

Closed ramsesz closed 5 years ago

ramsesz commented 5 years ago

When an error occurs at getting the status like

mebridge/node_modules/homebridge-ewelink-max/index.js:365 const status = channel && device.params.switches && device.params.switches[channel-1] ? device.params.switches[channel-1].switch : device.params.switch || "off"; ^ TypeError: Cannot read property 'switch' of undefined

I updated to catch the error otherwise complete homebridge setup fails to run