lprhodes / homebridge-platform-helper

Platform and Accessory helper library for homebridge: https://github.com/nfarina/homebridge
7 stars 7 forks source link

Log is not defined #1

Open kiwi-cam opened 4 years ago

kiwi-cam commented 4 years ago

Copied from @stefantitu : https://github.com/AlexanderBabel/homebridge-broadlink-rm/issues/62

I added today a few buttons in broadlink plugin and after that, even after I deleted the buttons, i get this error:

[12/18/2019, 5:18:39 PM] ReferenceError: log is not defined at Object.keys.forEach (/usr/local/lib/node_modules/homebridge-broadlink-rm-tv/node_modules/homebridge-platform-helper/accessory.js:72:9) at Array.forEach (:null:null) at SwitchAccessory.checkConfig (/usr/local/lib/node_modules/homebridge-broadlink-rm-tv/node_modules/homebridge-platform-helper/accessory.js:54:25) at Object.keys.forEach (/usr/local/lib/node_modules/homebridge-broadlink-rm-tv/node_modules/homebridge-platform-helper/accessory.js:66:14) at Array.forEach (:null:null) at SwitchAccessory.checkConfig (/usr/local/lib/node_modules/homebridge-broadlink-rm-tv/node_modules/homebridge-platform-helper/accessory.js:54:25) at new HomebridgeAccessory (/usr/local/lib/node_modules/homebridge-broadlink-rm-tv/node_modules/homebridge-platform-helper/accessory.js:35:10) at new BroadlinkRMAccessory (/usr/local/lib/node_modules/homebridge-broadlink-rm-tv/accessories/accessory.js:16:5) at new SwitchAccessory (/usr/local/lib/node_modules/homebridge-broadlink-rm-tv/accessories/switch.js:10:5) at config.accessories.forEach (/usr/local/lib/node_modules/homebridge-broadlink-rm-tv/platform.js:68:32) at Array.forEach (:null:null) at BroadlinkRMPlatform.addAccessories (/usr/local/lib/node_modules/homebridge-broadlink-rm-tv/platform.js:63:24) at BroadlinkRMPlatform.accessories (/usr/local/lib/node_modules/homebridge-broadlink-rm-tv/node_modules/homebridge-platform-helper/platform.js:28:10) at Server._loadPlatformAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:403:20) at Server._loadPlatforms (/usr/local/lib/node_modules/homebridge/lib/server.js:341:16) at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:90:36) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:59:10) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Function.Module.runMain (internal/modules/cjs/loader.js:742:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)

[12/18/2019, 5:18:40 PM] Got SIGTERM, shutting down Homebridge...

I've also had issues where the error when a hexcode is only decimal digits.

[CONFIG ERROR] Numeric values should look like this...

dnicolson commented 4 years ago

I also noticed this error when adding a device with the Google Home app via the https://github.com/oznu/homebridge-gsh plugin.

cmlad commented 4 years ago

Same issue after installing the Google Home plugin. Here is the log:

[4/8/2020, 06:10:33] [Google Smart Home] Received QUERY intent
[4/8/2020, 06:10:33] TypeError: log is not a function
    at Characteristic.Name.getName (/usr/lib/node_modules/homebridge-broadlink-rm/node_modules/homebridge-platform-helper/dist/serviceManager.js:69:9)
    at Characteristic.Name.emit (events.js:311:20)
    at Characteristic.Name.Characteristic.getValue (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Characteristic.js:164:10)
    at Bridge.<anonymous> (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:771:20)
    at Array.forEach (<anonymous>:null:null)
    at Bridge.Accessory._handleGetCharacteristics (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:735:8)
    at HAPServer.emit (events.js:311:20)
    at HAPServer._handleCharacteristics (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:928:10)
    at HAPServer.<anonymous> (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:209:39)
    at IncomingMessage.emit (events.js:311:20)
    at endReadableNT (_stream_readable.js:1204:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

I fixed it by commenting out line 59 of serviceManager.js from the feature/typescript branch: https://github.com/lprhodes/homebridge-platform-helper/blob/ba9c72bc93810bd3d024250adc4212e31eb28580/dist/serviceManager.js#L69

I have 0 Node experience and wasn't able to figure out how to fix (this.log didn't work) :(