Automation Help - Kodi if music playing TV backlight on

Hi there I am trying to get an automation so that when music is being played on Kodi it will automatically switch on my LED TV backlights. I should point out that the LED backlights do not have discrete power on/off commands. This means that I can’t just blast the off command every time Kodi goes from music to idle otherwise the lights will just turn on and off all over the place.

I thought I had an idea by adding a condition to check that the input boolean (which is the TV backlight switch of sorts) if it is on then allow for the off process to happen. But not having luck.

Lights come on just fine but not off.

- id: '1551012847304'
  alias: TV backlight on when playing music
  trigger:
platform: template
value_template: "{% if is_state_attr('media_player.kodi', 'media_content_type', 'music' ) %}true{% endif %}"
  condition: []
  action:
service: input_boolean.turn_on
entity_id: input_boolean.tv_backlight
- id: '9402512847736'
  alias: TV backlight off after playing music
  trigger:
platform: state
entity_id: media_player.kodi
from: 'playing'
to: 'idle'
  condition: 
condition: state
entity_id: input_boolean.tv_backlight
state: 'on'
  action:
service: input_boolean.turn_off
entity_id: input_boolean.tv_backlight

Really appreciate any thoughts on this.

Ok so the my issue was self solved after I carefully read the automation actions guide and realised you could embed conditions into the actions.

Feel a little stupid but hey thats the leaning curve with these things.

- id: '9402512847736'
  alias: TV backlight off after playing music
  trigger:
    platform: state
    entity_id: media_player.kodi
    from: 'playing'
    to: 'idle'
  action:
    - condition: or
      conditions:
        - condition: state
          entity_id: input_boolean.tv_backlight
          state: 'on'
    - service: input_boolean.turn_off
      entity_id: input_boolean.tv_backlight