bryan-bartow / homebridge-alarm.com

Alarm.com plugin for Homebridge
ISC License
43 stars 11 forks source link

Error while getting light devices: TypeError: Cannot read property 'map' of undefined #38

Closed danemacmillan closed 7 years ago

danemacmillan commented 7 years ago

When booting up Homebridge with this plugin, there are two "devices" that are unable to get detected. They are the "light" and "lock" devices. I assume they relate to the WrapAPI endpoints. If that's so, there are no WrapAPI endpoints that contain those words exactly, which could explain why this plugin is attempting to access something that is assumed to exist.

[1/19/2017, 10:11:39 AM] Loaded plugin: homebridge-alarmdotcom                                                        
[1/19/2017, 10:11:39 AM] Registering platform 'homebridge-alarmdotcom.Alarmdotcom'                              
[1/19/2017, 10:11:39 AM] ---                                                                                           
[1/19/2017, 10:11:39 AM] Loaded config.json with 0 accessories and 1 platforms.                                        
[1/19/2017, 10:11:39 AM] ---                                                                                           
[1/19/2017, 10:11:39 AM] Loading 1 platforms...                                                                        
[1/19/2017, 10:11:39 AM] [Entrance alarm] Initializing Alarmdotcom platform...                                         
[1/19/2017, 10:11:39 AM] Loading 0 accessories...                                                                      
[1/19/2017, 10:11:43 AM] [Entrance alarm] Error while getting light devices: TypeError: Cannot read property 'map' of undefined                                                                                                               
[1/19/2017, 10:11:43 AM] [Entrance alarm] Error while getting lock devices: TypeError: Cannot read property 'map' of undefined                                                                                                                
[1/19/2017, 10:11:43 AM] [Entrance alarm] Initializing platform accessory 'Alarm.com Entrance alarm'...
bryanbartow commented 7 years ago

This is basically a duplicate of #20. Although those error messages are logged, there is no adverse effect on the plugin itself.

The long and short of it is the plugin doesn't know ahead of time which devices you do or don't have, so it looks for all of them on startup. Feel free to submit a PR with a fix.