Skip to content

Instantly share code, notes, and snippets.

@cvroque
Last active Dec 6, 2022
Embed
What would you like to do?
LG webOS Smart TV - Turn On
blueprint:
name: LG webOS Smart TV - Turn On Action
description: |
## LG webOS Smart TV - Turn On Action for 2022.2+
This blueprint will run anytime the user turns the media player on through Home Assistant (UI or service).
Adding this blueprint will allow the user to turn on the LG webOS TV through the UI after updating to HA 2022.2, without this blueprint or similar automation the Turn On button won't be displayed due to a breaking change. This is basically a shortcut to manually adding the automation described in the [official documentation][1].
The default action is to send a Wake On Lan magic packet in order to turn the TV on. Aditionally you can also setup custom actions for alternate solutions such as: using an IR remote, turning a smart socket on or calling an script. This is also useful for TV models connected through Wireless that have issues with Wake on Lan.
### Requirements:
- [LG webOS Smart TV][2] integration
- [Wake On Lan][3] added to configuration.yaml
### Changelog:
- 2022.02.03 - First release
- 2022.02.06 - Added austom actions
- 2022.04.27 - Added actions to run after TV is turned On
[1]: https://www.home-assistant.io/integrations/webostv/#turn-on-action
[2]: https://www.home-assistant.io/integrations/webostv/
[3]: https://www.home-assistant.io/integrations/wake_on_lan/
domain: automation
source_url: https://gist.github.com/cvroque/6780ca0869ef781e9de3b506fd501f78#file-webostv_turn_on-yaml
input:
webostv:
name: LG webOS TV
description: Select your media player entity
selector:
entity:
domain: media_player
integration: webostv
webostv_mac:
name: LG webOS TV MAC address
description: The MAC address of the selected TV. You can get this information on your TV network settings or through your router.
default: AA-BB-CC-DD-EE-FF
on_action:
name: Actions to run after TV is turned On (Optional)
description: Select actions to run after the TV is turned on. Useful for setting a default volume or changing source automatically.
default: []
selector:
action: {}
select_action:
name: Enable Custom Actions?
description: When Off the default action is to send a magic packet, when On the custom actions will replace the magic packet.
default: false
selector:
boolean: {}
custom_action:
name: Custom Actions (Optional)
description: When custom actions are enabled the actions added here will replace the magic packet. Useful for TVs being turned on through an IR remote, script or similar.
default: []
selector:
action: {}
variables:
select_action: !input 'select_action'
trigger:
- platform: webostv.turn_on
entity_id: !input webostv
action:
- choose:
- conditions:
- '{{ select_action }}'
sequence: !input 'custom_action'
default:
- service: wake_on_lan.send_magic_packet
data:
mac: !input webostv_mac
- wait_for_trigger:
- platform: state
entity_id: !input webostv
to: 'on'
timeout: '00:00:30'
- choose: []
default: !input 'on_action'
mode: queued
max_exceeded: silent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment