datMaffin / homebridge-tesla-powerwall

Homebridge Plugin for the Tesla Powerwall
ISC License
21 stars 11 forks source link

Plugin takes over log on error #20

Closed cjastennett closed 2 years ago

cjastennett commented 3 years ago

HI,

when the plugin cannot connect to the tesla for some reason, which it does quite frequency as it seems that the Tesla is quite sensitive with its wifi connection and gets disrupted easily, it rather takes over the homebridge log, with the following error text showing every few seconds:

[03/12/2020, 07:40:08] [Tesla Powerwall] status code: undefined [03/12/2020, 07:40:08] [Tesla Powerwall] body: undefined [03/12/2020, 07:40:08] [Tesla Powerwall] error: Error: connect EHOSTUNREACH 192.168.1.36:80 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) { errno: -113, code: 'EHOSTUNREACH', syscall: 'connect', address: 'XXX.XXX.XXX.XXX', port: 80 }

My log rolls off the top buffers within seconds, meaning I cannot view anything else going on.

Is it possible to make this be handled a bit better, with perhaps less text and less frequently added to tog? A reminder event 15 or 30 minutes after a initial message would be more than sufficient.

I don't have any verbose logging switch on on the homebridge as far as I can see.

Thanks

Chris

datMaffin commented 3 years ago

Looks like I decided to log every http error: https://github.com/datMaffin/homebridge-tesla-powerwall/blob/a59c835c4c76ddce1a707657e114d441a6d34c41/src/helper/check-for-request-error.js#L10-L15

I am not yet sure what the best approach could be. To me, having an error message seems important.

Reducing the number of warnings by introducing a reminder event is possible. I am not sure, however, how to convey all relevant error information.

Another possible solution could be to implement #3: The number of requests (and therefore the error printout) would greatly decrease.

karlvr commented 3 years ago

@datMaffin Hello! I'm using your plugin, and enjoying watching my fans spin. I'm encountering this problem and I'd like to fix it. Would you have a moment to describe what you were thinking in #3? I'd be happy to try to implement it.

datMaffin commented 3 years ago

There is now sudo npm install -g homebridge-tesla-powerwall@2.1.0-Beta where thanks to @karlvr caching of requests (#3) was implemented.

(In addition the unit of the fan was changed from percentage to watts; see #25.)

karlvr commented 2 years ago

@datMaffin I still get a lot of errors in my log when the plugin can't connect to the Powerwall… it seems like the Powerwall periodically blocks connections? I can't recall if that's discussed anywhere.

I have implemented a trial coalescing of the same error message so it at most logs it once per X. I'm enjoying it.

It is the EHOSTUNREACH message that plagues me. Is that a known / common thing? I'm happy to PR that change too.

datMaffin commented 2 years ago

@karlvr Hard to say. I do not remember any related discussion in this issue tracker.

I did find the powerwall2 repo to be a great source. The issue tracker of this repo also seems to be used to discuss and exchange solutions for various issues. Might be worth a look.

I have implemented a trial coalescing of the same error message so it at most logs it once per X. I'm enjoying it. It is the EHOSTUNREACH message that plagues me. Is that a known / common thing? I'm happy to PR that change too.

Yes, feel free to open a PR: I really appreciate PRs ;).