Skip to content

Commit c4bd08d

Browse files
committed
Release 3.1.0
1 parent 68d79c8 commit c4bd08d

File tree

7 files changed

+69
-16
lines changed

7 files changed

+69
-16
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
[![hacs_badge](https://img.shields.io/badge/hacs-default-orange.svg)](https://github.com/custom-components/hacs)
22
[![ha_version](https://img.shields.io/badge/home%20assistant-2021.12%2B-green.svg)](https://www.home-assistant.io)
3-
![stability-stable](https://img.shields.io/badge/stability-stable-green.svg)
4-
![version](https://img.shields.io/badge/version-3.0.5-green.svg)
3+
![version](https://img.shields.io/badge/version-3.1.0-green.svg)
54
![maintained](https://img.shields.io/maintenance/yes/2022.svg)
65
[![maintainer](https://img.shields.io/badge/maintainer-dsorlov-blue.svg)](https://github.com/DSorlov)
76
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
87

9-
Home Assistant SL Sensor (HASL)
10-
===============================
8+
Swedish Public Transport Sensor (HASL) (formerly Home Assistant SL Sensor)
9+
==========================================================================
1110

12-
This is a platform for Home Assistant that can be used to create "Departure board" or "Traffic Situation" sensors for buses and trains in Stockholm, Sweden. You have to install it as a custom component and you need to get your own API keys from SL / Trafiklab. Originally started with [fredrikbaberg SL sensor](https://github.com/fredrikbaberg/ha-sensor-sl) that was forked into [Home Assistant SL Sensor by DSorlov](https://github.com/DSorlov/hasl-platform) and now moved to its own organisation and life as [Home Assistant SL Sensor Integration](https://github.com/hasl-platform/integration).
11+
This is a platform for Home Assistant that can be used to create "Departure board" or "Traffic Situation" sensors for buses and trains in Stockholm, Sweden (but also for the rest of Sweden using Resrobot sensors). You have to install it as a custom component and you need to get your own API keys from SL / Trafiklab. Originally started with [fredrikbaberg SL sensor](https://github.com/fredrikbaberg/ha-sensor-sl) that was forked into [Home Assistant SL Sensor by DSorlov](https://github.com/DSorlov/hasl-platform) and now moved to its own organisation and life as [Home Assistant SL Sensor Integration](https://github.com/hasl-platform/integration). The name HASL comes from the time when the project was Home Assistant SL Sensor.
1312

1413
![card](https://user-images.githubusercontent.com/8133650/56198334-0a150f00-603b-11e9-9e93-92be212d7f7b.PNG)
1514

@@ -20,7 +19,7 @@ By using HACS you will also make sure that any new versions are installed by def
2019
1. Install via [HACS](hacs_install) (recomended) or [manual](manual_install) (not recomended)
2120
2. Configure using GUI
2221
3. Get [API keys](trafiklab) for FREE! Which APIs depend on your sensor need!
23-
4. Find Location IDs via [SL Platsuppslag](https://developer.trafiklab.se/api/sl-platsuppslag/konsol)
22+
4. Find [Location IDs](locationid) for the selected API.
2423
5. Configure some [GUI/Lovelace](lovelace_cards) to display in frontend
2524
6. Enjoy!
2625

_config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
theme: jekyll-theme-cayman
2-
title: Home Assistant SL Platform
3-
description: This site is for documentation for the Home Assistant SL Platform (HASL)
2+
title: Swedish Public Transport Sensor (HASL)
3+
description: This site is for documentation for the Swedish Public Transport Sensor (aka HASL) (formerly Home Assistant SL Platform)
44
github:
55
zip_url: https://github.com/hasl-platform/integration/zipball/master
66
tar_url: https://github.com/hasl-platform/integration/tarball/master

locationid.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[<<Back to index](/)
2+
3+
## Location IDs
4+
5+
To get data about a specific stop for depatures or other sensors you will need to have a Location ID. Location IDs are NOT interchangeable between SL and ResRobot so depending on your api you will need to lookup locations via api.
6+
7+
## SL API
8+
9+
The IDs you get here is only for use with the SL sensors.
10+
11+
Go to Find Location IDs via [SL Platsuppslag](https://developer.trafiklab.se/api/sl-platsuppslag/konsol)
12+
13+
## Resrobot API
14+
15+
The IDs you get here is only for use with the Resrobot sensors.
16+
17+
1. Start a browser window and go to the Developer Tools in Home Assistant
18+
2. Navigate to the Events tab
19+
3. Start listeningen to `hasl3` events
20+
4. Start another browser window and go to the Developer Tools in Home Assistant
21+
5. Navigate to the Services tab
22+
6. Select the `rr_find_location` service, enter your [API keys](trafiklab) for ["ResRobot v2.1"](https://www.trafiklab.se/api/trafiklab-apis/resrobot-v21/) and a search string. Click Call Service.
23+
7. Switch to the first browser window and see the response code and get the id for your location. Currently addresses are NOT supported.
24+
25+
## SL API (alternative method)
26+
27+
The IDs you get here is only for use with the SL sensors. This is a bit harder than the first approach but is available to be common with Resrobot.
28+
29+
1. Start a browser window and go to the Developer Tools in Home Assistant
30+
2. Navigate to the Events tab
31+
3. Start listeningen to `hasl3` events
32+
4. Start another browser window and go to the Developer Tools in Home Assistant
33+
5. Navigate to the Services tab
34+
6. Select the `sl_find_location` service, enter your [API keys](trafiklab) for ["SL Platsuppslag"](https://developer.trafiklab.se/api/sl-platsuppslag) and a search string. Click Call Service.
35+
7. Switch to the first browser window and see the response code and get the id for your location.

roadmap.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@
44

55
- Input validation missing for creating new integration, field syntax validation is already done by HA but perhaps key validation or similar could be peformed?
66
- Input validation missing for setting integration options, field syntax validation is already done by HA but perhaps key validation or similar could be peformed?
7-
- Perhaps integration with uber/scooters/etc?
8-
- Implement GTFS Data Flows
97

108
If you have ideas please submit an [issue](https://github.com/hasl-sensor/integration/issues) at GitHub or ping me via email, twitter or whatever.

sensors.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ One objective during development have been to not touch the existing sensors so
1111
| :x: | :heavy_check_mark: | Route | Current best route between A and B | Looks up a current route between point A and B. Takes current traffic and deviations into account. |
1212
| :heavy_check_mark: | :heavy_check_mark: | Traffic Status | High level status for different traffic types | In v2 one combined sensor is created for all traffic types while in v3 a binary_sensor is created for each selected type. |
1313
| :heavy_check_mark:* | :heavy_check_mark: | Vehicle Locations | How many vehicles and their locations | Was experimental in v2 and data is cleaned up in v3. A separate sensor is created for each type of traffic |
14+
| :x: | :heavy_check_mark: | RR Departures | Departure information for a given Hållplats | Lookup departures using ResRobot API instead of SL.
15+
| :x: | :heavy_check_mark: | RR Arrivals | Arrivals information for a given Hållplats | Lookup arrivals using ResRobot API.
16+
| :x: | :heavy_check_mark: | RR Route | Current best route between A and B | Looks up a current route between point A and B using ResRobot API.

services.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
## Services and events
44

5-
HASL implements some services that can be useful for accessing data and using for automations or whatnot. Anyway; there are five services that can be used. They return data by triggering an event on the `hasl3_response` topic.
5+
HASL implements some services that can be useful for accessing data and using for automations or whatnot. Anyway; there are five services that can be used. They return data by triggering an event on the `hasl3` topic. Commands can also be sent on the bus via `hasl3` top and using `cmd` as parameter specifying the argument.
66

77
- `dump_cache` No arguments. Dumps the cache to a file in the Home Assistant configuration directory. Returns the filename of the created file in an event.
88
- `get_cache` No arguments. Returns the cache of the created file in an event.
9-
- `find_location`: Arguments `api_key`, `search_string`. Returns the closest stop to the search string provided.
10-
- `find_trip_id` Arguments `api_key`, `org`, `dest`. Returns a trip from org to dest.
11-
- `find_trip_pos` Arguments `api_key`, `orig_lat`, `orig_long`, `dest_lat`, `dest_long`. Returns a trip from org to dest.
9+
- `sl_find_location`: Arguments `api_key`, `search_string`. Returns the closest stop to the search string provided. Uses the Resrobot API.
10+
- `sl_find_trip_id` Arguments `api_key`, `org`, `dest`. Returns a trip from org to dest. Uses the Resrobot API.
11+
- `sl_find_trip_pos` Arguments `api_key`, `orig_lat`, `orig_long`, `dest_lat`, `dest_long`. Returns a trip from org to dest. Uses the Resrobot API.
12+
- `rr_find_location`: Arguments `api_key`, `search_string`. Returns the closest stop to the search string provided. Uses the Resrobot API.

trafiklab.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
[<<Back to index](/)
22

3-
## Apply for free API keys
3+
## Types of keys
4+
5+
This project is dependent on a number of APIs to aquire information. The APIs are mostly free but somewhat limited. Read more about that below.
6+
We now supports using either native SL api for Stockholm, but also Resrobot for the rest of the country (and Stockholm).
7+
8+
If you are in Stockholm I recond using SL as it has more features, however Resrobot also provides intra-regional travel.
9+
10+
## Apply for free API keys (Resrobot)
11+
12+
First, visit [https://www.trafiklab.se/api](https://www.trafiklab.se/api) and create a free account.
13+
14+
They provide multiple APIs, the ones you want is
15+
1. ["ResRobot v2.1"](https://www.trafiklab.se/api/trafiklab-apis/resrobot-v21/)
16+
17+
When you have your API keys, you're ready to add the component to your Home Assistant either via [HACS](hacs_install) or [manual](manual_install).
18+
19+
## Apply for free API keys (SL)
420

521
This project is dependent on a number of APIs to aquire information. The APIs are mostly free but somewhat limited. Read more about that below.
622

@@ -13,12 +29,13 @@ They provide multiple APIs, the ones you want is
1329
Optionally you can also register for
1430
1. ["SL Trafikläget 2"](https://www.trafiklab.se/api/sl-trafiklaget-2) to get status sensors.
1531
2. ["SL Reseplanerare 3.1"](https://www.trafiklab.se/api/trafiklab-apis/sl/route-planner-31/) to use trip planning.
32+
3. ["SL Platsuppslag"](https://developer.trafiklab.se/api/sl-platsuppslag) to lookup location ids
1633

1734
When you have your API keys, you're ready to add the component to your Home Assistant either via [HACS](hacs_install) or [manual](manual_install).
1835

1936
## API-call restrictions and optimizations
2037

21-
The `Bronze` level API is limited to 30 API calls per minute, 10.000 per month. With 10.000 calls per month, that allows for less than one call every 4 minute but if you are using multiple sensors this is split between them and each config sensor section can contain a separate pair of api-keys.
38+
The `Bronze` level API is limited to 30 API calls per minute, 10.000 per month. With 10.000 calls per month for SL and 25.000 for ResRobot, that allows for less than one call every 4 minute but if you are using multiple sensors this is split between them and each config sensor section can contain a separate pair of api-keys.
2239

2340
The calls have been optimized and are beeing locally cached for the specified freshness, if multiple sensors are using the same siteid there will still only be one call. Caching is done in a file (haslcache.json) that will be automatically created in the configuration directory.
2441

0 commit comments

Comments
 (0)