{"id":18961444,"url":"https://github.com/eulemitkeule/template_media_player","last_synced_at":"2025-04-19T11:40:49.598Z","repository":{"id":163488007,"uuid":"638975210","full_name":"EuleMitKeule/template_media_player","owner":"EuleMitKeule","description":"Template Media Player is a custom integration for Home Assistant that allows the user to create media_player entities using templates and scripts.","archived":false,"fork":false,"pushed_at":"2024-11-03T12:06:14.000Z","size":175,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-16T04:45:15.236Z","etag":null,"topics":["custom-integration","hacs","home-assistant","jinja2","media-player","python","template","yaml"],"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/EuleMitKeule.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2023-05-10T13:49:38.000Z","updated_at":"2025-04-01T15:44:41.000Z","dependencies_parsed_at":"2024-06-07T00:45:24.875Z","dependency_job_id":"f3e5a6f4-2b96-4be4-a394-a20ba832829f","html_url":"https://github.com/EuleMitKeule/template_media_player","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EuleMitKeule%2Ftemplate_media_player","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EuleMitKeule%2Ftemplate_media_player/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EuleMitKeule%2Ftemplate_media_player/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EuleMitKeule%2Ftemplate_media_player/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EuleMitKeule","download_url":"https://codeload.github.com/EuleMitKeule/template_media_player/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249685290,"owners_count":21310577,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["custom-integration","hacs","home-assistant","jinja2","media-player","python","template","yaml"],"created_at":"2024-11-08T14:12:51.586Z","updated_at":"2025-04-19T11:40:49.560Z","avatar_url":"https://github.com/EuleMitKeule.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![hacs_badge](https://img.shields.io/badge/HACS-Custom-41BDF5.svg)](https://github.com/hacs/integration)\n[![Code Quality](https://github.com/EuleMitKeule/template_media_player/actions/workflows/quality.yml/badge.svg?branch=master)](https://github.com/EuleMitKeule/template_media_player/actions/workflows/quality.yml)\n\n# Template Media Player\n\n\u003e Note: This integration is strongly inspired by [media_player.template](https://github.com/Sennevds/media_player.template).\u003cbr\u003e\n\u003e Unfortunately that integration is no longer maintained and missing some features, so I decided to create a new and improved one.\n\nWith Template Media Player you can create media player entities in Home Assistant using templates and scripts.\u003cbr\u003e\nYou can define any attribute you want and create custom behaviour for all services supported by the `media_player` domain.\u003cbr\u003e\nThis allows you to combine your existing media players into a single entity for improved usability and control or to create completely new media players from scratch.\n\n## Installation\n\nYou can install this integration using the custom repository option in [HACS](https://hacs.xyz/).\u003cbr\u003e\n\n1. Add the repository URL to the list of custom repositories in HACS\n2. Select and install the integration in HACS\n3. Restart Home Assistant\n4. Configure your entities\n\n## Configuration\n\nTo create the entities you need to define them in your `configuration.yaml` file.\u003cbr\u003e\nFor a full example of all available options see [examples](examples/configuration.yaml).\n\n```yaml\nmedia_player:\n  - platform: template_media_player\n    media_players:\n      my_media_player:\n        unique_id: my_media_player\n        friendly_name: My Media Player\n        device_class: tv\n        icon_template: mdi:television\n        state_template: \"on\"\n```\n\n### Templates\n\nOptions that are marked as `_template` or elements of the `attribute_templates` object can be defined using Jinja2 templates:\n\n```yaml\n# ...\nstate_template: \u003e\n  {% if states('media_player.something\") == \"on\" %}\n    idle\n  {% else %}\n    off\n  {% endif %}\n```\n\n#### Attributes\n\nTo define state attributes for your entity use the `attribute_templates` option.\u003cbr\u003e\nYou can use the variable `attribute` in your templates to get the current attributes name as a string.\u003cbr\u003e\nFor a full list of attributes commonly used by media player entities see [examples](examples/configuration.yaml).\n\n```yaml\nmedia_player:\n  - platform: template_media_player\n    media_players:\n      my_media_player:\n        #...\n        attribute_templates:\n            media_title: \u003e\n              # attribute contains the value \"media_title\"\n              {{ state_attr(\"media_player.something\", attribute) }}\n```\n\n#### Global Template\n\nTo reduce code duplication you can define a template using the `global_template` option.\nThis template will be executed before each of the other templates and can be used to define common variables.\n\n```yaml\nmedia_player:\n  - platform: template_media_player\n    media_players:\n      my_media_player:\n        #...\n        global_template: \u003e\n          {% set tv = \"media_player.tv\" %}\n        state_template: \u003e\n          {{ states(tv) }}\n```\n\n### Scripts\n\nElements of the `service_scripts`, `source_scripts` or `sound_mode_scripts` options are action sequences like in Home Assistant scripts.\n\n```yaml\nmedia_player:\n  - platform: template_media_player\n    media_players:\n      my_media_player:\n        #...\n        source_scripts:\n          Plex:\n            - service: media_player.turn_on\n              data_template:\n                entity_id: media_player.tv\n            - delay:\n                seconds: 3\n            - service: media_player.select_source\n              data_template:\n                entity_id: media_player.tv\n                source: Plex\n```\n\n#### Service Scripts\n\nUse the `service_scripts` option to define services that are supported by the `media_player` domain.\u003cbr\u003e\nFor a full list of services and their respective variables supported by media player entities see [examples](examples/configuration.yaml).\n\n```yaml\nmedia_player:\n  - platform: template_media_player\n    media_players:\n      my_media_player:\n        #...\n        service_scripts:\n          turn_on:\n            - service: media_player.turn_on\n              data_template:\n                entity_id: media_player.tv\n```\n\n#### Source Scripts\n\nUse the `source_scripts` option to define sources for your media_player.\n\n```yaml\nmedia_player:\n  - platform: template_media_player\n    media_players:\n      my_media_player:\n        #...\n        source_scripts:\n          Plex:\n            - service: media_player.select_source\n              data_template:\n                entity_id: media_player.tv\n                source: Plex\n```\n\n#### Sound Mode Scripts\n\nUse the `sound_mode_scripts` option to define sound modes for your media_player.\n\n```yaml\nmedia_player:\n  - platform: template_media_player\n    media_players:\n      my_media_player:\n        #...\n        sound_mode_scripts:\n          Bass Boost:\n            - service: media_player.select_sound_mode\n              data_template:\n                entity_id: media_player.soundbar\n                source: Bass Boost\n```\n\n### Base Media Player\n\nYou can specify an entity using the `base_media_player_entity_id` option to inherit all supported behaviour and attributes from, when the behaviour or attribute is not implemented by the template media player.\n\n### Browse Media\n\nYou can specify an entity to use for the browse media functionality using the `browse_media_entity_id` option.\u003cbr\u003e\nMake sure you also define the `play_media` service for this to work.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feulemitkeule%2Ftemplate_media_player","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feulemitkeule%2Ftemplate_media_player","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feulemitkeule%2Ftemplate_media_player/lists"}