How do I customize a service of an entity

I’m using an old Panasonic Vierra TV which apparently has no support for Wake-on-LAN. Means I can use the GUI integration to add it to HA and I get a nice media_player entity and if I call media_player.turn_off, the TV goes off, but if I call media_player.turn_on it stays off.
I’ve also setup a broadlink remote device which I can use to send an IR command to the TV to power it off.
How can I customize the media_player.tv entity so that when the turn_on service is called it actually calls the remote.send_command instead?
Thanks in advance!

Assuming that you can’t edit the GUI to make it do something else, I think you would have to make an automation using an event trigger.

If you go to Developer Tools -> Events and listen to call_service events, then trigger the media_player.turn_on service, you should see the details of the service in the Events log. Then you can use that data to set up an automation to trigger whenever you call the media_player.turn_on service for that device, and the automation can fire the broadlink IR device.

1 Like

You can try the universal media player integration,should be exactly what you are looking for.

1 Like

Yes, looks like this would be the answer. Pity that I’ll loose most of the benefits of having a GUI integration for the TV, but I’ll give it a try tonight and post back if I manage to combine services in yaml.

Which benefits? Like that you can not set it up from the UI?

Exactly. No biggie, as I’m (still) much faster using 10 digits to type then to click around, but hey, GUI should be cool, right?
Anyway, universal media player worked for me and I’m now able to call turn_on and route to my IR remote and turn_off talking to the TV directly.
Thanks a million, @Burningstone!

2 Likes

I took 2,5 years to actually understand that response.
Works like magic, thanks!

Glad it helped, eventually :joy: