naofireblade / homebridge-weather-plus

A comprehensive weather plugin for homebridge.
MIT License
313 stars 63 forks source link

Error - Cannot read property 'toLowerCase' of undefined #138

Closed e8link closed 3 years ago

e8link commented 4 years ago

[5/28/2020, 11:02:37 AM] TypeError: Cannot read property 'toLowerCase' of undefined at OpenWeatherMapAPI.getLocationGeo (/usr/lib/node_modules/homebridge-weather-plus/apis/openweathermap.js:266:31) at OpenWeatherMapAPI.update (/usr/lib/node_modules/homebridge-weather-plus/apis/openweathermap.js:71:9) at /usr/lib/node_modules/homebridge-weather-plus/index.js:229:12 at Array.forEach () at WeatherPlusPlatform.updateWeather (/usr/lib/node_modules/homebridge-weather-plus/index.js:226:17) at new WeatherPlusPlatform (/usr/lib/node_modules/homebridge-weather-plus/index.js:110:7) at /usr/lib/node_modules/homebridge/src/server.ts:396:40 at Array.forEach () at Server.loadPlatforms (/usr/lib/node_modules/homebridge/src/server.ts:373:27) at Server.start (/usr/lib/node_modules/homebridge/src/server.ts:152:29) at cli (/usr/lib/node_modules/homebridge/src/cli.ts:80:10) at Object. (/usr/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (internal/modules/cjs/loader.js:1158:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10) at Module.load (internal/modules/cjs/loader.js:1002:32) at Function.Module._load (internal/modules/cjs/loader.js:901:14)

Config:

{ "units": "us", "interval": 5, "stations": [ { "nameNow": "XXXXX", "service": "openweathermap", "key": "XXXXXX", "locationGeo": [ XX.25012227, -XX.18733628 ], "locationCity": "XXXX, US", "language": "en", "compatibility": "home", "forecast": [ "Today" ], "conditionCategory": "simple", "now": true, "extraHumidity": false, "hidden": [ "Air Pressure", "Dew Point" ], "tresholdCloudCover": 60, "tresholdUvIndex": 5 }, { "service": "openweathermap", "language": "en", "compatibility": "home", "conditionCategory": "simple", "now": true, "extraHumidity": false } ], "platform": "WeatherPlus" } ]

naofireblade commented 4 years ago

Hi, you need to update your nodejs version to 12.17.0 or 14.3.0 https://nodejs.org/en/

e8link commented 4 years ago

Ok, I was already on 12.17.0. I think you are saying I should upgrade to 14?

naofireblade commented 4 years ago

No sorry, then the issue is something else. I misread your log. 12.17.0 is fine. I will reopen and investigate this issue.

e8link commented 4 years ago

Got it fixed, removed from homebridge and installed on hoobs and it's working fine. Oddly Hoobs is running Node 12.16.2.

chrisremie commented 3 years ago

I have the same error. node 14.15.1

maisun commented 3 years ago

Same here, has anybody found a solution?

naofireblade commented 3 years ago

This error occurs if you have a station without any location information (locationId, locationCity or locationGeo). @e8link you have 2 stations any our config. The second one is missing a location.