Nederlandse Spoorwegen Card + help needed

Hi guys,

I made my first card this week using the NS (Nederlandse Spoorwegen) API sensor, doc found here:

You can see what it looks like. When delayed it will add ‘+3’ in red after the time. Platform and delay will automatically update. Might still need some minor improvements.

Github Repo:

Screenshot of the error:

Issue has been fixed. Custom JS declared now in lovelace instead of configuration.yaml.

Hi, nice! Can you post the logic of the card? :slight_smile:

Hi, what do you mean by logic?

Hey there, I think @firstchair was asking if you could share the content of your “ns-status-card.js” file, so we also can try it. I will appreciate it as well.

Yes of course. will add the full code to Github tomorrow and will post the link here once it’s available.

1 Like

Github Repo added!

1 Like

The card is great, but I just tried the NS integration to get the next train. But updates are so slow I mostly get the previous train. What do you use for settings to get meaningful results? Always one with a set time? Because that is not that useful for school when the first class is different all the time.

@Edwin_D did you find a solution? Standard updates every half hour indeed and is also too slow for me.

Nope, sorry. Didn’t have time to pursue this further. Looked a bit at the code though. The API seems suitable to use only few updates and still be able to have future trains as well by asking more alternatives at the same time. But it will require some programming to show the right one at the right time. I’m not in a position to do so.

1 Like

it’s been some time. did you manage to increase the interval?

No, I don’t have the time.

image

when i try to add it through HACS i get this error… in the description it is saying lovense category but that doesn;t exist anymore

the manual instructions are also not very clear to me …

can someone help

I just want to try to add NS integration. But my log says:

Logger: homeassistant.components.nederlandse_spoorwegen.sensor
Source: components/nederlandse_spoorwegen/sensor.py:72
integration: Nederlandse Spoorwegen (NS) (documentation, issues)
First occurred: 11:00:25 (1 occurrences)
Last logged: 11:00:25

Could not fetch stations, please check configuration: The request could not be handled by the API

I suppose this integration is up to date and working for all of you (although I see only 2 active installations are using it).

I have tried my own preferences with train stations. But the code of the station is not correct according to log. When trying the standard sample, it doesn’t work either:

# Example configuration.yaml entry
sensor:
- platform: nederlandse_spoorwegen
  api_key: NS_API_KEY
  routes:
    - name: Rotterdam-Amsterdam
      from: Rtd
      to: Asd
    - name: Groningen-Zwolle-Maastricht
      from: Gn
      to: Mt
      via: Zl
    - name: "AlmereBuiten-Duivendrecht-the-08h06m-train"
      from: Almb
      to: Dvd
      time: "08:06:00"

I’m now trying the API from Ns-App… see if that’s making the difference as I used the API code for “Public-Travel-Information”

EDIT: got it working, wrong API key… :cold_face: