ilcato / homebridge-Fibaro-HC2

Homebridge plugin for Fibaro Home Center 2 (and Home Center Lite ...)
Apache License 2.0
65 stars 27 forks source link

Latest Fibaro HC2 Plugin Http Auth Issues with GET /api/scenes (401) #214

Closed neilpatel121 closed 3 years ago

neilpatel121 commented 3 years ago

Unable to get this to work, rollbacking to previous version works.. Log from Plugin

Between the rollback and latest version the password remained the same and hc2 version remained the same. I saw there was changes around user/name and password in json config for the global variables settings, thought the http credentials where switched over too these, tried to add these with no luck..

Facing issue with authentication too, password is correct

[2/27/2021, 8:47:27 PM] [FibaroHC2] Error getting data from Home Center: Error: Unauthorized at Request.callback (/usr/lib/node_modules/homebridge-fibaro-hc2/node_modules/superagent/src/node/index.js:879:15) at IncomingMessage. (/usr/lib/node_modules/homebridge-fibaro-hc2/node_modules/superagent/src/node/index.js:1130:18) at IncomingMessage.emit (events.js:327:22) at endReadableNT (_stream_readable.js:1327:12) at processTicksAndRejections (internal/process/task_queues.js:80:21) { status: 401, response: <ref *1> Response { _events: [Object: null prototype] {}, _eventsCount: 0, _maxListeners: undefined, res: IncomingMessage { _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 4, _maxListeners: undefined, socket: [Socket], httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, headers: [Object], rawHeaders: [Array], trailers: {}, rawTrailers: [], aborted: false, upgrade: false, url: '', method: null, statusCode: 401, statusMessage: 'User not logged in', client: [Socket], _consuming: false, _dumped: false, req: [ClientRequest], text: '',

  [Symbol(RequestTimeout)]: undefined
},
request: Request {
  _events: [Object: null prototype],
  _eventsCount: 1,
  _maxListeners: undefined,
  _enableHttp2: false,
  _agent: false,
  _formData: null,
  method: 'GET',
  url: '192.168.0.17/api/scenes',
  _header: [Object],
  header: [Object],
  writable: true,
  _redirects: 0,
  _maxRedirects: 5,
  cookies: '',
  qs: {},
  _query: [],
  qsRaw: [],
  _redirectList: [],
  _streamRequest: false,
  req: [ClientRequest],
  protocol: 'http:',
  host: '192.168.0.17',
  _endCalled: true,
  _callback: [Function (anonymous)],
  _fullfilledPromise: [Promise],
  res: [IncomingMessage],
  _resBuffered: true,
  response: [Circular *1],
  called: true,
  [Symbol(kCapture)]: false
},
req: ClientRequest {
  _events: [Object: null prototype],
  _eventsCount: 3,
  _maxListeners: undefined,
  outputData: [],
  outputSize: 0,
  writable: true,
  destroyed: false,
  _last: true,
  chunkedEncoding: false,
  shouldKeepAlive: false,
  _defaultKeepAlive: true,
  useChunkedEncodingByDefault: false,
  sendDate: false,
  _removedConnection: false,
  _removedContLen: false,
  _removedTE: false,
  _contentLength: 0,
  _hasBody: true,
  _trailer: '',
  finished: true,
  _headerSent: true,
  socket: [Socket],
  _header: 'GET /api/scenes HTTP/1.1\r\n' +
    'Host: 192.168.0.17\r\n' +
    'Accept-Encoding: gzip, deflate\r\n' +
    'Authorization: Basic Qk1XMzE4Y2khITpob21lYnJpZGdl\r\n' +
    'accept: json\r\n' +
    'Connection: close\r\n' +
    '\r\n',
  _keepAliveTimeout: 0,
  _onPendingData: [Function: noopPendingOutput],
  agent: [Agent],
  socketPath: undefined,
  method: 'GET',
  maxHeaderSize: undefined,
  insecureHTTPParser: undefined,
  path: '/api/scenes',
  _ended: true,
  res: [IncomingMessage],
  aborted: false,
  timeoutCb: null,
  upgradeOrConnect: false,
  parser: null,
  maxHeadersCount: null,
  reusedSocket: false,
  host: '192.168.0.17',
  protocol: 'http:',
  [Symbol(kCapture)]: false,
  [Symbol(kNeedDrain)]: false,
  [Symbol(corked)]: 0,
  [Symbol(kOutHeaders)]: [Object: null prototype]
},
text: '',
body: {},
files: undefined,
buffered: true,
headers: {
  server: 'nginx/1.8.0',
  date: 'Sat, 27 Feb 2021 20:47:27 GMT',
  'content-length': '0',
  connection: 'close',
  'www-authenticate': 'Basic realm="fibaro"'
},
header: {
  server: 'nginx/1.8.0',
  date: 'Sat, 27 Feb 2021 20:47:27 GMT',
  'content-length': '0',
  connection: 'close',
  'www-authenticate': 'Basic realm="fibaro"'
},
statusCode: 401,
status: 401,
statusType: 4,
info: false,
ok: false,
redirect: false,
clientError: true,
serverError: false,
error: Error: cannot GET /api/scenes (401)
    at Response.toError (/usr/lib/node_modules/homebridge-fibaro-hc2/node_modules/superagent/src/node/response.js:95:15)
    at Response._setStatusProperties (/usr/lib/node_modules/homebridge-fibaro-hc2/node_modules/superagent/src/response-base.js:126:48)
    at new Response (/usr/lib/node_modules/homebridge-fibaro-hc2/node_modules/superagent/src/node/response.js:41:8)
    at Request._emitResponse (/usr/lib/node_modules/homebridge-fibaro-hc2/node_modules/superagent/src/node/index.js:928:20)
    at IncomingMessage.<anonymous> (/usr/lib/node_modules/homebridge-fibaro-hc2/node_modules/superagent/src/node/index.js:1130:38)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  status: 401,
  text: '',
  method: 'GET',
  path: '/api/scenes'
},
created: false,
accepted: false,
noContent: false,
badRequest: false,
unauthorized: true,
notAcceptable: false,
forbidden: false,
notFound: false,
unprocessableEntity: false,
type: '',
links: {},
setEncoding: [Function: bound ],
redirects: [],
pipe: [Function (anonymous)],
[Symbol(kCapture)]: false

} } Error: Startup error: get scenes or devices at /usr/lib/node_modules/homebridge-fibaro-hc2/src/index.ts:180:11 at processTicksAndRejections (internal/process/task_queues.js:93:5) [2/27/2021, 8:47:27 PM] Got SIGTERM, shutting down Homebridge... Error: Startup error: get scenes or devices at /usr/lib/node_modules/homebridge-fibaro-hc2/src/index.ts:180:11 at processTicksAndRejections (internal/process/task_queues.js:93:5)

ilcato commented 3 years ago

Reverted, latest changes. Upgrade to 2.4.2.