SL public transport information (Sweden)

You should have 2 sensors that are related to hasl component sensor.hallplats and sensor.trafikstatus

You can setup just sensor.hallplats sensor with the custom card hasl-comb-card.

A card for the sensor.trafikstatus sensor it is still under development. If you don’t see a sensor.hallplats sensor, you still have problem with the setting up the sensor. Did you remove the sensor: binary_sensor.test from your config?

1 Like

The above error message indicates that the sensor: configured (seems like you are using the example sensor) is not correctly configured. Will look into perhaps making this error message a bit more user-friendly but I would think that could solve your problem.

Wohoo got some progress here :slight_smile:

I did as you said @dimmanramone and commented out the part with binary_sensor.test and now i got a sensor for hallplats and i was also able to get the card working for departures.
But i still wonder why i cant have the binary_sensor.test with friendly name Trafikstatus as a sensor at the same time as departures (avgångar).
This is how the part in my configuration.yaml looks like now:
sensor:
- platform: hasl
ri4key: 1a782c9318354505829760704b3c26fd
si2key: 05b5f5ba4680425f9cde787ec0500011
tl2key: 7e71e09a94a145c58b3733e9fb5455ee
sensors:
- friendly_name: hallplats
sensor_type: comb
siteid: 4244
lines: 474
direction: 1
#sensor: binary_sensor.test
#- friendly_name: Trafikstatus
#sensor_type: tl2

By the way, do you have the siteid for finnboda hamn, i have it at home but cant remember how to get siteid´s when im at work.

@DSorlov, i think i got it working now, thanks anyway!

The binary_sensor error is not related to you trafikstatus sensor friendly name.
To use the sensor config variable in both comb (sensor.hallplats) and tl2 (sensor.trafikstatus) sensors, you have to create first an binary_sensor that returns true or false. If it is true your sensors gets updated as your configuration, if it is false the prevents the sensors to update to save you some API calls :slight_smile:

Here is an example to a binary sensor:

- platform: template
  sensors:
    sl_sensor:
      friendly_name: SL Time Sensor
      value_template: "{{ is_state('input_boolean.sl_refresh', 'on') }}"

Then you are going to need an input_boolean as well as an automation that sets this to on or off :slight_smile:

As soon you have your binary_sensor in place then you can use it in your configuration

sensor: binary_sensor.sl_sensor

Note that the sensor config variable is optional.

1 Like

@dimmanramone thank you so much for all your help!
I have 2 more questions,

  1. how do i get the departure time to be shown in 24h? My are shoing 1:32PM
    and 2:
    How did you get the boat icon on line 80?

If I’m not mistaken, the 24h time is depends on the language/culture of your home assistant and browser. But I’ll check the code and get back to you.

A fix for the boat missing icon is coming in the next release :slight_smile:

Update: I see that in your configuration you don’t use the language variable, so I quess that you browser is set in English US (en-US ). Try change it to English UK (en-GB) instead.

I got the time format corrected by adding sv-SE as language.
How do i do to get updates when changes are done to this card like the fix for the boat icon?

You can update manually or use the custom updater as explained in readme on github

I got it to work at home last night as well but i have one more annoying thing to fix.
Depateure times are shown 2h ahead.
Clock is ok on my RPi and i have timezone set to Europe/Stockholm in my configuration.yaml but still the sensor are 2h ahead.

Are you surfing through a mobile or a PC browser? This is already reported in GitHub so maybe you can comment there instead, report device and browser you are using.

https://github.com/DSorlov/ha-sensor-sl/issues/26

1 Like

Thanks, posted there. Its the same on both HA app and on browser on phone and Mac.

1 Like

Hi, I was using the implementation by fredrikbaberg before but when I updated to 0.94 I decided to try out the DSorlovs instead. However, for some reason Home Assistant cannot find the platform.

In validation of the config:
image

All the files are available in custom_components\hasl, same as where I had custom_components\sl before

When I restart HomeAssistant with the non-validated config the only relevant in the logs is:

2019-06-14 09:07:43 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hasl which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

Which is the same as for all custom_components, however I get no entities from this.

I’m running HA in Docker, could there be some dependencies missing?

My config:

sensor:
  - platform: hasl
    ri4key: ...
    si2key: ...
    ti2key: ...
    sensors:
    - friendly_name: ...
      sensor_type: departures
      siteid: ...
      sensor: binary_sensor.kolla_sl
    - friendly_name: Trafikstatus
      sensor_type: status
      sensor: binary_sensor.kolla_sl

Any tips of what I can do to locate the error?

Do you still get an error in the validation after restarting? Did you remove the old custom component?
I guess you copied all the files under your hasl folder?

As long about the warning is nothing that you should care, I get the same warning for all the custom components I have.

Yes, still validation error after restarting. I removed the old component and have made sure every file is there, both by downloading the files from github and copying them manually and through installation with HACS.

Yeah, I know the warning is just standard, but in this case I took it as an indication that home assistant atleast recognizes the custom_component somehow.

I’ve updated to 0.95.4 now, still the same issue…

I tried going back to the old sl platform but then I got some error that there was some issue with the integration (missed to copy the error message) but I assume this is because it misses the manifest etc and is not usable anymore?

The manifest file should be there because it has references in the depencies/requirements. Hasl component needs the Hasl communication library to work.

All the files under the hasl folder should be there to get the component to work properly.

image

Yes, I know, and that is partly why I changed to ‘hasl’ platform instead of the old ‘sl’ platform which does not have this, I was just not sure at which version of HA that the old format was still supported and if this was they way it would throw the error…

All the files for hasl are there.

If I’m not mistaken after 0.92 you need to have the latest version of the component.

Did you try to delete the pycache folder and restart?

If it doesn’t work can you add the debug flag for this component in the logger and post the logs`?

Hi any one of you that may help me. I am not able to get the sensor registred. running hass.io 0.95.4 in docker on ubuntu. i have not installed the hasl-communication-library need i do that. i have also tried to install it with hacs it did not make it worse atleast. here is some config
configuration.yaml

 - platform: hasl
    ri4key: *******************************************
    si2key: *******************************************
    ti2key: *******************************************
    sensors:
    - friendly_name: Farsta_Strand
      sensor_type: comb
      siteid: 9180
      lines: 18, 42, 43, 45, 742
      direction: 1
    - friendly_name: Trafikstatus
      sensor_type: status

and i have all 4 files under
image

have i missed anything?

do i need to install hasl-communication-library ?
if yes how do I install it do i install it in the docker image or on the ubuntu host?

sincearly
Fredrik Buchanan

You don’t have to install anything else. Your status sensor should work and you should be able to see it in home assistant. The comb sensor it is not called comb anymore, but departures. Check again the documentation on github.

- friendly_name: Farsta_Strand
      sensor_type: departures
      siteid: 9180
      lines: 18, 42, 43, 45, 742
      direction: 1
1 Like

I actually have the same problem myself right now. I cannot for the life of me understand why it will not find the platform. It does recognize it as it gives a warning but that is all. Looking into this right now, any tips are welcome (if I missed some update or similar that needs to be done)