Detect TV Source - lg webos

Hallo,

FIrst of all I would like to express my appreciation for this community, it really helped me doing building my Home assistant.
I am totally new so pardon my question if it was very basic.

I am trying to trigger an automation based on the TV Source (I am having LG WebOS).
I did the below

In configuration.yaml

## LG TV as Media Player ##
media_player:
  - platform: webostv
    host: 192.168.2.132
    name: LG TV
    filename: webostv.conf
    timeout: 5
    turn_on_action:
      service: wake_on_lan.send_magic_packet
      data:
        mac: "xxxxxxxxxxxx"
    customize:
      sources:
        - Amazon Prime Video
        - Apple
        - DAZN
        - Diveo TV-App
        - Gallery
        - HDMI 4
        - LG
        - LG Channels
        - LG Content Store
        - Music
        - Netflix
        - Photo & Video
        - Rakuten TV
        - Web Browser
        - XBOX ONE
        - YouTube
        - maxdome
        - Smart IPTV

in sensor.yaml

- platform: template
    sensors:
        tv_source:
            value_template: '{{ state_attr("media_player.lg_tv", "source") }}'
            friendly_name: 'TV Source'

in automation.yaml:

- id: '1234000004'
  alias: 'Turn on XBOX Lights'
  description: 'Turn on XBOX Lights'
  trigger:
    platform: state
    entity_id: sensor.tv_source
    to: 'XBOX ONE'
  condition:
    condition: time
    after: '16:00:00'
    before: '06:00:00'
  action:
  - alias: 'Turn on xbox lights'
    service: light.turn_on
    data:
        entity_id: light.living_room

Thse sensor state works fine for all the TV apps (Netflix, youtube, …), but not for HDMI sources, it didn’t detect the HDMI source.

am I doing anything wrong?

Thanks,
Ahmed

Shouldn’t it be
sources:
- hdmi4
(without the space) ??