naofireblade / homebridge-weather-plus

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

Undefined this.log in converter #102

Closed shamasis closed 4 years ago

shamasis commented 4 years ago

First, thanks for this amazing home bridge plugin. ❤️

Since today afternoon, my homebridge was unable to start because the plugin was erring out at the following line number because this.log was undefined and as such this.log.warn was resulting in error.

https://github.com/naofireblade/homebridge-weather-plus/blob/d34e5309bec961e66d3dd739bfa2674b5735e4fd/util/converter.js#L58

TypeError: Cannot read property 'warn' of undefined
    at Object.getConditionCategoryOwm (/homebridge/node_modules/homebridge-weather-plus/util/converter.js:118:12)
    at OpenWeatherMapAPI.parseReport (/homebridge/node_modules/homebridge-weather-plus/apis/openweathermap.js:105:40)
    at OpenWeatherMapAPI.<anonymous> (/homebridge/node_modules/homebridge-weather-plus/apis/openweathermap.js:72:10)
    at IncomingMessage.<anonymous> (/homebridge/node_modules/homebridge-weather-plus/node_modules/openweather-apis/index.js:250:18)
    at IncomingMessage.emit (events.js:323:22)
    at endReadableNT (_stream_readable.js:1204:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

I did not have the opportunity to debug the reason why because I had to get homebridge up and running asap. this.log && this.log.warn is what I temporarily added to bypass and get up and running.

Hope this helps. (I know there is not much to go on)

naofireblade commented 4 years ago

Thanks for the detailed report. The log object is not existant there after a refactoring. You are the winner/first one to experience an unkown dark sky weather category :D . I will fix this asap.

carlosfrutos commented 4 years ago

Same here,

There's another workaround to keep your homebridge working. Change your station configuration languages to English: "language": "en"

I had it in Spanish. That change worked for me.

Cheers

naofireblade commented 4 years ago

Fixed in v3.1.2