This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.
Official SDK2

[APP] Kodi [2.2.0]

1151618202126

Comments

  • "Kodi starts playing something" -> dim the lights, perfect.
    "Kodi has been paused" -> bring the lights back up, works
    "Kodi has been resumed" -> dim again, works fine.
    "Kodi has been stopped" - lights should go back up, but don't!

    I'm starting to think that the last If card (Kodi has been stopped) does not mean "Playback of whatever you were playing stopped".

    Can someone confirm? Should I make separate flows for "Episode / Movie has stopped"? And what if what I'm watching is neither an episode nor a movie? But eh, a nature documentary? *cough*
  • Hello @MartijnDeRhoter, for me its working see the flow

  • Thanks! I'll dig some deeper then :)
  • I have a 'Kodi is gestopt' flow also, turns the lights on perfectly every time.
    Maybe post your flow here?
  • Avec plaisir:


  • And you're sure about that condition? 
  • Fairly sure, it's the same condition I use for the other Kodi-light-controls (so lights don't come on when they weren't on in the first place)

    This one for example works fine:


  • EvertorNEvertorN Member
    edited January 2017
    @MartijnDeRhoter Are you using movies/tv shows that come from your Kodi Library, or are you using an addon like Exodus? I remember the stop event working differently in that case, so that might be a bug. If you are using the kodi library then the stop event should 100% work, so you might want to double check your condition. Also post your log after a stop event (get it from the Kodi settings page), maybe that will help us sort out the issue.

    This is my stop flow and this works perfectly:

    kodi.png 176.5K
  • All fixed - it works! Turns out there was a conflicting flow hidden deep away in a non-related folder. Thanks for the help!
  • Hi Everton

    Is it possible to make a trigger, kodi starts or detected?
  • olive said:
    Hi Everton

    Is it possible to make a trigger, kodi starts or detected?
    So you are looking for a trigger when Homey successfully connects to Kodi? Currently, there's a poll with a 10s interval that checks whether Kodi is accessible, so there could be a max lag of 10s. I am assuming that your Kodi is not always on, so the use case would be:
    - Turn Kodi on
    - Kodi boots
    - Homey connects to Kodi (takes 0-10sec)
    - <fire trigger here>

    Correct?
  • oliveolive Member
    edited January 2017
    EvertorN said:
    olive said:
    Hi Everton

    Is it possible to make a trigger, kodi starts or detected?
    So you are looking for a trigger when Homey successfully connects to Kodi? Currently, there's a poll with a 10s interval that checks whether Kodi is accessible, so there could be a max lag of 10s. I am assuming that your Kodi is not always on, so the use case would be:
    - Turn Kodi on
    - Kodi boots
    - Homey connects to Kodi (takes 0-10sec)
    - <fire trigger here>

    Correct?
    Yes this is correct. I have a intel nuc, only for kodi there is not always on. My problem is kodi is installed on windows and i would like when kodi starts or detected, start hue scenes. 
  • You could make an auto start mini movie ;-) I think
  • olive said:
    EvertorN said:
    olive said:
    Hi Everton

    Is it possible to make a trigger, kodi starts or detected?
    So you are looking for a trigger when Homey successfully connects to Kodi? Currently, there's a poll with a 10s interval that checks whether Kodi is accessible, so there could be a max lag of 10s. I am assuming that your Kodi is not always on, so the use case would be:
    - Turn Kodi on
    - Kodi boots
    - Homey connects to Kodi (takes 0-10sec)
    - <fire trigger here>

    Correct?
    Yes this is correct. I have a intel nuc, only for kodi there is not always on. My problem is kodi is installed on windows and i would like when kodi starts or detected, start hue scenes. 
    Yeah this is definitely possible, I have added it to the future features :). Note that this event fires upon reconnection. This means that if the connection between Homey and Kodi gets lost, and recovered, it will get fired. This could also happen after a Homey reboot. So the event will actually be 'When Homey connects to Kodi'. Is this sufficient?
  • EvertorN said:
    olive said:
    EvertorN said:
    olive said:
    Hi Everton

    Is it possible to make a trigger, kodi starts or detected?
    So you are looking for a trigger when Homey successfully connects to Kodi? Currently, there's a poll with a 10s interval that checks whether Kodi is accessible, so there could be a max lag of 10s. I am assuming that your Kodi is not always on, so the use case would be:
    - Turn Kodi on
    - Kodi boots
    - Homey connects to Kodi (takes 0-10sec)
    - <fire trigger here>

    Correct?
    Yes this is correct. I have a intel nuc, only for kodi there is not always on. My problem is kodi is installed on windows and i would like when kodi starts or detected, start hue scenes. 
    Yeah this is definitely possible, I have added it to the future features :). Note that this event fires upon reconnection. This means that if the connection between Homey and Kodi gets lost, and recovered, it will get fired. This could also happen after a Homey reboot. So the event will actually be 'When Homey connects to Kodi'. Is this sufficient?
    Hi Everton,

    Great news, is it possible with a 5s interval that checks whether Kodi is accessible?
  • olive said:
    EvertorN said:
    olive said:
    EvertorN said:
    olive said:
    Hi Everton

    Is it possible to make a trigger, kodi starts or detected?
    So you are looking for a trigger when Homey successfully connects to Kodi? Currently, there's a poll with a 10s interval that checks whether Kodi is accessible, so there could be a max lag of 10s. I am assuming that your Kodi is not always on, so the use case would be:
    - Turn Kodi on
    - Kodi boots
    - Homey connects to Kodi (takes 0-10sec)
    - <fire trigger here>

    Correct?
    Yes this is correct. I have a intel nuc, only for kodi there is not always on. My problem is kodi is installed on windows and i would like when kodi starts or detected, start hue scenes. 
    Yeah this is definitely possible, I have added it to the future features :). Note that this event fires upon reconnection. This means that if the connection between Homey and Kodi gets lost, and recovered, it will get fired. This could also happen after a Homey reboot. So the event will actually be 'When Homey connects to Kodi'. Is this sufficient?
    Hi Everton,

    Great news, is it possible with a 5s interval that checks whether Kodi is accessible?
    Yeah definitely. But currently it is configured as 10s. I don't want to stress Homey to much by checking every 5s to see whether Kodi is online. The average wait time is already 5 sec ( (10+0) / 2 = 5 ;-) ).
  • I'm having issues where the Kodi app does not start to re-poll after my Kodi system has been shutdown...
    So my flows are not receiving the right triggers.

    Last updates of my logging:
    2017-01-19T22:39:05.022Z"onKodiPlay()"
    2017-01-19T22:39:05.023Z"Triggering flow kodi_playing_something"
    2017-01-19T23:21:16.543Z"onKodiStop"
    2017-01-19T23:21:16.545Z"Triggering flow " "kodi_stop"
    2017-01-19T23:39:35.551Z"onKodiGenericEvent() " "kodi_shutdown"
    2017-01-19T23:39:35.582Z{"data":{"exitcode":64},"sender":"xbmc"}
    2017-01-19T23:39:35.583Z"Triggering flow " "kodi_shutdown"
    This was 2 days ago... no logging showing the "Stil cannot reconnect: " 

    Any ideas on the issue? Would it be possible to trigger a re-start of the app?
  • EvertorN said:
    @MartijnDeRhoter Are you using movies/tv shows that come from your Kodi Library, or are you using an addon like Exodus? I remember the stop event working differently in that case, so that might be a bug. If you are using the kodi library then the stop event should 100% work, so you might want to double check your condition. Also post your log after a stop event (get it from the Kodi settings page), maybe that will help us sort out the issue.

    This is my stop flow and this works perfectly:

    Hi Everton

    What you have in the when column, for lights on, i mean  not kodi has been paused.
  • olive said:
    EvertorN said:
    @MartijnDeRhoter Are you using movies/tv shows that come from your Kodi Library, or are you using an addon like Exodus? I remember the stop event working differently in that case, so that might be a bug. If you are using the kodi library then the stop event should 100% work, so you might want to double check your condition. Also post your log after a stop event (get it from the Kodi settings page), maybe that will help us sort out the issue.

    This is my stop flow and this works perfectly:

    Hi Everton

    What you have in the when column, for lights on, i mean  not kodi has been paused.
    Yeah sure thing. I have a single flow that controls my lights. This enables me to implement multiple triggers for a certain action and makes it more manageable since I only have to control my lights from one flow. So for example, my lights on flow:

    This will turn my lights on whenever I trigger the flow 'Lights on'. I can trigger this using different triggers, e.g.:
    kodi_stop:


    or kodi_pause:


    This way I can easily adjust / extend my 'lights on' action without having to modify all the flows that trigger my lights.








  • I still have problems with the connection, its weird because nothing is changed in my configuration, or hardware (network) so don't know what the problem is.  is it my kodi media player? i see REFUSED... 

    here some error log 

    2017-01-22T23:14:44.760Z "Trying to reconnect"
    2017-01-22T23:14:44.767Z "Stil cannot reconnect: " {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect","address":"192.168.1.234","port":9090}
    2017-01-22T23:14:54.806Z "Trying to reconnect"
    2017-01-22T23:14:56.696Z "startListeningForEvents()"
    2017-01-22T23:16:48.942Z "onKodiPlay()"
    2017-01-22T23:16:48.943Z "Triggering flow kodi_playing_something"
    2017-01-22T23:22:35.247Z "onKodiGenericEvent() " "kodi_pause"

    after turn off/ on the app. it's working again, for sometimes a hour, or a couple of days.. (random)

    2017-01-23T19:14:25.658Z {"data":{"item":{"title":"The Shawshank Redemption","type":"movie","year":1994},"player":{"playerid":-1,"speed":0}},"sender":"xbmc"}
    2017-01-23T19:14:25.664Z "Triggering flow " "kodi_pause"
    2017-01-23T19:14:27.708Z "onKodiPlay()"
    2017-01-23T19:14:27.713Z "Triggering flow kodi_playing_something"
    2017-01-23T19:14:27.736Z "Triggering flow kodi_resume"
    2017-01-23T19:14:46.853Z "onKodiGenericEvent() " "kodi_pause"
    2017-01-23T19:14:46.854Z {"data":{"item":{"title":"The Shawshank Redemption","type":"movie","year":1994},"player":{"playerid":-1,"speed":0}},"sender":"xbmc"}
    2017-01-23T19:14:46.857Z "Triggering flow " "kodi_pause"


  • EvertorN said:
    olive said:
    EvertorN said:
    @MartijnDeRhoter Are you using movies/tv shows that come from your Kodi Library, or are you using an addon like Exodus? I remember the stop event working differently in that case, so that might be a bug. If you are using the kodi library then the stop event should 100% work, so you might want to double check your condition. Also post your log after a stop event (get it from the Kodi settings page), maybe that will help us sort out the issue.

    This is my stop flow and this works perfectly:

    Hi Everton

    What you have in the when column, for lights on, i mean  not kodi has been paused.
    Yeah sure thing. I have a single flow that controls my lights. This enables me to implement multiple triggers for a certain action and makes it more manageable since I only have to control my lights from one flow. So for example, my lights on flow:

    This will turn my lights on whenever I trigger the flow 'Lights on'. I can trigger this using different triggers, e.g.:
    kodi_stop:


    or kodi_pause:


    This way I can easily adjust / extend my 'lights on' action without having to modify all the flows that trigger my lights.








    Ok, Thanks.
  • Reemster said:
    I still have problems with the connection, its weird because nothing is changed in my configuration, or hardware (network) so don't know what the problem is.  is it my kodi media player? i see REFUSED... 

    here some error log 

    2017-01-22T23:14:44.760Z "Trying to reconnect"
    2017-01-22T23:14:44.767Z "Stil cannot reconnect: " {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect","address":"192.168.1.234","port":9090}
    2017-01-22T23:14:54.806Z "Trying to reconnect"
    2017-01-22T23:14:56.696Z "startListeningForEvents()"
    2017-01-22T23:16:48.942Z "onKodiPlay()"
    2017-01-22T23:16:48.943Z "Triggering flow kodi_playing_something"
    2017-01-22T23:22:35.247Z "onKodiGenericEvent() " "kodi_pause"

    after turn off/ on the app. it's working again, for sometimes a hour, or a couple of days.. (random)

    2017-01-23T19:14:25.658Z {"data":{"item":{"title":"The Shawshank Redemption","type":"movie","year":1994},"player":{"playerid":-1,"speed":0}},"sender":"xbmc"}
    2017-01-23T19:14:25.664Z "Triggering flow " "kodi_pause"
    2017-01-23T19:14:27.708Z "onKodiPlay()"
    2017-01-23T19:14:27.713Z "Triggering flow kodi_playing_something"
    2017-01-23T19:14:27.736Z "Triggering flow kodi_resume"
    2017-01-23T19:14:46.853Z "onKodiGenericEvent() " "kodi_pause"
    2017-01-23T19:14:46.854Z {"data":{"item":{"title":"The Shawshank Redemption","type":"movie","year":1994},"player":{"playerid":-1,"speed":0}},"sender":"xbmc"}
    2017-01-23T19:14:46.857Z "Triggering flow " "kodi_pause"


    This is fixed in the next release, it only polled for reconnection when the connection was gracefully closed by Kodi. Whenever there's a connection error (which randomly happens on reboots / shutdowns of Kodi), the app would 'hang', I will hopefully finalise this tonight (Melbourne time) along with some other new features and push it to Git!
  • I also found out that the trigger 'TV show starts' is not working correctly. It didn't trigger when I started a TV show, but it did after I paused and resumed it. It did work a little while ago.
    And is there any way to identify when music started playing? I know about the trigger 'something started', but that also triggers for video.
  • Hi there,

    I'm really in digging your app!
    Unfortunately it's not working for me..
    I've installed kodi on my Sony android tv as an app.
    I've installed the Kodi app on Homey.
    When I enter the IP from kodi with the TCP port 9090 it says:

    "Kon geen verbinding maken met Kodi. Check je connective gegevens. Error: Cconnect ECONNREFUSED (my.ip.):9090"

    I also tried the TCP of my tv 20600, then I don't get any message.
    Can you help me out?

    Thanks!

  • 9090 is not the correct port.  That port is for the eventserver or something like that.
    Default the port is set to 8080.  You should check in your settings what the port for the webserver is set to.
  • Fire69 said:
    9090 is not the correct port.  That port is for the eventserver or something like that.
    Default the port is set to 8080.  You should check in your settings what the port for the webserver is set to.


    It says in the homey - kodi app TCP port Standard is 9090
    What do you mean by check in your settings? Do you mean in Kodi on my TV?

    Thanks for your reply!

  • Fire69 said:
    9090 is not the correct port.  That port is for the eventserver or something like that.
    Default the port is set to 8080.  You should check in your settings what the port for the webserver is set to.


    It says in the homey - kodi app TCP port Standard is 9090
    What do you mean by check in your settings? Do you mean in Kodi on my TV?

    Thanks for your reply!

    I'm sorry, I'm wrong, I was thinking about another app :tongue:
    9090 should be OK.

    In Kodi, can you make sure the settings to enable control from other applications are set?
    (Settings - Services - Control)

  • Fire69 said:
    Fire69 said:
    9090 is not the correct port.  That port is for the eventserver or something like that.
    Default the port is set to 8080.  You should check in your settings what the port for the webserver is set to.


    It says in the homey - kodi app TCP port Standard is 9090
    What do you mean by check in your settings? Do you mean in Kodi on my TV?

    Thanks for your reply!

    I'm sorry, I'm wrong, I was thinking about another app :tongue:
    9090 should be OK.

    In Kodi, can you make sure the settings to enable control from other applications are set?
    (Settings - Services - Control)

    Thanks,
    I did everything is on yes (allow)
    Don't know where I screw things up..
  • is it me or does this app not do what i expect it to do?

    I believed this app could start a flow when i play a movie on my kodi, is this correct?

    I added the app, entered my kodi details and created a flow.

    On start (and resume) movie dim all my lights etc.
    On pause and stop tunr on lights again.

    When i start, pause, stop or resume a movie nothing happens at all...

    When i give a voice command: ok Homey i want to watch a movie and say a title it works....

    But this is not what i wanted, i believed when i play/start a movie (by remote) it would also trigger a flow, is this corrent?!

    If so, why does it not work then?

    I use an intel nuc which is powered down when not used, i start it up only when i want to watch a movie.

    In the log i see the following:
    [code]
    DatetimeEntry
    2017-01-29T00:19:14.444Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:19:24.492Z"Trying to reconnect"
    2017-01-29T00:19:24.543Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:19:34.592Z"Trying to reconnect"
    2017-01-29T00:19:37.609Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:19:47.650Z"Trying to reconnect"
    2017-01-29T00:19:50.664Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:20:00.712Z"Trying to reconnect"
    2017-01-29T00:20:03.734Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:20:13.792Z"Trying to reconnect"
    2017-01-29T00:20:14.744Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:20:24.789Z"Trying to reconnect"
    2017-01-29T00:20:27.764Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:20:37.829Z"Trying to reconnect"
    2017-01-29T00:20:38.784Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:20:48.789Z"Trying to reconnect"
    2017-01-29T00:20:51.794Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:21:01.864Z"Trying to reconnect"
    2017-01-29T00:21:02.827Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:21:12.912Z"Trying to reconnect"
    2017-01-29T00:21:15.864Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:21:25.912Z"Trying to reconnect"
    2017-01-29T00:21:26.884Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:21:36.933Z"Trying to reconnect"
    2017-01-29T00:21:39.944Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:21:49.975Z"Trying to reconnect"
    2017-01-29T00:21:50.954Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:22:01.002Z"Trying to reconnect"
    2017-01-29T00:22:03.990Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:22:14.037Z"Trying to reconnect"
    2017-01-29T00:22:17.034Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:22:27.082Z"Trying to reconnect"
    2017-01-29T00:22:30.089Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:22:40.142Z"Trying to reconnect"
    2017-01-29T00:22:43.144Z"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.1.8","port":9090}
    2017-01-29T00:22:53.205Z"Trying to reconnect"

    [/code]

  • @B3rt Check if your IP address is still valid (i.e. hasn't changed after the reboot). The log says it cannot reach your Kodi device on the configured IP address.
Sign In or Register to comment.