https://github.com/mysiar/ha-custom-component-mmpk
https://github.com/mysiar/ha-custom-component-mmpk
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mysiar/ha-custom-component-mmpk
- Owner: mysiar
- Created: 2025-10-19T13:47:57.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2025-10-28T16:23:07.000Z (8 months ago)
- Last Synced: 2025-10-28T16:23:27.105Z (8 months ago)
- Language: Python
- Size: 990 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Home Assistant custom component mMPK
MPK Kraków public transport timetable
## Sensor configuration
```yaml
sensor:
- platform: mmpk
stops:
- id: 1
description: Bronowice Małe
- id: 2
description: Giełda Balicka
lines:
- "126"
```
* A sensor configured with id: `1` will retrieve data for all available buses and trams at the specified stop.
* A sensor configured with id: `2` will retrieve data exclusively for line `126` at the specified stop.
* `description` is optional
## Stop list
[CSV](doc/MPK_stops.csv)
## Instalation
### Manual
### 📦 Manual Installation
To install this integration manually, you need to download [**mmpk.zip**](https://github.com/mysiar/ha-custom-component-mmpk/releases/latest/download/mmpk.zip) and extract its contents to the `config/custom_components/mmpk` directory.
```bash
mkdir -p custom_components/mmpk
cd custom_components/mmpk
wget https://github.com/mysiar/ha-custom-component-mmpk/releases/latest/download/mmpk.zip
unzip mmpk.zip
rm mmpk.zip
```
## Display data
* Markdown card
```
{% set sensor = 'sensor.mpk_stop_1' %}
{% set state = states(sensor) %}
{% set disabled = state_attr(sensor, 'entity_disabled') %}
{% set available = state not in ['unknown', 'unavailable', none] %}
{% if disabled or not available %}
_Sensor {{ sensor }} jest niedostępny lub wyłączony._
{% else %}
{% set stop = state_attr(sensor, 'stop_name') %}
{% set updated = state_attr(sensor, 'last_update') %}
{% set departures = state_attr(sensor, 'departures_by_line') %}
{% set next_departure = state if state != "unknown" else "Brak odjazdów" %}
**Przystanek: {{ stop if stop else "Nieznany" }}{% if updated %} [{{ updated[11:19] }}]{% endif %}**
Następny odjazd: {{ next_departure }}
{% if departures %}
{% for line, variants in departures.items() -%}
{% for variant in variants -%}
**{{ line }} → {{ variant.direction }}**
{% if variant.departures -%}
{{ variant.departures | join(', ') }}
{% endif -%}
{% endfor -%}
{% endfor -%}
{% else -%}
Brak danych o odjazdach
{% endif -%}
{% endif %}
```
**Sensor 1 card**

**Sensor 2 card**
