Kodi differentiate film and tv show

Hi, I need help.
I will configure this condition, for the HA to identify that it is a movie and to turn off my lights. However, it is working.

    condition:
      - after: sunset
        condition: sun
      - condition: template
        value_template: '{{ states.media_player.kodi.attributes.media_content_type == "movie" }}'
      action:
      - data:
          event: luz-sala-todas-off
         service: ifttt.trigger

I can see in the “dev-state” section that the HA is identifying the content correctly. That is, “media_content_type: movie”

What am I doing wrong?
I just wanted to turn off the lights while playing movies. No tv shows, no music.

I can’t see a trigger

Hello, how are you?
Thanks for helping me one more time !! Follow all my automation.

    alias: KODI PLAY
  trigger:
  - entity_id: media_player.kodi
    from: idle
    platform: state
    to: playing
  condition:
  - after: sunset
    condition: sun
  - condition: template
    value_template: '{{ states.media_player.kodi.attributes.media_content_type == "movie" }}'
  action:
  - data:
      event: luz-sala-todas-off
    service: ifttt.trigger

It’s working.

Now I want to create a condition. If it's tv shows, run automation X

So create a new automation similar to your first one with tv shows in the condition or trigger

1 Like

I found a problem, more serious. If you play a song or thema of movies (tvtunes), when leaving the function playing to idle … Turn on all the lights …

Anyone have any idea how to call an automation only when the stop is from a movie …

You need to set up an input_boolean that is turned on when the movie starts and then use the state of that as a condition in your automation and also use that automation to reset it’s state to off.

I managed to make it work.
Now my problem is this …

You do perform nothing for music … But if for example on the cover of the movie, it is reproducing the movie theme … it is not called for automation.
Because he is not starting from idle to play … he is starting to play to play, that is, there is no change of status;

I need help now in this part. How to make the HA understand that changed from playing music to playing movie …