Skip to content

PiotrMachowski/Home-Assistant-custom-components-MPK-KR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HACS Custom GitHub Latest Release GitHub All Releases Ko-Fi buycoffee.to PayPal.Me Revolut.Me

MPK Kraków sensor

This sensor uses official API provided by MPK Kraków.

Configuration options

Key Type Required Default Description
name string False MPK KR Name of sensor
stops list True - List of stop configurations

Stop configuration

Key Type Required Default Description
id positive integer True - ID of a stop
platform string True - One of bus or tram
mode string False departure One of departure or arrival
name string False id Name of a stop
lines list False all available List of monitored lines.
directions list False all available List of monitored directions.

Example usage

sensor:
  - platform: mpk_kr
      stops:
        - id: 623
          platform: bus
          lines:
            - "274"
        - id: 1173
          platform: tram
          mode: arrival
          directions:
            - "Nowy Bieżanów P+R"

Installation

Using HACS (recommended)

This integration can be added to HACS as a custom repository:

  • URL: https://github.com/PiotrMachowski/Home-Assistant-custom-components-MPK-KR
  • Category: Integration

After adding a custom repository you can use HACS to install this integration using user interface.

Manual

To install this integration manually you have to download mpk_kr.zip and extract its contents to config/custom_components/mpk_kr directory:

mkdir -p custom_components/mpk_kr
cd custom_components/mpk_kr
wget https://github.com/PiotrMachowski/Home-Assistant-custom-components-MPK-KR/releases/latest/download/mpk_kr.zip
unzip mpk_kr.zip
rm mpk_kr.zip

Hints

  • Value for stop_id can be retrieved from TTS Kraków. After choosing a desired stop its ID is a number visibile in URL.

  • These sensors provides attributes which can be used in HTML card or HTML Template card: html_timetable, html_departures

    • HTML card:
      - type: custom:html-card
        title: 'MPK'
        content: |
          <big><center>Timetable</center></big>
          [[ sensor.mpk_kr_623_tram_departure.attributes.html_timetable ]]
          <big><center>Departures</center></big>
          [[ sensor.mpk_kr_1173_bus_arrival.attributes.html_departures ]]
    • HTML Template card:
      - type: custom:html-template-card
        title: 'MPK'
        ignore_line_breaks: true
        content: |
          <big><center>Timetable</center></big></br>
          {{ state_attr('sensor.mpk_kr_623_tram_departure','html_timetable') }}
          </br><big><center>Departures</center></big></br>
          {{ state_attr('sensor.mpk_kr_1173_bus_arrival','html_departures') }}

Support

If you want to support my work with a donation you can use one of the following platforms:

Platform Payment methods Link Comment
Ko-fi
  • PayPal
  • Credit card
  • Buy Me a Coffee at ko-fi.com
  • No fees
  • Single or monthly payment
  • buycoffee.to
  • BLIK
  • Bank transfer
  • Postaw mi kawę na buycoffee.to
    PayPal
  • PayPal
  • PayPal Logo
  • No fees
  • Revolut
  • Revolut
  • Credit Card
  • Revolut
  • No fees