Skip to content

Instantly share code, notes, and snippets.

@viennaa
Created July 10, 2022 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viennaa/64e0e9eeeb9395270b46076753ec2654 to your computer and use it in GitHub Desktop.
Save viennaa/64e0e9eeeb9395270b46076753ec2654 to your computer and use it in GitHub Desktop.
Automatically extend LG WebOS Developer Mode with Home Assistant

The Developer Mode app is required for testing apps in LG's WebOS. The developer mode lasts only 50 hours, and the app has a button to reset the timer back to 50. This Home Assistant automation will turn on the TV, open the Developer Mode app, press the "extend" button, and turn the TV back off. Here I set it to run automatically every night at 4 AM.

Important to note that the media_player.webos_tv in these files refers to the entity ID in my own configuration. You need to replace it with your TV's entity ID defined in Home Assistant.

- alias: Extend TV dev mode every night
trigger:
# Run this automation every night at 4 AM.
- platform: time
at: 04:00:00
condition:
# Run only if TV is off.
- condition: template
value_template: '{{ is_state("media_player.webos_tv", "off") }}'
action:
- service: script.extend_dev
mode: single
wake_on_lan:
webostv:
# Your TV's local IP address.
host: 192.168.XXX.XXX
name: WebOS TV
customize:
sources:
- youtube
- netflix
# Include Developer Mode in sources so it can be selected by the script.
- Developer Mode
turn_on_action:
# Make sure "wake on mobile" is enabled in your TV's network settings.
service: wake_on_lan.send_magic_packet
data:
# Your TV's MAC address.
mac: XX-XX-XX-XX-XX-XX
extend_dev:
alias: Extend WebOS Dev
mode: single
sequence:
# Turn on the TV.
- service: media_player.turn_on
target:
# The webos_tv identifier throught this file will depend on your configuration,
# so change it everywhere to match your TV's entity ID.
entity_id: media_player.webos_tv
# Check if TV is on before continuing.
- wait_template: '{{ is_state("media_player.webos_tv", "on") }}'
timeout: '10'
continue_on_timeout: true
# Open the Developer Mode app.
- service: media_player.select_source
target:
entity_id: media_player.webos_tv
data:
source: Developer Mode
# Check if Developer Mode app is open before continuing.
- wait_template: '{{ is_state_attr("media_player.webos_tv", "source", "Developer
Mode") }}'
timeout: '10'
continue_on_timeout: true
# Navigate down twice to select the "extend" button, then press OK.
- service: webostv.button
data:
entity_id: media_player.webos_tv
button: DOWN
- service: webostv.button
data:
entity_id: media_player.webos_tv
button: DOWN
- service: webostv.button
data:
entity_id: media_player.webos_tv
button: ENTER
# Wait a couple seconds to let the changes save, just in case.
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
# Turn TV off after all is done.
- service: media_player.turn_off
target:
entity_id: media_player.webos_tv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment