{"id":37655572,"url":"https://github.com/fermartv/emt_madrid","last_synced_at":"2026-01-16T11:41:06.923Z","repository":{"id":177442034,"uuid":"290254274","full_name":"fermartv/emt_madrid","owner":"fermartv","description":"Custom sensor to have the arrival time of the EMT Madrid buses in Home Assistant","archived":false,"fork":false,"pushed_at":"2024-12-22T19:09:28.000Z","size":143,"stargazers_count":15,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-22T20:21:14.173Z","etag":null,"topics":["bus-madrid","emt-api","emt-madrid","homeassistant","homeassistant-sensor","madrid"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fermartv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-25T15:35:52.000Z","updated_at":"2024-12-22T19:37:00.000Z","dependencies_parsed_at":"2024-12-22T20:21:06.238Z","dependency_job_id":"e2e30911-51ec-4429-af59-653ef73ca8a4","html_url":"https://github.com/fermartv/emt_madrid","commit_stats":null,"previous_names":["fermartv/emt_madrid"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/fermartv/emt_madrid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fermartv%2Femt_madrid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fermartv%2Femt_madrid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fermartv%2Femt_madrid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fermartv%2Femt_madrid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fermartv","download_url":"https://codeload.github.com/fermartv/emt_madrid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fermartv%2Femt_madrid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bus-madrid","emt-api","emt-madrid","homeassistant","homeassistant-sensor","madrid"],"created_at":"2026-01-16T11:41:06.362Z","updated_at":"2026-01-16T11:41:06.918Z","avatar_url":"https://github.com/fermartv.png","language":"Python","funding_links":[],"categories":["Transporte y Movilidad"],"sub_categories":["Radio y Podcasts"],"readme":"_Please :star: this repo if you find it useful_\n\n# EMT Madrid bus platform for Home Assistant\n\nThis is a custom sensor for Home Assistant that allows you to have the waiting time for a specific Madrid-EMT bus stop. Each sensor will provide the arrival time for the next 2 buses of the line specified in the configuration.\n\nThanks to [EMT Madrid MobilityLabs](https://mobilitylabs.emtmadrid.es/) for providing the data and [documentation](https://apidocs.emtmadrid.es/).\n\n![Example](example.png)\n![Example attributes](example_attributes.png)\n\n## Prerequisites\n\nTo use the EMT Mobilitylabs API you need to register in their [website](https://mobilitylabs.emtmadrid.es/). You have to provide a valid email account and a password that will be used to configure the sensor. Once you are registered you will receive a confirmation email to activate your account. It will not work until you have completed all the steps.\n\n## Installation\n\n### HACS installation\n\n1. Open Home Assistant and go to HACS (Home Assistant Community Store).\n2. In HACS, go to the \"Integrations\" tab and click on the three dots in the top right corner.\n3. Select \"Custom repositories\" and enter the repository URL: `https://github.com/fermartv/emt_madrid`.\n4. Select the category as \"Integration\" and click \"Add.\"\n5. Once the repository is added, search for \"EMT-Madrid bus\" in HACS and click \"Install.\"\n6. Restart Home Assistant.\n\n\n### Manual installation\n\n1. Using the tool of choice open the directory for your HA configuration (where you find `configuration.yaml`).\n2. If you do not have a `custom_components` directory there, you need to create it.\n3. In the `custom_components` directory create a new directory called `emt_madrid`.\n4. Download _all_ the files from the `custom_components/emt_madrid/` directory in this repository.\n5. Place the files you downloaded in the new directory you created.\n6. Restart Home Assistant\n\n## Add sensor to Home Assistant\n\nAdd `emt_madrid` sensor to your `configuration.yaml` file:\n\n   ```yaml\n   # Example configuration.yaml entry\n   sensor:\n     - platform: emt_madrid\n       email: !secret EMT_EMAIL\n       password: !secret EMT_PASSWORD\n       stop: 72\n       lines: \n         - \"27\"\n         - \"N26\"\n       icon: \"mdi:fountain\"\n   ```\n\n### Configuration Variables\n\n**email**:\\\n _(string) (Required)_\\\n Email account used to register in the EMT Madrid API.\n\n**password**:\\\n _(string) (Required)_\\\n Password used to register in the EMT Madrid API.\n\n**stop**:\\\n _(integer) (Required)_\\\n Bus stop ID.\n\n**lines**:\\\n _(list) (Optional)_\\\n One or more line numbers.\n\n**icon**:\\\n _(string) (Optional)_\\\n Icon to use in the frontend.\n_Default value: \"mdi:bus\"_\n\n\n## Sensors, status and attributes\n\nOnce you have the platform up and running, you will have one sensor per line specified. If no lines are provided, it will create a sensor for each line at that stop ID. The name of the sensor will be automatically generated using the following structure: Bus {line} - {stop_name}. All the sensors will update the data automatically every minute, and you should have the following data:\n\n**state**:\\\n _(int)_\\\n Arrival time in minutes for the next bus. It will show \"unknown\" when there are no more buses coming and 45 when the arrival time is over 45 minutes.\n\n### Attributes\n\n**next_bus**:\\\n _(int)_\\\n Arrival time in minutes for the second bus. It will show \"unknown\" when there are no more buses coming and 45 when the arrival time is over 45 minutes.\n\n**stop_id**:\\\n _(int)_\\\n Bus stop ID given in the configuration.\n\n**stop_name**:\\\n _(string)_\\\n Bus stop name from EMT.\n\n**stop_address**:\\\n _(string)_\\\n Bus stop address from EMT.\n\n**line**:\\\n _(string)_\\\n Bus line.\n\n**destination**:\\\n _(string)_\\\n Bus line last stop.\n\n**origin**:\\\n _(string)_\\\n Bus line first stop.\n\n**start_time**:\\\n _(string)_\\\n Time at which the first bus leaves the first stop.\n\n**end_time**:\\\n _(string)_\\\n Time at which the last bus leaves the first stop.\n\n**max_frequency**:\\\n _(int)_\\\n Maximum frequency for this line.\n\n**min_frequency**:\\\n _(int)_\\\n Minimum frequency for this line.\n\n**distance**:\\\n _(int)_\\\n Distance (in metres) from the next bus to the stop.\n\n\n### Multiple stops\n\nIf you want to follow multiple stops, you can create multiple sensors by adding the following lines to your `configuration.yaml`:\n\n   ```yaml\n   # Example configuration.yaml entry\n   sensor:\n     - platform: emt_madrid\n       email: !secret EMT_EMAIL\n       password: !secret EMT_PASSWORD\n       stop: 72\n       lines: \n         - \"27\"\n         - \"N26\"\n       icon: \"mdi:fountain\"\n\n     - platform: emt_madrid\n       email: !secret EMT_EMAIL\n       password: !secret EMT_PASSWORD\n       stop: 4490\n       icon: \"mdi:bus-clock\"\n   ```\n\n\n### Second bus sensor\n\nIf you want to have a specific sensor to show the arrival time for the second bus, you can add the following lines to your `configuration.yaml` file below the `emt_madrid` bus sensor. See the official Home Assistant [template sensor](https://www.home-assistant.io/integrations/template/) for more information.\n\n```yaml\n# Example configuration.yaml entry\ntemplate:\n  - sensor:\n      - name: \"Siguiente bus 27\"\n        unit_of_measurement: \"min\"\n        state: \"{{ state_attr('sensor.bus_27_cibeles_casa_de_america', 'next_bus') }}\"\n```\n\n## Roadmap\n\n1. Move to fully async component.\n2. Add `unique_id` to allow modifying sensor names.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffermartv%2Femt_madrid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffermartv%2Femt_madrid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffermartv%2Femt_madrid/lists"}