Skip to content

Instantly share code, notes, and snippets.

@anguschiu1
Last active September 21, 2022 13:16
Show Gist options
  • Save anguschiu1/493608735bd1c2c0217375dd29a9df2c to your computer and use it in GitHub Desktop.
Save anguschiu1/493608735bd1c2c0217375dd29a9df2c to your computer and use it in GitHub Desktop.
[HA on docker]

LG webOS Smart TV

Reference

Automation to WOL

# Example configuration.yaml entry
wake_on_lan: # enables `wake_on_lan` integration

automation:
  - alias: "Turn On Living Room TV with WakeOnLan"
    trigger:
      - platform: webostv.turn_on
        entity_id: media_player.lg_webos_smart_tv
    action:
      - service: wake_on_lan.send_magic_packet
        data:
          mac: aa:bb:cc:dd:ee:ff

Send magic packet to turn on TV

  1. Enable Wake-on-LAN in configuration.yaml
# Example configuration.yaml entry
wake_on_lan:
  1. Enable Turn on vi Wi-Fi on LG TV. Reference

  1. Turn off Quick Start +

Some say Quick Start + will jam WOL. If so:

TL;DR: Settings > All settings > General > System > Devices > TV Management, and turn off Quick Start+.

  1. Call the service with MAC address specified.
service: wake_on_lan.send_magic_packet
data:
  mac: aa:bb:cc:dd:ee:ff

Select source for TV

service: media_player.select_source
data:
  source: Netflix
target:
  entity_id: media_player.lg_webos_smart_tv

Full script to switch on TV to source "Netflix"

alias: Switch on TV to watch Netflix
sequence:
  - service: wake_on_lan.send_magic_packet
    data:
      mac: aa:bb:cc:dd:ee:ff
  - wait_for_trigger:
      - platform: device
        device_id: 8e6365755c364a7089d69ebe3fed58a2
        domain: media_player
        entity_id: media_player.lg_webos_smart_tv
        type: turned_on
        for:
          hours: 0
          minutes: 0
          seconds: 0
  - service: media_player.select_source
    data:
      source: Netflix
    target:
      entity_id: media_player.lg_webos_smart_tv
  - service: notify.mobile_app_iphone
    data:
      message: Netflixing
      title: TV is on.
      target: SOME_IPHONE
mode: single
icon: mdi:television-classic

An example to trigger a script using event fired during a scene is activated

Background: a scene cannot turn on a script or automation, but it will fire an event, so a script can be triggered by observing that event.

Reference

Example:

- id: '1598543301938'
  alias: Sleepy Light Automation
  trigger:
  - event_data:
      domain: scene
      service: turn_on
      service_data:
        entity_id: scene.bed_light_on_red_45
    event_type: call_service
    platform: event
  action:
  - entity_id: script.sleepy_light
    service: script.turn_on
  mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment