core: Integration nederlandse_spoorwegen not working for new users
Home Assistant release with the issue: 0.98.5
Last working Home Assistant release (if known): ?
Operating environment (Hass.io/Docker/Windows/etc.): Docker
Component/platform: https://www.home-assistant.io/components/nederlandse_spoorwegen/
Description of problem: The provider of the API has migrated to a new version. The old API will shut down by October 1st. Old users are still able to access the old API but new users do not get a key for the new API anymore. See also https://github.com/home-assistant/home-assistant/issues/24454
The external lib is being updated and will hopefully rev-up soon https://github.com/aquatix/ns-api/issues/16
The nederlandse_spoorwegen
integration has a hardcoded link to a (soon disfunctional) version of this lib, so requires an update:
"requirements": [ "nsapi==2.7.4" ]
https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/nederlandse_spoorwegen/manifest.json
Problem-relevant configuration.yaml
entries and (fill out even if it seems unimportant):
Traceback (if applicable):
Couldn't fetch stations, API password correct?: 400 Client Error: Bad Request for url: http://webservices.ns.nl/ns-api-stations-v2
Additional information:
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 37 (14 by maintainers)
Hey all, just a heads-up that I just released version 3.0.0 of the ns-api library. This should restore functionality, due to the hard work of @Squixx in https://github.com/aquatix/ns-api/pull/17 . (I had to edit it to not change all the line-endings and a few more things, so ended up committing their work myself in https://github.com/aquatix/ns-api/pull/18 ).
If I’m correct, you can request a new API key here: https://apiportal.ns.nl/
I am new to Home Assistant myself, so will have to test there, but I’m glad my library is of use! Please let me know if there are any issues.
@Tuumke that first error is new to me and quite enigmatic (the actual error does not originate from the NS integration), hope it stays away. The second one is known and a fix is on its way #31741
Waiting for this. Keep up the great work, much appreciated!
I think the library is doing what it should, planned and actual time are reported in an optimal way. If in some strange event a train has neither, the library will return None for both.
As #30599 was merged during the 0.104 beta period, it was not included by default. I could have tagged it as a bugfix to make that happen. However, since it was a more complex change I decided that it deserved a full beta cycle. It will be in 0.105.
We always pin dependencies to make sure that only tested combinations are installed. Moving to NS API 3.0.1 thus requires a new Home Assistant PR with a version bump.
As predicted, not that easy. Modified the NSAPI constructor to only pass the password/api key. Now, I’m getting a
KeyError: 'payload'
error inns_api.py
(line 930). Not sure why, I tried the interactive API explorer by NS and indeed, thestations
API returns apayload
JSON field. @aquatix any idea what could cause this?— EDIT — Registering for the wrong API key is what causes this. Please discard this question.
Doesn’t work for me. 2019-11-28 17:03:31 ERROR (SyncWorker_11) [homeassistant.components.nederlandse_spoorwegen.sensor] Couldn’t fetch stations, API password correct?: 400 Client Error: Bad Request for url: http://webservices.ns.nl/ns-api-stations-v2.
Looking at the documentation, it seems that a primary of secundary key should be sent as well.