feedparser icon indicating copy to clipboard operation
feedparser copied to clipboard

Feed sensor doesn't update

Open Dynamix72 opened this issue 1 year ago • 15 comments

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

Dynamix72 avatar Sep 20 '23 12:09 Dynamix72

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

ogajduse avatar Sep 20 '23 18:09 ogajduse

version 0.2.0b4 Home Assistant 2023.9.2

Dynamix72 avatar Sep 21 '23 06:09 Dynamix72

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

ogajduse avatar Sep 21 '23 08:09 ogajduse

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.

ogajduse avatar Sep 23 '23 16:09 ogajduse

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.

Dynamix72 avatar Oct 12 '23 08:10 Dynamix72

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

Failure404 avatar Oct 23 '23 20:10 Failure404

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.

AndreVde avatar Nov 01 '23 21:11 AndreVde

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.

ogajduse avatar Nov 08 '23 08:11 ogajduse

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?

1mfaasj avatar Nov 10 '23 05:11 1mfaasj

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

AndreVde avatar Nov 10 '23 05:11 AndreVde

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

lorenzodeveloper avatar Nov 17 '23 18:11 lorenzodeveloper

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 avatar Nov 21 '23 21:11 ogajduse

@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?

ogajduse avatar Nov 21 '23 21:11 ogajduse

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.

Dynamix72 avatar Nov 22 '23 16:11 Dynamix72

I can also confirm beta 5 works great

pxFIN avatar Dec 03 '23 13:12 pxFIN