AceExpert / ewelink-api-python

An API wrapper around the ewelink-api
30 stars 11 forks source link

Don't die on "pong" response #7

Open chrisboyle opened 2 years ago

chrisboyle commented 2 years ago

To reproduce, make a script that:

  1. Logs in
  2. Successfully powers something on or off.
  3. Sleeps/awaits some other resource until ping_hb() has run at least once (> 152 seconds for me)
  4. Tries a power on or off command

It fails with some combination of TimeoutError and CancelledError, and after I Ctrl-c the script I see a JSON parse error at character 0 happening on the line in the patch below.

With this patch, my long-lived script is happy - specifically I'm watching the Hue event stream for button-presses with aiohue bridge.subscribe(handler).