Not according to the docs…
in YAML, keys are never between quotes, not sure where you got that.
Confused with JSON where they must?
I don’t know why. I read it somewhere and until I put the quotation marks to both, key and value, it didn’t work for me 🤷
I re-read the YAML specification, and quoting is basically only needed when using a “: " (colon-blank) or " #” (blank-hash) sequences, be it in dict keys, dict values or any scalar in general.
Now, HA has some peculiarities, the one I know is regarding templates, that must be quoted in some way (single, double or multiline)
Many years later, and I am still struggling, and hoping one of you bright folks will help me out!
I followed all the documentation and the multiple topics on the issue, but once again it doesn’t work. Here is my code (in the automations.yaml file). I am running on Raspberry Pi, Docker container:
- id: '*************'
alias: Turn On Living Room TV with WakeOnLan
description: ''
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"
broadcast_address: "192.168.4.255"
I can see the button to turn on the TV from the Off state, but it won’t actually turn it on. What am I doing wrong?
-
container is set up to work on the same network as the host
-
The TV is running LG WebOS 4.1.5
-
Connected on ethernet, confirmed broadcast address
-
LG Connect Apps enabled in Network Menu
-
Option for “Mobile On” does not exist in General Settings on the TV
Activating “mobile on” on mine solved the problem !
(LG Connected Apps was already activated but not sufficient)
I can actually turn ON and OFF with HA or any WOL apps.
LG 55C6V
Firmware 5.70.30, WebOS 3.4.2
Wifi Off
Lan connected
Eddy
I have an LG TV, and I’ve configured both Home Assistant (HA) and the TV to be able to turn it on using WakeOnLan. It works when the TV has been turned off recently, but if the TV has been off for a long time, WakeOnLan doesn’t seem to work.
Do you experience the same issue?
What am I doing wrong?
Thank you
I have the same problem. Did you find a solution? If you check the devices connected to you network do you see your tv? My disappears from my network, that’s the reason the wake on lan do not works.
I was using Alexa without problem now I move to home assistant and have this problem. Wake on lan works great if I turn of the tv and turn on again in a short time. Hours later do not work…
This sounds like ARP cache timeout and you may need to add a static ARP entry to your router/FW. This is required if you have entered the LG’s IP address in the “LG webOS TV Broadcast address” field instead of using the network broadcast address, or like me, HA sits in a different subnet.
I use Sophos XG Home Edition virtual firewall and so use the LG’s unicast IP address and add a static ARP entry by going to Configure > Network > Neighbors [ARP-NDP] on my firewall. You might not have this option if you have a basic ISP provided router.
This works well with my LG E8 on 5.50.
In order for WOL to work, be sure to turn off Quick start+ in the TV settings. (I know it sounds counter-intuitive, but it works). WOL works even over wifi, the TV does NOT disconnect from the home network when turned off
How are you connecting to your TV? With an Ethernet cable or WiFi? The MAC address for the TV is different for each connection. Be sure you are trying to connect via the correct MAC, and use an Ethernet cable if possible. I will attach my script that works perfectly.
turn_on_lgtv:
alias: Turn on LGTV
sequence:
- service: wake_on_lan.send_magic_packet
data:
mac: ## ## ## ## ## ## ## ##
- repeat:
sequence:
- service: wake_on_lan.send_magic_packet
data:
mac: ## ## ## ## ## ## ## ##
- delay: "00:00:10"
until:
- condition: or
conditions:
- "{{ repeat.index >= 12 }}"
- "{{ states.media_player.lg_tv.state == 'on' }}"
- service: input_select.select_option
target:
entity_id: input_select.tv_remote
data:
option: "LG TV"
- wait_template: "{{ states.media_player.lg_tv.state == 'on' }}"
timeout: "00:00:30"
continue_on_timeout: "false"
- service: media_player.select_source
target:
entity_id: media_player.lg_tv
data:
source: 'Hulu'
I call this scrip using a standard service call from an automation.
- id: lgtv_auto_on
alias: LGTV Auto On
initial_state: true
mode: restart
trigger:
- platform: state
entity_id: media_player.kitchen_roku_tv
# from: "on"
to: "standby"
- platform: state
entity_id: input_button.lg_tv_trigger
condition:
- condition: time
after: "18:00:00"
before: "20:00:00"
- condition: state
entity_id: media_player.lg_tv
state: "off"
- condition: state
entity_id: input_boolean.nobody_home
state: "off"
action:
- service: script.turn_on
entity_id: script.turn_on_lgtv
#
Hope this helps.