Skip to content

Setup hangs: userinfo request has no timeout and no browser User-Agent #50

Closed

Description

@renef79

The log line

Problem
Adding the integration: login succeeds, but setup never finishes. The config entry
setup is eventually cancelled ("Setup of config entry … for postnl integration cancelled")
and no entities are created.

Debug log shows it stops at PostNLLoginAPI.userinfo() (login_api.py).
That request uses a plain requests.Session:
- no timeout, so a stalled connection blocks setup forever
- no User-Agent, so it is sent as "python-requests/x.y"
The login flow in auth.py does send a browser User-Agent, and works fine.

Fix that worked for me (login_api.py)
- add the same browser User-Agent as auth.py (_USER_AGENT) to the session headers,
  plus "Accept: application/json"
- add timeout=(10, 30) to the userinfo GET

After this change and a restart, setup completes immediately and all sensors load.
Probably worth applying the same timeout/User-Agent to the other requests-based calls.

Integration version

4.10.5 (HACS)

Home Assistant version

2026.11, HA OS

Activity

  1. added
    unrecognised-status
    on Nov 13, 2026
  2. peter-mdf commented on Nov 14, 2026

    @peter-mdf
    Collaborator

    Thanks for the report @renef79 . It's indeed a bug, so well spotted. Fixed in the next version :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

unrecognised-status

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions