redindian / homebridge-gardena-lawnmower

MIT License
6 stars 7 forks source link

Access Token error #1

Closed karad0 closed 4 years ago

karad0 commented 4 years ago

Hi, I have installed your plugin. But with your I have a problem.

look my log [9/18/2019, 11:01:48 AM] [SILENO] Cannot get Token. { options: { method: 'POST', uri: 'https://smart.gardena.com/v1/auth/token', body: { data: [Object] }, json: true } } 400 undefined [9/18/2019, 11:01:48 AM] [SILENO] getToken { data: { id: '[REMOVED]', type: 'token', attributes: { expires_in: 863999, refresh_token: '[REMOVED]', provider: 'husqvarna', user_id: '[REMOVED]', scope: 'iam:read iam:write' } } } [9/18/2019, 11:01:48 AM] [SILENO] getToken { token: { token: '[REMOVED]', expires: 1568798167245 } } [9/18/2019, 11:01:48 AM] [SILENO] Cannot call API. { options: { method: 'GET', uri: 'https://smart.gardena.com/v1/devices', qs: { locationId: undefined }, body: undefined, headers: { Authorization: 'Bearer [REMOVED]', 'Authorization-Provider': 'husqvarna' }, json: true } } 400 undefined (node:6155) UnhandledPromiseRejectionWarning: StatusCodeError: 400 - {"errors":[{"attribute":"sgtin","error":"empty"}]} at new StatusCodeError (/usr/lib/node_modules/homebridge-gardena-lawnmower/node_modules/request-promise-core/lib/errors.js:32:15) at Request.plumbing.callback (/usr/lib/node_modules/homebridge-gardena-lawnmower/node_modules/request-promise-core/lib/plumbing.js:104:33) at Request.RP$callback [as _callback] (/usr/lib/node_modules/homebridge-gardena-lawnmower/node_modules/request-promise-core/lib/plumbing.js:46:31) at Request.self.callback (/usr/lib/node_modules/homebridge-gardena-lawnmower/node_modules/request/request.js:185:22) at Request.emit (events.js:209:13) at Request.<anonymous> (/usr/lib/node_modules/homebridge-gardena-lawnmower/node_modules/request/request.js:1161:10) at Request.emit (events.js:209:13) at IncomingMessage.<anonymous> (/usr/lib/node_modules/homebridge-gardena-lawnmower/node_modules/request/request.js:1083:12) at Object.onceWrapper (events.js:298:28) at IncomingMessage.emit (events.js:214:15) at endReadableNT (_stream_readable.js:1178:12) at processTicksAndRejections (internal/process/task_queues.js:80:21) (node:6155) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 7) [9/18/2019, 11:01:48 AM] [SILENO] Cannot call API. { options: { method: 'GET', uri: 'https://smart.gardena.com/v1/devices', qs: { locationId: undefined }, body: undefined, headers: { Authorization: 'Bearer [REMOVED]', 'Authorization-Provider': 'husqvarna' }, json: true } } 400 undefined (node:6155) UnhandledPromiseRejectionWarning: StatusCodeError: 400 - {"errors":[{"attribute":"sgtin","error":"empty"}]} at new StatusCodeError (/usr/lib/node_modules/homebridge-gardena-lawnmower/node_modules/request-promise-core/lib/errors.js:32:15) at Request.plumbing.callback (/usr/lib/node_modules/homebridge-gardena-lawnmower/node_modules/request-promise-core/lib/plumbing.js:104:33) at Request.RP$callback [as _callback] (/usr/lib/node_modules/homebridge-gardena-lawnmower/node_modules/request-promise-core/lib/plumbing.js:46:31) at Request.self.callback (/usr/lib/node_modules/homebridge-gardena-lawnmower/node_modules/request/request.js:185:22) at Request.emit (events.js:209:13) at Request.<anonymous> (/usr/lib/node_modules/homebridge-gardena-lawnmower/node_modules/request/request.js:1161:10) at Request.emit (events.js:209:13) at IncomingMessage.<anonymous> (/usr/lib/node_modules/homebridge-gardena-lawnmower/node_modules/request/request.js:1083:12) at Object.onceWrapper (events.js:298:28) at IncomingMessage.emit (events.js:214:15) at endReadableNT (_stream_readable.js:1178:12) at processTicksAndRejections (internal/process/task_queues.js:80:21) (node:6155) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 8)

(Removed tokens and user id)

redindian commented 4 years ago

Hi,

This is still a work in progress, but I forgot to change the readme. I changed it to location-id and mower-id, so you need to set your ID's like that.

karad0 commented 4 years ago

It's ok, thanks. You can add button for Park(winter) and Auto(summer), same https://www.npmjs.com/package/homebridge-automower

Thanks

redindian commented 4 years ago

I was thinking about added automatic detection of the mower ID and location ID. Thnx for that link, I'll have a look at it and see what I can use.

stephanhuetzen commented 4 years ago

Hi, I am having the same token error. How do I get the location and mower id and how to add into config?

redindian commented 4 years ago

@stephanhuetzen @karad0 I just released a new version 0.6 which solves the mower id problem. It will just load the first mower it finds from your Gardena account.