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

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

How are you getting data from Kodi?

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

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.

1 Like

I used Kodi in the past as well and there is a good Kodi-Node 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

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

Hi,

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

Cheers,

Paul

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!

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