Custom Component: Helsinki Regional Transport (HSL HRT) Route Times

So far so good. These seem to work fine. If you still face problems, do share your template script and we could check that once.

Not sure what was the problem before, started from the scratch and now everything is fine. Thanks a lot for the support!

Some improvement ideas if these informations are available from the API:

  • would be great to show which train track the train will be leaving
  • show if there is some disturbance affecting to specific transportation line (delays, cancellation etc) or if there is some other major disturbance.

Great work, thank you!

With current Metro traffic in Espoo, I would like to have a sensor from my STOP CODE to a fixed DESTINATION, Matinkylä (M) where several routes from my two main stops are driving to. So would it be possible to make a sensor from a STOP CODE to a DESTINATION (not ROUTE), and then show a table for the next 4-5 routes to that destination with arrival time?

Anyway, great addon!

Hello!

Great work with the integration!

For some reason, I am not able to add an integration for a particular bus stop (code Si2223). The error I am getting: Stop Name or Stop Code is invalid!

I managed to add an integration with another bus stop though.

Any ideas?

Hi @afterdiver: Thanks for trying this out!

I have now added Stop Code + Destination filter. When a new HSL integration is added, it provides an option to specify the destination. Note that if route is specified, it takes precedence over the destination filter. I tried this with couple of stops I know and it works fine. Do give this a shot and let me know how it goes.

Latest release.

Regards,
Anand.

Hi @Kaist0,

Welcome to the community and thanks for trying this integration!

This was indeed a bug. It seems that HSL API is case in-sensitive for Stop Name, but not for Stop Code. So Si2223 is a valid Stop Code, but SI2223 and si2223 is not. I fixed this now and was able to retrieve the stop and route details for Si2223 as well. Here is the latest release. Do give it a shot and let me know if that solves your problem.

Regards,
Anand.

Hello,

this fixed the problem for me.

Thank you!

1 Like

hi, I am having a problem with following the installation instructions. You mention that

1. Using a tool of choice open the directory (folder) for HA configuration (where you find configuration YAML file)
2. Download all the files from the this repository and place the files in this directory.
3. If the files are placed correctly, it should have the hierarchy as: <HA configuration directory>/custom_components/hslhrt

however the files from the repository do not contain any hslhrt folder. Could you help out? thanks

Hi @henkm

Somewhere down the line, directory structure got corrupted. I will fix that soon. In the meantime, could you create the hslhrt directory and manually copy all the files there. So instead of custom_components/Readme.md, you should have custom_components/hslhrt/Readme.md and so on.

Sorry about this!

Regards,
Anand.

1 Like

I followed your instructions, however hsl is not showing up under the settings > integrations. Is there a simple way to troubleshoot this? thanks!

EDIT: Found the solution, stop-id “H0090” is the one to use for Pasila not “H0091”.

I started using this custom component just now and it seems awesome, great job! But one thing that I dont understand is why I cant add “Pasila” or the corresponding stop-id “H0091” as the destination. Ha gives me “2021-03-14 18:03:25 ERROR (MainThread) [custom_components.hslhrt] invalid_destination” in return.

I try to set up a sensor from (stop) Kirkkonummi to (Destination) Pasila with route set to All. Opposite way of travel works though.

Any suggestions?

@henkm: This can happen if the browser cache is not cleaned. Can you clean up browser (just google for the browser you are using). Once you have done this try to look for HSL in integrations again?

BTW: I have now fixed the directory structure for this component.

1 Like

@johfo: I am assuming you found a solution. If not please do leave a note.

Regards,
Anand.

the latest version worked for me, thanks!
Could you update your instructions, because currently these are still confusing
3. If the files are placed correctly, it should have the hierarchy as: /custom_components/hslhrt

your current file structure on github does not contain /custom_components/hslhrt folders. So best to restore the previous instructions, for example by replacing 2 and 3 with these instructions:

2. Open folder custom_components
3. Create folder hslhrt
4. Download all the files from the this repository and place the files in this directory.

Thanks Anand,

are you going to get this added to HACS, for easier install/update process?

/nico

@henkm : I agree. I have now updated those instructions in v 0.3.4. Thanks again!

@afterdiver : I was thinking more of proposing this to the main HASS release, although it may take months before it is available as part of core release. For HACS, I have not planned that yet, but probably will do so some time later.

Noticed the same and found the reason. It is a two-phase “bug”, where array reading starts from 1 instead of 0 skipping the first item.

First one is at hslhrt/sensor.py file at line 110. Array reading starts from 1, when it should start from 0.

Second one is in the template. Here also first array item is ignored and the fetching starts from second item (value 1). Check that counting starts from 0 instead of 1.

Hello @anand-p-r!
Unfortunately I am facing this same issue @Revolver reported while ago. Option-4 is lacking two next busses. It seems not to be time dependent, like 30min or anything, but exactly two next coming busses are not listed. This is unfortunate as on a typical morning those would be exactly the most needed ones.
Here’s two screenshots taken at a same time from HSL and this component:
image
image
Anyway, thanks for a great effort! I really appceciate :slight_smile:

Hello @Ruohonjuuri,

Sorry for the late response! Busy times…
Are you observing this issue consistently?
Could you also check how many next routes were pulled by the integration? This can be checked from the Lovelace UI. Go to Developer Tools → States. Under Entity select the HSL-HRT sensor (should be sensor.<stop-name>_<stop-code>_<destination/ALL>). This shows the current “State” and “State Attributes”. Under “State Attributes”, you should see a list of “ROUTES”. The route list in UI-Option-4 is derived from this list of “ROUTES”.
When you observe the problem of lines not appearing in the UI, can you check if those missing lines are visible under the “ROUTES” list? And if so, can you also please share the template code you have used to display the UI (via email)?

Regards,
Anand.