Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for updates not being pushed out #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hirenj
Copy link

@hirenj hirenj commented Jun 1, 2024

I noticed a bug where the updates weren't being forwarded to the sensor. You can see this when you insert an UUID into the PollenType objects when they're created, and look at which UUID is being used to send out the updates. This has also been discussed in #2

2024-06-01 21:33:59.479 DEBUG (SyncWorker_3) [custom_components.pollen_dk.pollen_dk_api] Creating new Pollen type
2024-06-01 21:33:59.479 DEBUG (SyncWorker_3) [custom_components.pollen_dk.pollen_dk_api] 0409b222-11cc-4b3b-8700-4de58c5b8c29
2024-06-01 21:33:59.480 DEBUG (MainThread) [custom_components.pollen_dk.sensor] Finished fetching sensor data in 0.363 seconds (success: True)
2024-06-01 21:33:59.481 DEBUG (MainThread) [custom_components.pollen_dk.pollen_dk_api] Getting level from pollen type
2024-06-01 21:33:59.481 DEBUG (MainThread) [custom_components.pollen_dk.pollen_dk_api] 0409b222-11cc-4b3b-8700-4de58c5b8c29

The very first run creates a UUID for the PollenType object 0409b222-11cc-4b3b-8700-4de58c5b8c29.

The next update creates a brand new PollenType (UUID efd1dd15-5d2c-4bf3-8bd3-44bbb8fd4afd), but the sensor ("Getting level from pollen type"), still references 0409b222-11cc-4b3b-8700-4de58c5b8c29.

2024-06-01 21:33:59.482 INFO (MainThread) [homeassistant.bootstrap] Home Assistant initialized in 1.30s
2024-06-01 21:33:59.483 INFO (MainThread) [homeassistant.core] Starting Home Assistant
2024-06-01 21:34:59.418 DEBUG (MainThread) [custom_components.pollen_dk.sensor] Updating pollen...
2024-06-01 21:34:59.687 DEBUG (SyncWorker_0) [custom_components.pollen_dk.pollen_dk_api] Creating new Pollen type
2024-06-01 21:34:59.689 DEBUG (SyncWorker_0) [custom_components.pollen_dk.pollen_dk_api] efd1dd15-5d2c-4bf3-8bd3-44bbb8fd4afd
2024-06-01 21:34:59.691 DEBUG (MainThread) [custom_components.pollen_dk.sensor] Finished fetching sensor data in 0.273 seconds (success: True)
2024-06-01 21:34:59.691 DEBUG (MainThread) [custom_components.pollen_dk.pollen_dk_api] Getting level from pollen type
2024-06-01 21:34:59.691 DEBUG (MainThread) [custom_components.pollen_dk.pollen_dk_api] 0409b222-11cc-4b3b-8700-4de58c5b8c29

To fix this, I've made the sensor objects not reference region objects and pollen objects directly, but instead it looks them up from the Pollen_DK object.

@Kannut
Copy link

Kannut commented Jul 3, 2024

Any updates to this?

@woopstar
Copy link

woopstar commented Aug 9, 2024

@J-Lindvig any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants