Using the LG webOS source value to trigger events

Sorry I didn’t add this before, but as promised here’s the “sensor” I added that stores the current value of the TV source for the LG webOS TV:

sensor:
  - platform: template
    sensors:
      living_room_tv_source:
        value_template: '{{ states.media_player.lg_webos_tv_remote_2.attributes["source"] }}'
        friendly_name: 'Living Room TV Source'

And here’s a sample automation that’s triggering a scene when the TV source changes to Netflix:

automation:
  - alias: "LR Playing Night Netflix"
    trigger:
      platform: state
      entity_id: sensor.living_room_tv_source
      to: 'Netflix'
    condition:
      - condition: state
        entity_id: sun.sun
        state: 'below_horizon'
      - condition: state
        entity_id: media_player.lg_webos_tv_remote_2
        state: 'playing'
    action:
      service: scene.turn_on
      entity_id: scene.livingroom_dim
9 Likes