pbutterworth / pychlorinator

MIT License
3 stars 1 forks source link

slow bluetooth response causing unavailable? #1

Closed DunkyDaMonkey closed 1 year ago

DunkyDaMonkey commented 1 year ago

I'm not sure if this is the actual cause, but while debugging I noticed a 10sec delay on the response values from the Astral chlorinator resulted in the values going to "Unavailable" on the home assistant side.

I suspect that this is the intermittent cause for the value, if understand the code correctly its might just be a case of increasing the timeout=3 to 10 or 15sec. image

image

Here are the two lines with timeout=3

https://github.com/pbutterworth/pychlorinator/blob/85b78ebc12f1f09a57d2bbf9c88e05e839bf6130/pychlorinator/chlorinator.py#L95

https://github.com/pbutterworth/pychlorinator/blob/85b78ebc12f1f09a57d2bbf9c88e05e839bf6130/pychlorinator/chlorinator.py#L136

I was going to update mine, but the pychlorinator must have been compiled and installed?

pbutterworth commented 1 year ago

Yeah, I was actually meaning to do that. Sounds like ble is very prone to connection failures. There's chit-chat about the bleak_retry_connector, but the docs are very sparse. I need to get on discord and see if some of the HA bluetooth gurus can help...

Anyhow, I've updated the timeout to 10s for now. See if it has any effect...

DunkyDaMonkey commented 1 year ago

Thanks for making the change, i've tested and checked the logged, i'm still occasionally getting responses at 10-12sec, but I've seen more than a few at the 4-8 sec make it through.

I'm still getting a whole bunch of disconnects and "unavailable" on the sensors, so I think still probably the connection stability.