iOS Widget that display next departures for SL traffic in Stockholm
iOS widget that display next departures for SL traffic in Stockholm.
Open https://transport.integration.sl.se/v1/sites?expand=true
to find your departure location and keep note of its id
; this is your SITE_ID
.
The only mandatory option is SITE_ID
, all the rest is optional only if you want to filter even more.
TRANSPORT
can be one of these: BUS
, TRAM
, METRO
, TRAIN
, FERRY
, SHIP
, TAXI
.
LINE
is your Metro line or BUS number.
DIRECTION
can either be 1
or 2
.
DESTINATION_NAME
is the name of your final stop.DIRECTION_NAME
can be useful if your line occasionally may stops at a midpoint before reaching the final destination, set it only in this case.Install Scriptable from the App Store and run it a first time
Create a new script and copy the content of SLWidget.js
. You're going to have to do this only once, as the widget will auto-update itself every day (when neeed).
Now create another new script with the following content, you can repeat this process for as many widgets with different stop/lines you want to have:
// Variables used by Scriptable.
// icon-color: deep-gray; icon-glyph: traffic-light;
const module = importModule("SLWidget.js");
await module.run({
SITE_ID: "9261",
TRANSPORT: "METRO",
LINE: "14",
DIRECTION: "1",
});
[!NOTE] iOS widget refresh whenever the OS tell them to do so; this means that, on the worst conditions, it could be that the widget is out-of-date by 15 minutes. The only way to refresh it is by clicking on it, there's no other way at the moment.