Stog / homebridge-fronius-inverter

A homebridge plugin to pull Fronius solar inverter data into HomeKit as a light sensor accessory.
5 stars 1 forks source link

Does the API fail when inverter goes into sleep mode? #3

Closed CoolCatB closed 4 years ago

CoolCatB commented 4 years ago

It worked flawlessly during the day but when i checked in the evening all API calls seem to be failing and bringing down Homebridge (none of the other accessories are working) after a while. Is it because the Inverter goes into sleep mode? (I masked the original IPs). Thanks!

Error: connect EHOSTUNREACH xxx.xxx.xx.xx:80 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) { errno: 'EHOSTUNREACH', code: 'EHOSTUNREACH', syscall: 'connect', address: 'xxx.xxx.xx.xx', port: 80, config: { url: 'http://xxx.xxx.xx.xx/solar_api/v1/GetPowerFlowRealtimeData.fcgi', method: 'get', headers: { Accept: 'application/json, text/plain, /', 'User-Agent': 'axios/0.19.2' }, transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, adapter: [Function: adapter], xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, validateStatus: [Function: validateStatus], data: undefined }, request: Writable { _writableState: WritableState { objectMode: false, highWaterMark: 16384, finalCalled: false, needDrain: false, ending: false, ended: false, finished: false, destroyed: false, decodeStrings: true, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: true, bufferProcessing: false, onwrite: [Function: bound onwrite], writecb: null, writelen: 0, afterWriteTickInfo: null, bufferedRequest: null, lastBufferedRequest: null, pendingcb: 0, prefinished: false, errorEmitted: false, emitClose: true, autoDestroy: false, bufferedRequestCount: 0, corkedRequestsFree: [Object] }, writable: true, _events: [Object: null prototype] { response: [Function: handleResponse], error: [Function: handleRequestError] }, _eventsCount: 2, _maxListeners: undefined, _options: { protocol: 'http:', maxRedirects: 21, maxBodyLength: 10485760, path: '/solar_api/v1/GetPowerFlowRealtimeData.fcgi', method: 'GET', headers: [Object], agent: undefined, agents: [Object], auth: undefined, hostname: 'xxx.xxx.xx.xx', port: null, nativeProtocols: [Object], pathname: '/solar_api/v1/GetPowerFlowRealtimeData.fcgi' }, _redirectCount: 0, _redirects: [], _requestBodyLength: 0, _requestBodyBuffers: [], _onNativeResponse: [Function], _currentRequest: ClientRequest { _events: [Object: null prototype], _eventsCount: 6, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Socket], connection: [Socket], _header: 'GET /solar_api/v1/GetPowerFlowRealtimeData.fcgi HTTP/1.1\r\n' + 'Accept: application/json, text/plain, /\r\n' + 'User-Agent: axios/0.19.2\r\n' + 'Host: xxx.xxx.xx.xx\r\n' + 'Connection: close\r\n' + '\r\n', _onPendingData: [Function: noopPendingOutput], agent: [Agent], socketPath: undefined, method: 'GET', insecureHTTPParser: undefined, path: '/solar_api/v1/GetPowerFlowRealtimeData.fcgi', _ended: false, res: null, aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, _redirectable: [Circular],

  [Symbol(kNeedDrain)]: false,
  [Symbol(corked)]: 0,
  [Symbol(kOutHeaders)]: [Object: null prototype]
},
_currentUrl: 'http://xxx.xxx.xx.xx/solar_api/v1/GetPowerFlowRealtimeData.fcgi',
[Symbol(kCapture)]: false

}, response: undefined, isAxiosError: true, toJSON: [Function] } [5/29/2020, 6:26:15 PM] [Generation] calling getOnCharacteristicHandler 0 Error: connect EHOSTUNREACH xxx.xxx.xx.xx:80 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) { errno: 'EHOSTUNREACH', code: 'EHOSTUNREACH', syscall: 'connect', address: 'xxx.xxx.xx.xx', port: 80, config: { url: 'http://xxx.xxx.xx.xx/solar_api/v1/GetPowerFlowRealtimeData.fcgi', method: 'get', headers: { Accept: 'application/json, text/plain, /', 'User-Agent': 'axios/0.19.2' }, transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, adapter: [Function: adapter], xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, validateStatus: [Function: validateStatus], data: undefined }, request: Writable { _writableState: WritableState { objectMode: false, highWaterMark: 16384, finalCalled: false, needDrain: false, ending: false, ended: false, finished: false, destroyed: false, decodeStrings: true, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: true, bufferProcessing: false, onwrite: [Function: bound onwrite], writecb: null, writelen: 0, afterWriteTickInfo: null, bufferedRequest: null, lastBufferedRequest: null, pendingcb: 0, prefinished: false, errorEmitted: false, emitClose: true, autoDestroy: false, bufferedRequestCount: 0, corkedRequestsFree: [Object] }, writable: true, _events: [Object: null prototype] { response: [Function: handleResponse], error: [Function: handleRequestError] }, _eventsCount: 2, _maxListeners: undefined, _options: { protocol: 'http:', maxRedirects: 21, maxBodyLength: 10485760, path: '/solar_api/v1/GetPowerFlowRealtimeData.fcgi', method: 'GET', headers: [Object], agent: undefined, agents: [Object], auth: undefined, hostname: 'xxx.xxx.xx.xx', port: null, nativeProtocols: [Object], pathname: '/solar_api/v1/GetPowerFlowRealtimeData.fcgi' }, _redirectCount: 0, _redirects: [], _requestBodyLength: 0, _requestBodyBuffers: [], _onNativeResponse: [Function], _currentRequest: ClientRequest { _events: [Object: null prototype], _eventsCount: 6, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Socket], connection: [Socket], _header: 'GET /solar_api/v1/GetPowerFlowRealtimeData.fcgi HTTP/1.1\r\n' + 'Accept: application/json, text/plain, /\r\n' + 'User-Agent: axios/0.19.2\r\n' + 'Host: xxx.xxx.xx.xx\r\n' + 'Connection: close\r\n' + '\r\n', _onPendingData: [Function: noopPendingOutput], agent: [Agent], socketPath: undefined, method: 'GET', insecureHTTPParser: undefined, path: '/solar_api/v1/GetPowerFlowRealtimeData.fcgi', _ended: false, res: null, aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, _redirectable: [Circular],

  [Symbol(kNeedDrain)]: false,
  [Symbol(corked)]: 0,
  [Symbol(kOutHeaders)]: [Object: null prototype]
},
_currentUrl: 'http://xxx.xxx.xx.xx/solar_api/v1/GetPowerFlowRealtimeData.fcgi',
[Symbol(kCapture)]: false

}, response: undefined, isAxiosError: true, toJSON: [Function] } [5/29/2020, 6:26:15 PM] [Grid Consumption] calling getOnCharacteristicHandler 0 Error: connect EHOSTUNREACH xxx.xxx.xx.xx:80 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) { errno: 'EHOSTUNREACH', code: 'EHOSTUNREACH', syscall: 'connect', address: 'xxx.xxx.xx.xx', port: 80, config: { url: 'http://xxx.xxx.xx.xx/solar_api/v1/GetPowerFlowRealtimeData.fcgi', method: 'get', headers: { Accept: 'application/json, text/plain, /', 'User-Agent': 'axios/0.19.2' }, transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, adapter: [Function: adapter], xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, validateStatus: [Function: validateStatus], data: undefined }, request: Writable { _writableState: WritableState { objectMode: false, highWaterMark: 16384, finalCalled: false, needDrain: false, ending: false, ended: false, finished: false, destroyed: false, decodeStrings: true, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: true, bufferProcessing: false, onwrite: [Function: bound onwrite], writecb: null, writelen: 0, afterWriteTickInfo: null, bufferedRequest: null, lastBufferedRequest: null, pendingcb: 0, prefinished: false, errorEmitted: false, emitClose: true, autoDestroy: false, bufferedRequestCount: 0, corkedRequestsFree: [Object] }, writable: true, _events: [Object: null prototype] { response: [Function: handleResponse], error: [Function: handleRequestError] }, _eventsCount: 2, _maxListeners: undefined, _options: { protocol: 'http:', maxRedirects: 21, maxBodyLength: 10485760, path: '/solar_api/v1/GetPowerFlowRealtimeData.fcgi', method: 'GET', headers: [Object], agent: undefined, agents: [Object], auth: undefined, hostname: 'xxx.xxx.xx.xx', port: null, nativeProtocols: [Object], pathname: '/solar_api/v1/GetPowerFlowRealtimeData.fcgi' }, _redirectCount: 0, _redirects: [], _requestBodyLength: 0, _requestBodyBuffers: [], _onNativeResponse: [Function], _currentRequest: ClientRequest { _events: [Object: null prototype], _eventsCount: 6, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Socket], connection: [Socket], _header: 'GET /solar_api/v1/GetPowerFlowRealtimeData.fcgi HTTP/1.1\r\n' + 'Accept: application/json, text/plain, /\r\n' + 'User-Agent: axios/0.19.2\r\n' + 'Host: xxx.xxx.xx.xx\r\n' + 'Connection: close\r\n' + '\r\n', _onPendingData: [Function: noopPendingOutput], agent: [Agent], socketPath: undefined, method: 'GET', insecureHTTPParser: undefined, path: '/solar_api/v1/GetPowerFlowRealtimeData.fcgi', _ended: false, res: null, aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, _redirectable: [Circular],

  [Symbol(kNeedDrain)]: false,
  [Symbol(corked)]: 0,
  [Symbol(kOutHeaders)]: [Object: null prototype]
},
_currentUrl: 'http://xxx.xxx.xx.xx/solar_api/v1/GetPowerFlowRealtimeData.fcgi',
[Symbol(kCapture)]: false

}, response: undefined, isAxiosError: true, toJSON: [Function] }

longzheng commented 4 years ago

I belive I fixed this with https://github.com/Stog/homebridge-fronius-inverter/pull/5

longzheng commented 4 years ago

Although looks like the new version is not pushed to npm. @Stog could you release a newer version?

Stog commented 4 years ago

Sorry for the delay, should be published now. I made an error when initially publishing to npm with the package name so make sure you grab the correct package (I was missing the u in fronius). https://www.npmjs.com/package/homebridge-fronius-inverter