Kodi notification

I would rather let you tell me the movie I’m watching on kodi on iPhone
enity is called media_player.kodi_i7
but if I put this in my actions, nothing appears to me

  • service: notify.ios_iphone_matteo
    data:
    title: “Smart Home Alerts”
    message: ‘Movie’
    data:
    subtitle: ‘{{ ( states(“sensor.media_player.kodi_i7.media_title”) }}’

someome help me?

data_template for a start, possibly formatting, hard to tell with you not formatting your post. Also kinda feels odd that you want a message to tell you what movie you’re watching, but each to his own I guess.

- id: 'Kodi playing Video i7'
  alias: "Kodi playing Video i7"
  trigger:
    - platform: state
      entity_id: media_player.kodi_i7
      to: 'playing'
  condition:
    - condition: time
      after: '18:00:00'
      before: '22:00:00'
    - condition: template
      value_template: '{{ states.media_player.kodi_i7.media_content_type != "video" }}'
  action:
    - service: notify.ios_iphone_matteo
      data:
        title: "Smart Home Alerts"
        message: 'Movie'
        data:
          subtitle: '{{ ( states("sensor.media_player.kodi_i7.media_title") }}'

I suspect the template on the last line is wrong, I doubt you will have a sensor called media_player.

Also, the condition will stop this automation firing whenever you’re watching a video, which I think is the opposite of what you wanted?

the condition must not interrupt the viewing of the video but only notify on the iphone which movie it is

That makes absolutely no sense whatsoever. This automation doesn’t control the media player so the viewing will not be interrupted by this automation.

But this automation won’t run because that condition prevents it.

what should i do to get the notification of what kodi transmits?

Remove the condition, use data_template instead of data, and check that the template correctly renders the information you wish to send as the message.

what is the template?

Usually state attribute that you want.

So I would guess you would want something like

"{{ state_attr('media_player.kodi_i7', 'media_title') }}"

You can test templates in the template tool on the interface to make sure you return the correct value.

thank you. work

1 Like

No worries :+1: