nitaybz / homebridge-tado-ac

Homebridge plugin to support Tado Smart AC Control devices.
MIT License
40 stars 12 forks source link

Tado is changing authentication method. #127

Closed nytmaretd closed 8 months ago

nytmaretd commented 9 months ago

Hi. I just got this email from Tado:

Thank you for using tado°!

We have noticed a number of outdated requests for home data to the tado° cloud from your account. These requests are unlikely to have been generated by current versions of tado° apps or devices. If you have set up an open source or commercial home automation system not listed on our smart home integration page, or you are still using a very old version of the tado° app, please follow the instructions at the end of the email.

These particular requests to our tado° servers use an outdated and insecure form of authentication. (In technical terms: these requests append the username and password as query parameters to each request, e.g. https://my.tado.com/api/v2/me?username=myUsername&password=myPassword)

Please note that this outdated form of authentication will soon stop working. We plan on disabling it on February 12th 2024.

https://support.tado.com/en/articles/8565472-how-do-i-update-my-rest-api-authentication-method-to-oauth-2

L3x1c0n commented 9 months ago

Was wondering if there’s a plan to address this?

rafacampoamor commented 9 months ago

I restarted my homebridge today and got this error on loop:

[2/20/2024, 7:41:18 PM] [homebridge-tado-ac] Error: Request failed with status code 401
    at createError (/usr/local/lib/node_modules/homebridge-tado-ac/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/usr/local/lib/node_modules/homebridge-tado-ac/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/homebridge-tado-ac/node_modules/axios/lib/adapters/http.js:260:11)
    at IncomingMessage.emit (node:events:530:35)
    at endReadableNT (node:internal/streams/readable:1696:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  config: {
    url: '/homes/96071/installations',
    method: 'get',
    headers: {
      Accept: 'application/json, text/plain, */*',
      'User-Agent': 'axios/0.21.1'
    },
    params: { username: 'my@email.com', password: 'My$ecurePassword' },
    baseURL: 'https://my.tado.com/api/v2',
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 0,
    adapter: [Function: httpAdapter],
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    validateStatus: [Function: validateStatus],
    data: undefined
  },
  request: <ref *1> ClientRequest {
    _events: [Object: null prototype] {
      abort: [Function (anonymous)],
      aborted: [Function (anonymous)],
      connect: [Function (anonymous)],
      error: [Function (anonymous)],
      socket: [Function (anonymous)],
      timeout: [Function (anonymous)],
      finish: [Function: requestOnFinish]
    },
    _eventsCount: 7,
    _maxListeners: undefined,
    outputData: [],
    outputSize: 0,
    writable: true,
    destroyed: true,
    _last: true,
    chunkedEncoding: false,
    shouldKeepAlive: true,
    maxRequestsOnConnectionReached: false,
    _defaultKeepAlive: true,
    useChunkedEncodingByDefault: false,
    sendDate: false,
    _removedConnection: false,
    _removedContLen: false,
    _removedTE: false,
    strictContentLength: false,
    _contentLength: 0,
    _hasBody: true,
    _trailer: '',
    finished: true,
    _headerSent: true,
    _closed: true,
    socket: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      secureConnecting: false,
      _SNICallback: null,
      servername: 'my.tado.com',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 9,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'my.tado.com',
      _closeAfterHandlingError: false,
      _readableState: [ReadableState],
      _writableState: [WritableState],
      allowHalfOpen: false,
      _maxListeners: undefined,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      timeout: 5000,
      parser: null,
      _httpMessage: null,
      autoSelectFamilyAttemptedAddresses: [Array],
      [Symbol(alpncallback)]: null,
      [Symbol(res)]: [TLSWrap],
      [Symbol(verified)]: true,
      [Symbol(pendingSession)]: null,
      [Symbol(async_id_symbol)]: -1,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: Timeout {
        _idleTimeout: 5000,
        _idlePrev: [TimersList],
        _idleNext: [Timeout],
        _idleStart: 707797,
        _onTimeout: [Function: bound ],
        _timerArgs: undefined,
        _repeat: null,
        _destroyed: false,
        [Symbol(refed)]: false,
        [Symbol(kHasPrimitive)]: false,
        [Symbol(asyncId)]: 7109,
        [Symbol(triggerId)]: 7107
      },
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(shapeMode)]: true,
      [Symbol(kCapture)]: false,
      [Symbol(kSetNoDelay)]: false,
      [Symbol(kSetKeepAlive)]: true,
      [Symbol(kSetKeepAliveInitialDelay)]: 1,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(connect-options)]: [Object]
    },
    _header: 'GET /api/v2/homes/96071/installations?username=my%email.com&password=MySecurePassword HTTP/1.1\r\n' +
      'Accept: application/json, text/plain, */*\r\n' +
      'User-Agent: axios/0.21.1\r\n' +
      'Host: my.tado.com\r\n' +
      'Connection: keep-alive\r\n' +
      '\r\n',
    _keepAliveTimeout: 0,
    _onPendingData: [Function: nop],
    agent: Agent {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      defaultPort: 443,
      protocol: 'https:',
      options: [Object: null prototype],
      requests: [Object: null prototype] {},
      sockets: [Object: null prototype] {},
      freeSockets: [Object: null prototype],
      keepAliveMsecs: 1000,
      keepAlive: true,
      maxSockets: Infinity,
      maxFreeSockets: 256,
      scheduling: 'lifo',
      maxTotalSockets: Infinity,
      totalSocketCount: 1,
      maxCachedSessions: 100,
      _sessionCache: [Object],
      [Symbol(shapeMode)]: false,
      [Symbol(kCapture)]: false
    },
    socketPath: undefined,
    method: 'GET',
    maxHeaderSize: undefined,
    insecureHTTPParser: undefined,
    joinDuplicateHeaders: undefined,
    path: '/api/v2/homes/96071/installations?username=my%email.com&password=MySecurePassword',
    _ended: true,
    res: IncomingMessage {
      _events: [Object],
      _readableState: [ReadableState],
      _maxListeners: undefined,
      socket: null,
      httpVersionMajor: 1,
      httpVersionMinor: 1,
      httpVersion: '1.1',
      complete: true,
      rawHeaders: [Array],
      rawTrailers: [],
      joinDuplicateHeaders: undefined,
      aborted: false,
      upgrade: false,
      url: '',
      method: null,
      statusCode: 401,
      statusMessage: '',
      client: [TLSSocket],
      _consuming: false,
      _dumped: false,
      req: [Circular *1],
      _eventsCount: 3,
      responseUrl: 'https://my.tado.com/api/v2/homes/96071/installations?username=my%email.com&password=MySecurePassword',
      redirects: [],
      [Symbol(shapeMode)]: true,
      [Symbol(kCapture)]: false,
      [Symbol(kHeaders)]: [Object],
      [Symbol(kHeadersCount)]: 14,
      [Symbol(kTrailers)]: null,
      [Symbol(kTrailersCount)]: 0
    },
    aborted: false,
    timeoutCb: null,
    upgradeOrConnect: false,
    parser: null,
    maxHeadersCount: null,
    reusedSocket: true,
    host: 'my.tado.com',
    protocol: 'https:',
    _redirectable: Writable {
      _events: [Object],
      _writableState: [WritableState],
      _maxListeners: undefined,
      _options: [Object],
      _ended: true,
      _ending: true,
      _redirectCount: 0,
      _redirects: [],
      _requestBodyLength: 0,
      _requestBodyBuffers: [],
      _eventsCount: 2,
      _onNativeResponse: [Function (anonymous)],
      _currentRequest: [Circular *1],
      _currentUrl: 'https://my.tado.com/api/v2/homes/96071/installations?username=my%email.com&password=MySecurePassword',
      [Symbol(shapeMode)]: true,
      [Symbol(kCapture)]: false
    },
    [Symbol(shapeMode)]: false,
    [Symbol(kCapture)]: false,
    [Symbol(kBytesWritten)]: 0,
    [Symbol(kNeedDrain)]: false,
    [Symbol(corked)]: 0,
    [Symbol(kOutHeaders)]: [Object: null prototype] {
      accept: [Array],
      'user-agent': [Array],
      host: [Array]
    },
    [Symbol(errored)]: null,
    [Symbol(kHighWaterMark)]: 16384,
    [Symbol(kRejectNonStandardBodyWrites)]: false,
    [Symbol(kUniqueHeaders)]: null
  },
  response: {
    status: 401,
    statusText: '',
    headers: {
      date: 'Tue, 20 Feb 2024 18:41:18 GMT',
      'content-type': 'application/json;charset=UTF-8',
      'content-length': '102',
      connection: 'keep-alive',
      'set-cookie': [Array],
      vary: 'Accept-Encoding'
    },
    config: {
      url: '/homes/96071/installations',
      method: 'get',
      headers: [Object],
      params: [Object],
      baseURL: 'https://my.tado.com/api/v2',
      transformRequest: [Array],
      transformResponse: [Array],
      timeout: 0,
      adapter: [Function: httpAdapter],
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      maxBodyLength: -1,
      validateStatus: [Function: validateStatus],
      data: undefined
    },
    request: <ref *1> ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: true,
      maxRequestsOnConnectionReached: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: false,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      strictContentLength: false,
      _contentLength: 0,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      _closed: true,
      socket: [TLSSocket],
      _header: 'GET /api/v2/homes/96071/installations?username=my%email.com&password=MySecurePassword HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'User-Agent: axios/0.21.1\r\n' +
        'Host: my.tado.com\r\n' +
        'Connection: keep-alive\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: nop],
      agent: [Agent],
      socketPath: undefined,
      method: 'GET',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      joinDuplicateHeaders: undefined,
      path: '/api/v2/homes/96071/installations?username=my%email.com&password=MySecurePassword',
      _ended: true,
      res: [IncomingMessage],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: true,
      host: 'my.tado.com',
      protocol: 'https:',
      _redirectable: [Writable],
      [Symbol(shapeMode)]: false,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype],
      [Symbol(errored)]: null,
      [Symbol(kHighWaterMark)]: 16384,
      [Symbol(kRejectNonStandardBodyWrites)]: false,
      [Symbol(kUniqueHeaders)]: null
    },
    data: { errors: [Array] }
  },
  isAxiosError: true,
  toJSON: [Function: toJSON]
}
[2/20/2024, 7:41:18 PM] [homebridge-tado-ac] ERROR: Request failed with status code 401
[2/20/2024, 7:41:18 PM] [homebridge-tado-ac] ERROR: Request failed with status code 401
[2/20/2024, 7:41:18 PM] [homebridge-tado-ac] ERROR: Request failed with status code 401
[2/20/2024, 7:41:18 PM] [homebridge-tado-ac] ERROR: Request failed with status code 401
[2/20/2024, 7:41:22 PM] [homebridge-tado-ac] ERROR: Request failed with status code 401
[2/20/2024, 7:41:32 PM] [homebridge-tado-ac] ERROR: Request failed with status code 401

Is there any update upcoming? 🥺

Thanks!

PPPP114 commented 8 months ago

I have the same problem, need help! Thank you

dima-bzz commented 8 months ago

I have the same problem.

solbadguy2010 commented 8 months ago

Everyone has the same Problem.

@nitaybz Last Update was over a year ago. Are you alive?

hassounet commented 8 months ago

Same here I get this in the log

[03/03/2024, 18:20:331 [homebridge-tado-ac] ERROR: Request failed with status code 401 103/03/2024, 18:20:331 [homebridge-tado-acl { errors: [ code: 'unauthorized' title: Full authentication is require d to access this resource' } } [03/03/2024, 18:20:331 [homebridge-tado-ac] The plugin was not able •to retrieve Users fr om tado° API!! [03/03/2024, 18:20:331 [homebridge-tado-ac] Got Users from storage

nitaybz commented 8 months ago

Sorry Guys, I don't have Tado devices anymore... anyway, I've merged a pull request with possible fix, please update me if it works now

rafacampoamor commented 8 months ago

@nitaybz just after updating the plugin:


Restarting child bridge...
[3/3/2024, 7:17:12 PM] Got SIGTERM, shutting down child bridge process...
[3/3/2024, 7:17:17 PM] [homebridge-tado-ac] Child bridge process ended
[3/3/2024, 7:17:17 PM] [homebridge-tado-ac] Process Ended. Code: 143, Signal: null
[3/3/2024, 7:17:24 PM] [homebridge-tado-ac] Restarting Process...
[3/3/2024, 7:17:24 PM] [homebridge-tado-ac] Launched child bridge with PID 75435
[3/3/2024, 7:17:24 PM] Registering platform 'homebridge-tado-ac.TadoAC'
[3/3/2024, 7:17:24 PM] [homebridge-tado-ac] Loaded homebridge-tado-ac v4.1.0 child bridge successfully
[3/3/2024, 7:17:24 PM] Loaded 4 cached accessories from cachedAccessories.0ECC0D045DAF.
[3/3/2024, 7:17:24 PM] Homebridge v1.7.0 (HAP v0.11.1) (homebridge-tado-ac) is running on port 35861.
[3/3/2024, 7:17:25 PM] [homebridge-tado-ac] Could NOT complete the token request -> ERROR: "Bad credentials"
[3/3/2024, 7:17:25 PM] [homebridge-tado-ac] [GET] The plugin was NOT able to find stored token or acquire one from tado° API
[3/3/2024, 7:17:25 PM] [homebridge-tado-ac] Could NOT complete the token request -> ERROR: "Bad credentials"
[3/3/2024, 7:17:25 PM] [homebridge-tado-ac] [GET] The plugin was NOT able to find stored token or acquire one from tado° API
[3/3/2024, 7:17:25 PM] [homebridge-tado-ac] Could NOT complete the token request -> ERROR: "Bad credentials"
[3/3/2024, 7:17:25 PM] [homebridge-tado-ac] ERROR: Request failed with status code 401
[3/3/2024, 7:17:25 PM] [homebridge-tado-ac] ERROR: Request failed with status code 401
[3/3/2024, 7:17:26 PM] [homebridge-tado-ac] Could NOT complete the token request -> ERROR: "Bad credentials"
[3/3/2024, 7:17:26 PM] [homebridge-tado-ac] [GET] The plugin was NOT able to find stored token or acquire one from tado° API
[3/3/2024, 7:17:26 PM] [homebridge-tado-ac] Could NOT complete the token request -> ERROR: "Bad credentials"
[3/3/2024, 7:17:26 PM] [homebridge-tado-ac] [GET] The plugin was NOT able to find stored token or acquire one from tado° API
[3/3/2024, 7:17:26 PM] [homebridge-tado-ac] ERROR: Request failed with status code 401
[3/3/2024, 7:17:26 PM] [homebridge-tado-ac] ERROR: Request failed with status code 401
[3/3/2024, 7:17:26 PM] [homebridge-tado-ac] Could NOT complete the token request -> ERROR: "Bad credentials"
[3/3/2024, 7:17:26 PM] [homebridge-tado-ac] [GET] The plugin was NOT able to find stored token or acquire one from tado° API
[3/3/2024, 7:17:26 PM] [homebridge-tado-ac] Could NOT complete the token request -> ERROR: "Bad credentials"
[3/3/2024, 7:17:26 PM] [homebridge-tado-ac] [GET] The plugin was NOT able to find stored token or acquire one from tado° API
[3/3/2024, 7:17:26 PM] [homebridge-tado-ac] ERROR: Request failed with status code 401
[3/3/2024, 7:17:26 PM] [homebridge-tado-ac] ERROR: Request failed with status code 401
[3/3/2024, 7:17:26 PM] [homebridge-tado-ac] Could NOT complete the token request -> ERROR: "Bad credentials"
[3/3/2024, 7:17:26 PM] [homebridge-tado-ac] [GET] The plugin was NOT able to find stored token or acquire one from tado° API
[3/3/2024, 7:17:27 PM] [homebridge-tado-ac] ERROR: Request failed with status code 401
[3/3/2024, 7:17:37 PM] [homebridge-tado-ac] Could NOT complete the token request -> ERROR: "Bad credentials"
[3/3/2024, 7:17:37 PM] [homebridge-tado-ac] [GET] The plugin was NOT able to find stored token or acquire one from tado° API
[3/3/2024, 7:17:37 PM] [homebridge-tado-ac] ERROR: Request failed with status code 401

I can share my Tado account with you if that could help 😊

st1cky commented 8 months ago

Small type ion the password variable, should be fixed in the PR

image

rafacampoamor commented 8 months ago

@nitaybz @st1cky Thank you! Now it's working again 😊

Off-topic: anyone could help me to integrate fakegato on another plugin? I've been trying for months but my knowledge seems to be not enough

hassounet commented 8 months ago

Sorry Guys, I don't have Tado devices anymore... anyway, I've merged a pull request with possible fix, please update me if it works now

Yes it works now perfectly ! Thank you so much love your plugin! I even have access to dry and fan mode now

solbadguy2010 commented 8 months ago

Sorry Guys, I don't have Tado devices anymore... anyway, I've merged a pull request with possible fix, please update me if it works now

Great job. Even though you don‘t use Tado anymore, for me and my heating/cooling its a daily driver. Wife and kids use siri and never the tado app. Please help keeping it alive :-)

nytmaretd commented 8 months ago

Sorry Guys, I don't have Tado devices anymore... anyway, I've merged a pull request with possible fix, please update me if it works now

Thank you very much @nitaybz for the fix.It also works for me as confirmed by others before. I'll close the issue.