# Kodi HA - get real time player position every minute in HA

**URL:** <https://discourse.nodered.org/t/kodi-ha-get-real-time-player-position-every-minute-in-ha/57666>\
**Category:** General\
**Created:** [2 February 2022 15:56 UTC](https://discourse.nodered.org/t/kodi-ha-get-real-time-player-position-every-minute-in-ha/57666 "2022-02-02T15:56:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![flankoBlanko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/flankoblanko/32/51319_2.png) [@flankoBlanko](https://discourse.nodered.org/u/flankoBlanko)\
**Post date:** [2 February 2022 15:56 UTC](https://discourse.nodered.org/t/kodi-ha-get-real-time-player-position-every-minute-in-ha/57666/1 "2022-02-02T15:56:43Z")

</div>

Hi,  
i'm setting up a light to show when a movie is in the first half and when is in the second part in order to set up an intermission when watching a movie.  
i'm trying to get a node red to recognize when the movie player in Kodi get over the half time.  
Right now i'm able to get this value only when status of player changes.  
Is there a way you can think of to get the current time of the movie in "real time" or to "schedule a check of that parameter?  
Thanks

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 February 2022 20:27 UTC](https://discourse.nodered.org/t/kodi-ha-get-real-time-player-position-every-minute-in-ha/57666/2 "2022-02-02T20:27:28Z")

</div>

How are you getting data from Kodi?

---

<div class="post-metadata">

**Author:** ![flankoBlanko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/flankoblanko/32/51319_2.png) [@flankoBlanko](https://discourse.nodered.org/u/flankoBlanko)\
**Post date:** [2 February 2022 21:42 UTC](https://discourse.nodered.org/t/kodi-ha-get-real-time-player-position-every-minute-in-ha/57666/3 "2022-02-02T21:42:09Z")

</div>

I'm getting data from the node "event state" checking kodi media player. After that node i have a function node to chech if  
payload:msg.data.new\_state.attributes.media\_position  
is \> or \< than  
payload:durata.payload /2  
and then trigger some light based on the result.  
This method seems to get data from kodi only on an a state change.  
So if i play pause or skip ahed with the remote i get a state change and everything works.  
What i can't figure it out is how to check the  
payload:msg.data.new\_state.attributes.media\_position every minute or so in oder to trigger the funcion node automatically when the position of the player passed the middle of the movie,  
Do you know any other way to get the current time in "real time?"  
Would you suggest another approach to get the same result?  
Thanks

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [2 February 2022 22:04 UTC](https://discourse.nodered.org/t/kodi-ha-get-real-time-player-position-every-minute-in-ha/57666/4 "2022-02-02T22:04:35Z")

</div>

> [@flankoBlanko](#):
>
> I'm getting data from the node "event state"

I am guessing this is a HA thing?

At a guess, the node only reports events (and cannot be called for status?)

I can only suggest you update the title to include HA (so that it gets the right audience) AND/OR ask on the HA forum or ask on the repository for that kodi package.

---

<div class="post-metadata">

**Author:** ![xx\_Nexus\_xx](https://avatars.discourse-cdn.com/v4/letter/x/54ee81/32.png) [@xx\_Nexus\_xx](https://discourse.nodered.org/u/xx_Nexus_xx)\
**Post date:** [2 February 2022 22:41 UTC](https://discourse.nodered.org/t/kodi-ha-get-real-time-player-position-every-minute-in-ha/57666/5 "2022-02-02T22:41:01Z")

</div>

I used Kodi in the past as well and there is a [good Kodi-Node](https://flows.nodered.org/node/node-red-contrib-kodi) available which gives you access to the KODI API. The node is not maintained anymore but it works.

Alternatively, you can settup Kodi itself with [Kodi-to-MQTT](https://forum.kodi.tv/showthread.php?tid=222109)

---

<div class="post-metadata">

**Author:** ![flankoBlanko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/flankoblanko/32/51319_2.png) [@flankoBlanko](https://discourse.nodered.org/u/flankoBlanko)\
**Post date:** [3 February 2022 09:45 UTC](https://discourse.nodered.org/t/kodi-ha-get-real-time-player-position-every-minute-in-ha/57666/6 "2022-02-03T09:45:00Z")

</div>

@Steve-Mcl yes is a HA thing, I'll update the title.  
@xx_Nexus_xx thanks, i'll check both of them.

---

<div class="post-metadata">

**Author:** ![paulkeates](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@paulkeates](https://discourse.nodered.org/u/paulkeates)\
**Post date:** [3 February 2022 18:31 UTC](https://discourse.nodered.org/t/kodi-ha-get-real-time-player-position-every-minute-in-ha/57666/7 "2022-02-03T18:31:58Z")

</div>

Hi,

I think the Filter (RBE) node will trigger on a state change giving you the capabilities you are asking for.

Cheers,

Paul

---

<div class="post-metadata">

**Author:** ![flankoBlanko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/flankoblanko/32/51319_2.png) [@flankoBlanko](https://discourse.nodered.org/u/flankoBlanko)\
**Post date:** [7 February 2022 11:37 UTC](https://discourse.nodered.org/t/kodi-ha-get-real-time-player-position-every-minute-in-ha/57666/8 "2022-02-07T11:37:40Z")

</div>

Hi,  
i finally got it work using Kodi-to-MQTT!  
Thanks @xx_Nexus_xx for the tip. Once installed on kodi i can get info every minute and make a simple function in node red to check if the % of the movie is higher or lower then 50%.  
Thanks again!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [21 February 2022 11:37 UTC](https://discourse.nodered.org/t/kodi-ha-get-real-time-player-position-every-minute-in-ha/57666/9 "2022-02-21T11:37:58Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
