AshMartian / homebridge-carwings

9 stars 9 forks source link

TypeError: Cannot read property 'vehicleInfo' of undefined #6

Closed larspetter closed 7 years ago

larspetter commented 7 years ago

Hi,

Trying to get it working here. Changed the region code and my login to username (old Leaf) got it a step further :)

But it now stops giving me "TypeError: Cannot read property 'vehicleInfo' of undefined"

Running Homebridge 5.3.0 and Node 8.3.0

The login seems to be successfull cause the app on my phone notices that a login has been done on another device.

Any ideas?

Full error:

TypeError: Cannot read property 'vehicleInfo' of undefined at getsessionid (/usr/lib/node_modules/carwings/lib/index.js:72:33) at p (/usr/lib/node_modules/carwings/lib/index.js:133:33) at /usr/lib/node_modules/carwings/lib/index.js:85:12 at next (native) at step (/usr/lib/node_modules/carwings/lib/index.js:42:191) at /usr/lib/node_modules/carwings/lib/index.js:42:361 at process._tickCallback (internal/process/next_tick.js:109:7)

larspetter commented 7 years ago

With same login info the pycarwings2 module returns correct information. So it´s got to be something with the node.js script of my install :)

Taking away the homebridge-carwings plugin from config.json and Homebridge runs just fine..

AshMartian commented 7 years ago

Sorry, I do believe the node carwings code is incorrect. I've been busy to update the source repository. The carwings node code used is from here: https://github.com/joshperry/carwings

On Mon, Aug 14, 2017 at 9:50 AM, larspetter notifications@github.com wrote:

With same login info the pycarwings2 module returns correct information. So it´s got to be something with the node.js script of my install :)

Taking away the homebridge-carwings plugin from config.json and Homebridge runs just fine..

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/blandman/homebridge-carwings/issues/6#issuecomment-322244340, or mute the thread https://github.com/notifications/unsubscribe-auth/ABLnnj0mgJobbYWRB4LpQ68vVnZ1bUUPks5sYHrsgaJpZM4O2lg1 .

larspetter commented 7 years ago

Yes, found it. There are some differences in responses on Leaf models.

For 2012 EU model seems like the VehicleInfoList-part of the response is not present and you would need to check for that (or just take it away). Of course RemoteAC etc is neither part of the response and the carwings.js script does not check for such..

function getsessionid(profile) { // return profile.VehicleInfoList.vehicleInfo[0].custom_sessionid; return profile.vehicleInfo[0].custom_sessionid; }

function getvin(profile) { // return profile.VehicleInfoList.vehicleInfo[0].vin; return profile.vehicleInfo[0].vin; }