hasl-sensor / integration

Swedish Public Transport Sensor (HASL). Formerly named HomeAssistant SL Sensor
https://hasl.sorlov.com
Apache License 2.0
36 stars 8 forks source link

Sensor not showing up in HA #41

Closed magune closed 2 years ago

magune commented 2 years ago

Hi,

No matter how I try I cannot make the sensor for local bus stop timetable to show up in HomeAssistant.

I have created an API key in Trafiklab for ResRobot 2.1. I added Resrobot as HACS integration

I added this to configure.yaml:

sensor:

Sensor is not showing up in Developer/Entity list.

So I also added this as HACS integration as well;

SL Integration (HASL) Swedish Public Transport Sensor (HASL). Formerly named HomeAssistant SL Sensor

No matter how I try various things, the sensor showing me the timetable for a bus stop in Jönköping (740039603) will not become visible in Home assistant.

Any ideas to help is most welcome!

DSorlov commented 2 years ago

This seems to be regarding the ResRobot integration which is located at https://github.com/TekniskSupport/home-assistant-resrobot/issues. However you are able to also use HASL for Resrobot queries. You do not need the ResRobot integration for this. If you decide to go and use HASL you can add this under the GUI and integrations tab where you will be guided in the setup and you do not need to edit any configuration files.

magune commented 2 years ago

Thanks, it helped a lot - but not all the way!!

I got it working, almost. I did get the HASL integration to install in HA and got to see the GUI configurator you mentioned. very simple and well developed. Also the GUI informs me I need an API key for the REALTIDSINFORMATION 4 API. This suggest it is Stockholm bus lines only. Anyways.

I created an API key for the REALTIDSINFORMATION 4 API, but the HA Developer/Entities debug panel show me this error, despite using an API key that is created for SL Realtidsinformation 4:

api_result: 'SLAPI_API_Error 1002: The supplied API key is not valid (Departures)'

There are so many different API's with their own API keys to chose from at Trafiklab.se, it is really confusing.

Exactly what API (and hence, API key) should be used to get a sensor that reports the timetable for a bus stop in Jönköping (not Stockholm?) In this case bus top #740039603.

The SL Realtidsinformation 4 API feels like being Stockholm only?

DSorlov commented 2 years ago

You should use the "Resrobot Departures" sensor from HASL (Svensk Kollektivtrafiksensor) step1

You should then in next step enter a resrobot api key (as in your first post). step2

magune commented 2 years ago

Thank you so much for trying to help me, I appreciate it!

I think I am doing exactly as you say, but it still doesn't work.

It appears your GUI is not exactly like mine. I have the latest publicly found from inside the HA admin panels. Are you running an older version, or a new beta perhaps? Alternatively, I cannot find the correct integration you refer to and use the wrong one,

First I go to CONFIGURATIONS, INTEGRATION. I try to add a new integration and search for HASL (searching for RESROBOT or Svensk Kollektivtrafik gives 0 search results here):

image

image

image

Since only SL INTEGRATION (HASL) is found in an integration search, I chose it:

image

As you say, a nice konfiguration wizard is displayed:

I give the integration a name and select DEPARTURES:

image

The next step specifically asks for REALTIDSINFORMATION 4 API KEY. I enter it (generated from Trafiklab.se), and select bus stop id:

image

image

I get to success: image

But the sensor generates API ERROR 1002 - API KEY ERROR:

image

I am increasingly thinking I am not able to find the correct integration, as your GUI screenshots doesn't look like mine?

DSorlov commented 2 years ago

You should be able to use the: hasl from HACS.

magune commented 2 years ago

Thank you, this is what I use. I also use the API key for ResRobot v2.1 in the sensor configuration for my buss stop:

image

However, the sensor display authentication error. It says the API key is not valid (for Departures):

image

My aim is to present the next few departing buss times from my local bus stop in Jönköping.

DSorlov commented 2 years ago

Seems like you are not using the beta version but the release version= Can you see which version you have (this is present on the Configuration->System->System Health->Hasl. You should be running 3.1.0b1 minimum I think. If this is not the case make sure you can see the early/preview versions.

magune commented 2 years ago

This is what it reports, and what was installed a few days ago:

image
magune commented 2 years ago

ok, I upgraded to the Beta:

image

I add the API key for Resrobot 2.1 from Trafiklab.se. Pls note this image suggest I should use a different API key (SL realtidsinformation 4):

image

I still get API authorization error:

image

And the departure card I try to use in the dashboard, is of course empty showing no bus departures:

image
DSorlov commented 2 years ago

Restart HA and reload GUI. You should then be able to create a resrobot sensor.

magune commented 2 years ago

Home assistant refuses to restart because there is a platform error in that the Resrobot integration is not installed (it was before).

image

So I reinstalled it, but it cannot be installed without a restart, that can't be done before it is installed. :-(

image

Fairly frustrating.

DSorlov commented 2 years ago

I think that you might have some resrobot: config in your config.yaml (resrobot is another integration)

magune commented 2 years ago

you were right, I have deleted the resrobot stuff from config.yaml and restarted.

I still get the API authorization error:

image

The API token I use is for the ResRobot 2.1 API at Trafiklab.se.

DSorlov commented 2 years ago

Delete the existing sensor and create a new one and you should be able to select the resrobot type of sensor. The sl sensor only works with sl-keys (and in sl area)

magune commented 2 years ago

Thank you. After deleting the HASL integration, and re-adding it, it now works. Thanks!

DSorlov commented 2 years ago

Yay! Great! Let me know if any other issues arises!