Webostv attributes

dear all,

I want to integrate my LG TV into Home Assistant.
In configuration.yaml I added the following lines:

switch:
platform: wake_on_lan
name: LGTV
mac: 00-11-22-33-44-55

webostv:
host: 192.168.10.10
name: LG TV
turn_on_action:
service: switch.turn_on
entity_id: switch.LGTV
customize:
sources:
- HDMI 1
- HDMI 2

under sensors / template I entered following:
lgtv_source:
value_template: ‘{{ state_attr(“media_player.lg_tv”, “source”) }}’
friendly_name: ‘TV Source’

This makes me able to add a media control card and the entity “TV_Source” on the dashboard.

Now I want to create an automation depending if the TV is powered on or off.
How can I achieve this?

Thanks for helping me!

For trigger, select State, for Entity select media_player.lg_tv (or whatever yours is named), and then From: On To: Off or vice versa.

Cool… so easy…
many thanks!