You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Hardcoded Chrome/120 User-Agent is rejected by some feeds (403 → "cannot_connect") #7
What happens
Adding https://aidoende.nl/AI/feed.xml fails in the config flow with cannot_connect. The feed itself is valid RSS 2.0 with 30 items.
The cause is the hardcoded User-Agent in const.py:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
The site's server (Apache) blocks this outdated Chrome version and returns 403 Forbidden – Request forbidden by administrative rules. async_validate_feed then turns that into cannot_connect, so the reason is not visible to the user.
Reproduction
curl -o /dev/null -w "%{http_code}\n" -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" https://aidoende.nl/AI/feed.xml
# 403
curl -o /dev/null -w "%{http_code}\n" -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36" https://aidoende.nl/AI/feed.xml
# 200
Mozilla/5.0 on its own, feedparser's own User-Agent and Home Assistant's own User-Agent all get 200 as well. Changing only Chrome/120.0.0.0 to Chrome/140.0.0.0 in const.py fixes it locally.
Suggestions
Update the default User-Agent. Better still, make it configurable in the options flow (or use an honest UA such as HomeAssistant-Feedparser/<version>), because a frozen browser string will keep going stale.
Show HTTP status errors (403/404) in the config flow, instead of mapping them to cannot_connect.
Feeds that refuse the browser string load again. The integration now presents a current Chrome, and if a server still answers with 403, it asks once more as HomeAssistant-Feedparser. That means a feed keeps working even when the browser string ages again. https://aidoende.nl/AI/feed.xml can be added now.
The setup dialog says what went wrong. Instead of "Failed to connect" for everything, it now tells you when the server refused access (403), needs a login (401) or has no feed at that address (404/410). The same messages appear under Reconfigure.
Update through HACS and add the feed again; nothing else needs changing.
Activity
Merge pull request #8 from timmaurice/fix/7-user-agent
timmaurice commentedon Sep 25, 2026
@DJGizbo thanks a lot for this report, and for the clear reproduction with both curl commands. It made the cause easy to confirm.
Both of your suggestions are in 1.3.0:
HomeAssistant-Feedparser. That means a feed keeps working even when the browser string ages again.https://aidoende.nl/AI/feed.xmlcan be added now.Update through HACS and add the feed again; nothing else needs changing.