ToddGreenfield / homebridge-airnow

Homebridge plugin for AirNow Web-API Air Quality Sensor
36 stars 10 forks source link

Plugin crashes Homebridge during initialization #5

Closed cpiekacz closed 6 years ago

cpiekacz commented 6 years ago

Config:

{
      "platform": "airnow",
      "name": "AQICN",
      "provider": "aqicn",
      "aqicn_api": "XXX",
      "aqicn_city": "@3392"
}

Error:

/usr/local/lib/node_modules/homebridge/lib/api.js:50
  if (name.indexOf('.') == -1) {
           ^

TypeError: Cannot read property 'indexOf' of undefined
    at API.accessory (/usr/local/lib/node_modules/homebridge/lib/api.js:50:12)
    at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:264:42)
    at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:86:38)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
cpiekacz commented 6 years ago

"platform": "airnow" should be "accessory": "airnow"

ToddGreenfield commented 6 years ago

Where did you see a reference to "platform"? You are correct though, this is an accessory, not a platform based plugin.

cpiekacz commented 6 years ago

I've just copied the code from lines above in my config and didn't notice that I haven't changed platform to accessory. My bad.