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

Sensors not updating #2

Open
JakobEgPedersen opened this issue Mar 27, 2024 · 5 comments
Open

Sensors not updating #2

JakobEgPedersen opened this issue Mar 27, 2024 · 5 comments

Comments

@JakobEgPedersen
Copy link

The integration works fine, but only updates when HA is restarted.
I have tried to make a service call in an automation to reload the integration, like I also do for other integrations, but cannot find this integration in automation.
Is it supposed to automatically pull new data every day, or only when a service call is made?
I can see others on Facebook DK HA group are having same issue.
pollen

@jesperll
Copy link

jesperll commented Apr 8, 2024

Each sensor is created with the instance of a region that exists at launch.

regions = pollen_DK.getRegions()
for region in regions:
for pollen in region.getPollenTypes():
entities.append(
PollenSensor(hass, coordinator, region, pollen, len(regions))
)

pollen_DK.update replaces all the region instance with new ones but the sensors keep looking at the original

self._regions[regionID] = PollenRegion(
int(regionID),
self._pollenIDs,
r_json["fields"][regionID]["mapValue"]["fields"],
)

@thomasgunnar
Copy link

I have the same problem - any fixes ?

@daath
Copy link

daath commented Apr 30, 2024

Same - Any fix for this?

@JakobEgPedersen
Copy link
Author

Each sensor is created with the instance of a region that exists at launch.

regions = pollen_DK.getRegions()
for region in regions:
for pollen in region.getPollenTypes():
entities.append(
PollenSensor(hass, coordinator, region, pollen, len(regions))
)

pollen_DK.update replaces all the region instance with new ones but the sensors keep looking at the original

self._regions[regionID] = PollenRegion(
int(regionID),
self._pollenIDs,
r_json["fields"][regionID]["mapValue"]["fields"],
)

Jesper LL what are you trying to say?
Should it work, or are there something that I can change in the code myself to make it work?
Fact is that it only updates at HA restart.
I have tried various attempts to make it refrest, but only works at restart.

@jesperll
Copy link

jesperll commented May 3, 2024

I'm saying the code is written incorrectly and will never update correctly as-is
My python skills are unfortunately quite "read only" and so all I could do was point at the problem - not the solution ¯\(ツ)

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

No branches or pull requests

4 participants