But a problem one of my media players (an old Harman Kardon) doesn’t have any way to control it but with IR-remote. So I setup an IR-sender with esphome but problem ControllerX expects a media_player entity so it can use the services set_volume(or in the dev version volume_up/down).
After searching I didn’t found a way to create my own media_player entity like you do with switches and lights (templating) So I started to create my own custom_component
At this moment it doesn’t have all the actions that a normal media_player has but it’s usable.
There’s one downside: to use this component you need to override all the template entities!
(if this is wrong please correct me)
How to install:
Create a ‘custom_components’ folder in your config folder(if it doesn’t exist)
Create ‘template’ folder in the custom_components folder
True but this needs existing media players (children) and you can control these children using switches. This component creates a media player from scratch.
Can anyone please share config for implementing Harmony Hub receiver (I have Logitech Z5500) to this component.
I was experimenting but can not get around it to get it working.
I can control it through script but It would be much nicer to control it with media player which I can also port to HomeKit.
Thanks for quick reply.
I’ve tried your suggestion but I get this error:
Invalid config for [media_player.media_player_template]: required key not provided @ data['media_players']['receiver']['turn_off']. Got None required key not provided @ data['media_players']['receiver']['turn_on']. Got None required key not provided @ data['media_players']['receiver']['value_template']. Got None. (See /config/configuration.yaml, line 147). Please check the docs at https://github.com/Sennevds/media_player.template
You need to have the turn_on and turn_off parameters.
You also need a value_template but if you don’t have a way to know if the receiver is on or off you could have a template that returns on
On media card there is only power button without volume buttons. For them to show up I have to click on more options. Is there a way for these buttons to show on the card?
I’ve updated the repo with a fix. Could you try it?
There’s another problem they have deprecated template.extract_entities and now I have to use event.async_track_template_result but need to find out how this works. If someone wants to help always welcome to create pull requests!
I still got the error for source selection. You forgot to add the fix here:
2020-09-28 16:56:27 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.139878495489808] name 'friendly_name' is not defined
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 137, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1315, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1350, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 459, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 655, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 490, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 615, in async_select_source
await self.hass.async_add_job(self.select_source, source)
File "/config/custom_components/media_player_template/media_player.py", line 380, in select_source
source_script = Script(self.hass, self._input_templates[source], friendly_name, domain)
NameError: name 'friendly_name' is not defined