Skip to content

Commit 8e635cf

Browse files
authored
Feature/more bus lines (#4)
* Add more bus lines * Update documentation regarding delays * Default delay value is taken from sensor config * Add sort and municipality options * Add css classes for lines by municipality * Reflect new changes in card * Update vasttrafik-card.js * Remove line styles from generic css file * Generate css helper * Add helper section * +u * Showcase line colours * New colours * Delete x.png * Add files via upload * Sort lines * Delete genereate_html_with_colours.py * Delete new_colours.png * Add files via upload * Add files via upload * Add files via upload * Use new colours in example
1 parent cb6d3e2 commit 8e635cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1164
-109
lines changed

README.md

Lines changed: 88 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,120 @@
11
vasttrafik-card
22
========================
33

4-
Styled entities using the Västtrafik theme in a lovelace entities card. All trams and buses are styled using the colours used in Göteborg, so if you are living in Västra Götaland but outside of Göteborg you have to change the css manually. This card also displays:
4+
Styled entities using the Västtrafik theme in a lovelace entities card. All trams and buses are styled using the colours used in their respective municipality.
5+
6+
This card also displays:
57
* When the next vehicle is leaving
68
* Departing station (which requires [this version](https://github.com/Miicroo/ha-vasttrafik) of the Västtrafik sensor)
7-
* When you have to leave home in order to catch the vehicle (or the amount of minutes until the vehicle leaves if no delay is set).
9+
* When you have to leave home in order to catch the vehicle (also known as the sensor delay).
10+
* Sorting of entities, showing the next entity to depart first
811

912
> ![v1.0.0](resources/info.svg)
1013
>
1114
> If you are looking for the Västtrafik-card where you can *group* sensors based on departure or destination, you want the (discontinued) [v1.0.0](https://github.com/Miicroo/lovelace-vasttrafik-card/releases/tag/v1.0.0)
1215
1316
## Options
14-
| Name | Type | Default | Description
15-
| ---- | ---- | ------- | -----------
16-
| entities | list | **Required** | See [entity format](https://github.com/Miicroo/lovelace-vasttrafik-card#entity-format)
17-
| title | string | Västtrafik | The title of the card
17+
| Name | Type | Default | Description
18+
| ---- | ---- | ------- | -----------
19+
| entities | list | **Required** | A list of entity sensors provided by the Västtrafik integration
20+
| title | string | Västtrafik | The title of the card
21+
| municipality | string | Göteborg | The municipality of the station(s), [more info here](https://github.com/Miicroo/lovelace-vasttrafik-card#municipality)
22+
| sort | boolean | true | Whether to sort the departures (earliest first), or keep the entities in the given order
1823

19-
## Entity format
20-
Entities can be defined in 3 different ways:
24+
## Municipality
25+
As there are many lines with the same name or number in Västra Götaland, the styles are split by municipality. For accuracy, choose the municipality of your departing sensor(s).
2126

22-
1) As a simple string containing the id
23-
```yaml
24-
- sensor.ekedal_till_brunnsparken
25-
- sensor.godhemsgatan_till_brunnsparken
27+
Currently supported municipalities:
2628
```
27-
2) As an object containing the id and the delay in minutes (e.g. how long it would take you to walk to the departing station)
28-
```yaml
29-
- id: sensor.ekedal_till_brunnsparken
30-
delay: 3
31-
- sensor.godhemsgatan_till_brunnsparken
32-
delay: 2
29+
Ale
30+
Alingsås
31+
Åmål
32+
Årjäng
33+
Bengtsfors
34+
Bollebygd
35+
Borås
36+
Dals-Ed
37+
Essunga
38+
Falkenberg
39+
Falköping
40+
Färgelanda
41+
Göteborg
42+
Götene
43+
Grästorp
44+
Gullspång
45+
Habo
46+
Hallsberg
47+
Härryda
48+
Herrljunga
49+
Hjo
50+
Jönköping
51+
Karlsborg
52+
Kristinehamn
53+
Kumla
54+
Kungälv
55+
Kungsbacka
56+
Laxå
57+
Lerum
58+
Lidköping
59+
Lilla Edet
60+
Lysekil
61+
Mariestad
62+
Mark
63+
Mellerud
64+
Mölndal
65+
Mullsjö
66+
Munkedal
67+
Nässjö
68+
Norge
69+
Öckerö
70+
Örebro
71+
Orust
72+
Partille
73+
Säffle
74+
Skara
75+
Skövde
76+
Sotenäs
77+
Stenungsund
78+
Strömstad
79+
Svenljunga
80+
Tanum
81+
Tibro
82+
Tidaholm
83+
Tjörn
84+
Töreboda
85+
Tranemo
86+
Trollhättan
87+
Uddevalla
88+
Ulricehamn
89+
Vänersborg
90+
Vara
91+
Varberg
92+
Vårgårda
93+
Västra Götaland
3394
```
34-
3) As a combination of 1) and 2), the entities without specified delay will get delay = 0.
3595

3696

3797
## Examples
3898
```yaml
3999
type: 'custom:vasttrafik-card'
40100
title: 'Mot Brunnsparken'
41101
entities:
42-
- id: sensor.ekedal_till_brunnsparken
43-
delay: 3
102+
- sensor.ekedal_till_brunnsparken
44103
- sensor.godhemsgatan_till_brunnsparken
104+
municipality: Göteborg
105+
sort: true
45106
```
46107
47108
![Example 1](https://raw.githubusercontent.com/Miicroo/lovelace-vasttrafik-card/master/resources/1.png)
48109
49-
## Tram and bus styles
50-
![Colours for each tram or bus line](https://raw.githubusercontent.com/Miicroo/ha-lovelace-vasttrafik_card/master/resources/colours.png)
110+
## Tram and bus styles (example shows Göteborg)
111+
![Colours for each tram or bus line](https://raw.githubusercontent.com/Miicroo/lovelace-vasttrafik-card/feature/more-bus-lines/resources/new_colours2.png)
51112
52113
## In case of errors
53114
1. A warning will be printed to the console if any entity id you provide is not attributed to Västtrafik
54115
2. The default sensor does not expose from/to, use [this one](https://github.com/Miicroo/ha-vasttrafik) instead
55116
3. The sensor updates every 2 minutes, so you will sometimes get `-2 minutes` until departure
117+
118+
119+
## Västtrafik updated their designs?
120+
To get the latest designs/colours exported as css, run `python3 ../helpers/generate_css.py` from the `dist` folder.

dist/lines-ale.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.line-413, .line-431, .line-560, .line-414, .line-416, .line-37, .line-435, .line-421, .line-433, .line-411, .line-402, .line-TÅG, .line-434, .line-403, .line-404, .line-415, .line-401 {
2+
border-color: rgb(0, 108, 147);
3+
color: rgb(255, 255, 255);
4+
background-color: rgb(0, 108, 147);
5+
}

dist/lines-alingsas.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.line-560, .line-546, .line-642, .line-566, .line-TÅG, .line-647, .line-567, .line-548, .line-541, .line-561, .line-579, .line-551, .line-563, .line-543, .line-554, .line-544, .line-552, .line-547, .line-525, .line-564, .line-542, .line-565 {
2+
border-color: rgb(0, 108, 147);
3+
color: rgb(255, 255, 255);
4+
background-color: rgb(0, 108, 147);
5+
}
6+
.line-585, .line-550, .line-540, .line-543 {
7+
border-color: rgb(255, 255, 80);
8+
color: rgb(0, 97, 235);
9+
background-color: rgb(255, 255, 80);
10+
}
11+
.line-3 {
12+
border-color: rgb(118, 71, 18);
13+
color: rgb(255, 255, 255);
14+
background-color: rgb(118, 71, 18);
15+
}
16+
.line-2 {
17+
border-color: rgb(0, 113, 193);
18+
color: rgb(255, 255, 255);
19+
background-color: rgb(0, 113, 193);
20+
}
21+
.line-1 {
22+
border-color: rgb(198, 53, 57);
23+
color: rgb(255, 255, 255);
24+
background-color: rgb(198, 53, 57);
25+
}

dist/lines-amal.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.line-774, .line-780, .line-TÅG, .line-740, .line-775, .line-721 {
2+
border-color: rgb(0, 108, 147);
3+
color: rgb(255, 255, 255);
4+
background-color: rgb(0, 108, 147);
5+
}

dist/lines-arjang.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.line-755 {
2+
border-color: rgb(0, 108, 147);
3+
color: rgb(255, 255, 255);
4+
background-color: rgb(0, 108, 147);
5+
}

dist/lines-bengtsfors.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.line-755, .line-752, .line-751, .line-765, .line-750, .line-700, .line-730, .line-740, .line-775 {
2+
border-color: rgb(0, 108, 147);
3+
color: rgb(255, 255, 255);
4+
background-color: rgb(0, 108, 147);
5+
}

dist/lines-bollebygd.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.line-401, .line-402, .line-122, .line-TÅG {
2+
border-color: rgb(0, 108, 147);
3+
color: rgb(255, 255, 255);
4+
background-color: rgb(0, 108, 147);
5+
}
6+
.line-101, .line-110, .line-550, .line-611, .line-402 {
7+
border-color: rgb(255, 255, 80);
8+
color: rgb(0, 97, 235);
9+
background-color: rgb(255, 255, 80);
10+
}

dist/lines-boras.css

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.line-31, .line-154, .line-150, .line-19, .line-20, .line-402, .line-157, .line-TÅG {
2+
border-color: rgb(0, 108, 147);
3+
color: rgb(255, 255, 255);
4+
background-color: rgb(0, 108, 147);
5+
}
6+
.line-405, .line-400, .line-153, .line-201, .line-350, .line-159, .line-582, .line-157, .line-402, .line-110, .line-120, .line-361, .line-360, .line-303, .line-150, .line-550, .line-155, .line-351, .line-204, .line-200, .line-151, .line-154, .line-102, .line-450 {
7+
border-color: rgb(255, 255, 80);
8+
color: rgb(0, 97, 235);
9+
background-color: rgb(255, 255, 80);
10+
}
11+
.line-100 {
12+
border-color: rgb(255, 255, 80);
13+
color: rgb(212, 0, 162);
14+
background-color: rgb(255, 255, 80);
15+
}
16+
.line-8 {
17+
border-color: rgb(2, 116, 70);
18+
color: rgb(255, 255, 255);
19+
background-color: rgb(2, 116, 70);
20+
}
21+
.line-7 {
22+
border-color: rgb(248, 152, 40);
23+
color: rgb(0, 67, 92);
24+
background-color: rgb(248, 152, 40);
25+
}
26+
.line-6 {
27+
border-color: rgb(118, 71, 18);
28+
color: rgb(255, 255, 255);
29+
background-color: rgb(118, 71, 18);
30+
}
31+
.line-5 {
32+
border-color: rgb(216, 232, 176);
33+
color: rgb(0, 108, 147);
34+
background-color: rgb(216, 232, 176);
35+
}
36+
.line-3 {
37+
border-color: rgb(165, 68, 154);
38+
color: rgb(255, 255, 255);
39+
background-color: rgb(165, 68, 154);
40+
}
41+
.line-2 {
42+
border-color: rgb(0, 113, 193);
43+
color: rgb(255, 255, 255);
44+
background-color: rgb(0, 113, 193);
45+
}
46+
.line-1 {
47+
border-color: rgb(198, 53, 57);
48+
color: rgb(255, 255, 255);
49+
background-color: rgb(198, 53, 57);
50+
}

dist/lines-dals-ed.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.line-760, .line-764, .line-761, .line-765, .line-700, .line-TÅG, .line-775 {
2+
border-color: rgb(0, 108, 147);
3+
color: rgb(255, 255, 255);
4+
background-color: rgb(0, 108, 147);
5+
}

dist/lines-essunga.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.line-151, .line-546, .line-663, .line-104, .line-645, .line-640, .line-660, .line-661 {
2+
border-color: rgb(0, 108, 147);
3+
color: rgb(255, 255, 255);
4+
background-color: rgb(0, 108, 147);
5+
}
6+
.line-581 {
7+
border-color: rgb(255, 255, 80);
8+
color: rgb(0, 97, 235);
9+
background-color: rgb(255, 255, 80);
10+
}

0 commit comments

Comments
 (0)