dclaar / purple_air

Code for displaying Air Quality from a Purple Air device
MIT License
6 stars 4 forks source link

AQI never updates for WebAQI #3

Closed danswett closed 3 years ago

danswett commented 3 years ago

Setup:

  1. App is installed using copy_for_web.py
  2. I swapped lines 183 and 184 in aqi.py so correction "N" is the default

Repro:

  1. Run WebAQI.py

Actual:

  1. Boots normally and shows AQI with correct color background. Heart icon and chase flash as expected
  2. AQI never updates

Expected: AQI updates

Other observations:

  1. CTRL+C from console either shows: Traceback (most recent call last): File "main.py", line 48, in File "main.py", line 36, in main File "aqi.py", line 351, in Run File "aqi.py", line 309, in GetData File "m5stickc.py", line 237, in GetURI File "libs/urequests.py", line 86, in request

or that it's waiting (line 387 in aqi.py)

  1. Value is always updated correctly when the app boots (verified by CTRL+C, CTRL+D to soft reboot and value will always change)
dclaar commented 3 years ago

Hmm. So it doesn't. Looking.

On Mon, Sep 28, 2020 at 3:30 PM Dan Swett notifications@github.com wrote:

Setup:

  1. App is installed using copy_for_web.py
  2. I swapped lines 183 and 184 in aqi.py so correction "N" is the default

Repro:

  1. Run WebAQI.py

Actual:

  1. Boots normally and shows AQI with correct color background. Heart icon and chase flash as expected
  2. AQI never updates

Expected: AQI updates

Other observations:

  1. CTRL+C from console either shows: Traceback (most recent call last): File "main.py", line 48, in File "main.py", line 36, in main File "aqi.py", line 351, in Run File "aqi.py", line 309, in GetData File "m5stickc.py", line 237, in GetURI File "libs/urequests.py", line 86, in request

or that it's waiting (line 387 in aqi.py)

  1. Value is always updated correctly when the app boots (verified by CTRL+C, CTRL+D to soft reboot and value will always change)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dclaar/purple_air/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALAVYX3EIPK6SDTY36MLA3SIEFAFANCNFSM4R5BJWWQ .

dclaar commented 3 years ago

So the local web site actually changes the color every time the AQI changes, using a gradient function. I have not implemented that for the correction modes. So "if aqi changed and color changed": doesn't trigger. It should be "if aqi changed or color changed":

Fixed.

dclaar commented 3 years ago

P.S. Thanks for finding these so fast!

You know, I always thought that I should write unit tests for this stuff.

danswett commented 3 years ago

Always happy to find bugs - thanks for all your work on this, I really appreciate it!

On Mon, Sep 28, 2020 at 9:54 PM Doug Claar notifications@github.com wrote:

P.S. Thanks for finding these so fast!

You know, I always thought that I should write unit tests for this stuff.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dclaar/purple_air/issues/3#issuecomment-700425555, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4JWNPLZ6BUEMPM46DNOYDSIFSALANCNFSM4R5BJWWQ .