custom-components / feedparser

📰 RSS Feed Integration
MIT License
135 stars 34 forks source link

Feed sensor doesn't update #104

Open Dynamix72 opened 11 months ago

Dynamix72 commented 11 months ago

I use the feedparser to get the news. But de feed is only parsed after a reboot of Home Assistant. Even with the scan_interval parameter, the feed is not updated. Any idea's

# -----------------------
# RSS feeder sensor
# -----------------------
  - platform: feedparser
    name: Nu.nl
    feed_url: 'https://www.nu.nl/rss/Algemeen'
    scan_interval:
      hours: 1
    show_topn: 10
    exclusions:
      - tags
      - title_detail
      - summary_detail
      - authors
      - author
      - author_detail
      - rights
      - rights_detail
      - id
      - guidislink
ogajduse commented 11 months ago

@Dynamix72 What version of the feedparser integration do you use?

Dynamix72 commented 11 months ago

version 0.2.0b4 Home Assistant 2023.9.2

ogajduse commented 11 months ago

I have observed the same behavior on my local setup. Thank you for reporting it. I will look into it.

ogajduse commented 11 months ago

So far I have found out that sensor entries get updated correctly every time. However, if the number of items (entries) in the RSS feed does not change, even though the RSS feed itself was updated, Home Assistant does not update the extra_state_attributes.

I will continue the investigation in the upcoming days.

Dynamix72 commented 11 months ago

So far I have found out that sensor entries get updated correctly every time. However, if the number of items (entries) in the RSS feed does not change, even though the RSS feed itself was updated, Home Assistant does not update the extra_state_attributes.

I will continue the investigation in the upcoming days.

Ok thanks for the research so far. Hope you will find a solution.

Failure404 commented 10 months ago

I am experiencing the very same problem. Of course I hope it'll be fixed :-)

AndreVde commented 10 months ago

Same problem here (version 0.2.0b4). One thing I noticed is when i press the update status button in the developer tools page. The sensor updates after 30 about seconds. So the sensor updates after a reboot, and when the update status button is pressed.

ogajduse commented 10 months ago

I am sorry, but I do not see myself fixing it in the upcoming weeks. If there is any developer who would like to investigate further or eventually reach out to HA developers about how to properly implement the entity state update, please feel free to do that. The latest non-beta version should be still functional. I will not release the beta until this issue is resolved.

1mfaasj commented 10 months ago

Same problem here (version 0.2.0b4). One thing I noticed is when i press the update status button in the developer tools page. The sensor updates after 30 about seconds. So the sensor updates after a reboot, and when the update status button is pressed.

Where can I find the status button?

AndreVde commented 10 months ago

Same problem here (version 0.2.0b4). One thing I noticed is when i press the update status button in the developer tools page. The sensor updates after 30 about seconds. So the sensor updates after a reboot, and when the update status button is pressed.

Where can I find the status button?

Developer-tools -> states -> search for entity -> click on entity -> button becomes visible

IMG_0440

lorenzodeveloper commented 9 months ago

Hey @ogajduse , you can set self._attr_force_update = True in the init method of the SensorEntity to force the update even if the native value is not changing. https://developers.home-assistant.io/docs/core/entity/

I've added it and it seems to work, as I see that the entries are updated in my companion app and looking at the state itself in dev tools.

My wallpanel is not updating the list card tho, but it might be another problem, maybe due to some cache setting in chromium. Best regards,

Lorenzo

ogajduse commented 9 months ago

Hey @lorenzodeveloper! Thanks for going through the docs! That one must have slipped out of my sight. And it indeed does what we need! I have merged it in #110.

The list card is not updating the entity with every update, so I have to manually reload the page to actually see the update in the Lovelace.

Thank you again!

ogajduse commented 9 months ago

@Dynamix72 @AndreVde @Failure404 I have published a new beta version https://github.com/custom-components/feedparser/releases/tag/0.2.0b5. Can you please try if it fixes the issue?

Dynamix72 commented 9 months ago

The new version works great!! The sensor is now updating every hour. If you refresh manualy the page, then the new feed is also visable in list-card.

pxFIN commented 9 months ago

I can also confirm beta 5 works great