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]

191012141526

Comments

  • Phuturist said:
    I tested 1.3.1 this evening but have different results as to Pim. I did re-add my Kodi device and did get some entries in the log. But it repeats the following over and over in a timeframe of about 6 minutes and then there is nothing anymore afterwards.
    Trying to reconnect"Stil cannot reconnect: " {"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect","address":"192.168.0.114","port":9090}
    These entries are from around the 6 minutes this evening when my Homey rebooted after the firmware upgrade to 0.8.39. At that time my Kodi system was shut off so it's understandable it could not reconnect. But later this evening I started my Kodi system to watch a serie but it did not reconnect at that time (no log entry or whatsoever) and therefor also did not trigger any of the flows (like start episode, pause, play, shutdown etc.).

    So it seems the Kodi app did not reconnect my Kodi system after being unable to reconnect earlier when my Kodi system was shutdown. @EvertorN , previously you mentioned that it should be able to do so after I asked about this use case, any clue what is going on here and what I can do to further test this?
    It only automatically reconnects when it successfully connects when the app starts for the first time (e.g. after a boot). When Kodi is unavailable after Homey boots, it won't make a connection and it wont't retry. This is something that's on my to-do list.

    So, assuming you have already added Kodi as a device:
    - Booting Kodi AFTER booting Homey (i.e. Kodi is off after Homey boot) > no auto reconnect on connection loss
    - Booting Homey when Kodi is up and running > auto reconnect on connection loss

    You can either:
    - Delete and re-add your device
    - Reboot Homey and make sure Kodi is up when Homey boots.



  • Fire69Fire69 Member
    I just installed 1.3.1 from Github and made a flow to annouce the movie title when a movie is started.
    Works great, as it used to before .38.
    I totally forgot I had to delete my device so I didn't do that and it still worked.  Should I still delete it then?  :)
  • All works great for me now as well after rebooting Homey while my Kodi system was powered on.

    I also have a request, would it be possible to have trigger cards "a episode has ended" and "a movie has ended" as the counterparts for their "a ... has started"?
  • @Fire69: You're right. The app automatically gets re-initiated after an update, so deleting and re-adding a device was not necessary.

    @Phuturist: Might be possible. I checked the Kodi API documentation and found the following property of the 'stop' event:
    "end": {
              "description": "Whether the player has reached the end of the playable item(s) or not", 
              "required": true, 
              "type": "boolean"
            }, 

    I will have a look at it this weekend to see if I can link it to an episode / movie as well.

    Just out of curiousity, what are you gonna use it for?

  • EvertorN said:
    @Fire69: You're right. The app automatically gets re-initiated after an update, so deleting and re-adding a device was not necessary.

    @Phuturist: Might be possible. I checked the Kodi API documentation and found the following property of the 'stop' event:
    "end": {
              "description": "Whether the player has reached the end of the playable item(s) or not", 
              "required": true, 
              "type": "boolean"
            }, 

    I will have a look at it this weekend to see if I can link it to an episode / movie as well.

    Just out of curiousity, what are you gonna use it for?

    Turn on the light when an episode or movie has finished ... :expressionless: 
  • Phuturist said:
    EvertorN said:
    @Fire69: You're right. The app automatically gets re-initiated after an update, so deleting and re-adding a device was not necessary.

    @Phuturist: Might be possible. I checked the Kodi API documentation and found the following property of the 'stop' event:
    "end": {
              "description": "Whether the player has reached the end of the playable item(s) or not", 
              "required": true, 
              "type": "boolean"
            }, 

    I will have a look at it this weekend to see if I can link it to an episode / movie as well.

    Just out of curiousity, what are you gonna use it for?

    Turn on the light when an episode or movie has finished ... :expressionless: 
    Just use the 'stop' or 'pause' event. You don't wanna be in the dark if you wanna grab a beer half way through the movie ;-).
  • Is stop also called by Kodi if the episode had ended?
  • Is stop also called by Kodi if the episode had ended?
    Yes,  any type of playback for that matter (movie/episode/music). Same goes for pause
  • EvertorN said:
    Is stop also called by Kodi if the episode had ended?
    Yes,  any type of playback for that matter (movie/episode/music). Same goes for pause
    OK, that's new to me. I already use the start and pause trigger but I thought the stopped card had something to do with the state of Kodi itself. I will use this card then ... :+1: 
  • Fire69Fire69 Member
    Would it be possible to make a mobile card so we can use the android/ios app to see what's playing in Kodi?
  • Would be much appreciated
  • EvertorNEvertorN Member
    edited June 2016
    @Fire69 Yeah that's definitely possible. I'll have a look into it. 

    Edit: There is currently no documentation available on how to create custom mobile cards :(
  • Phuturist said:
    EvertorN said:
    Is stop also called by Kodi if the episode had ended?
    Yes,  any type of playback for that matter (movie/episode/music). Same goes for pause
    OK, that's new to me. I already use the start and pause trigger but I thought the stopped card had something to do with the state of Kodi itself. I will use this card then ... :+1: 
    Yeah the stop event gets triggered when any type of playback is stopped. I'll have a look into events like 'episode xx has stopped' and 'movie xxx has stopped'. Would be nice to create a flow like:
    WHEN: An episode of [tvshow] has stopped
    CONFIRM: 'Do you wanna play the next episode?'
    ACTION: 'Play the latest episode of [tvshow]'
  • v1.4.0 is on Github.
    - Added OnMovieStop flow
    - Added OnEpisodeStop flow
    - Added auto reconnect on init (after homey boots)
  • EvertorN said:
    v1.4.0 is on Github.
    - Added auto reconnect on init (after homey boots)
    Thanx for this. I have a question related to this. Most of the time my Kodi system is offline. So when Homey reboots it wont be able to connect even with this auto reconnect feature.

    Is there any way (other then restarting the app) to reconnect Homey to Kodi when my Kodi system comes online some time after the Homey reboot. For instance, a configured trigger from Kodi to Homey that it is now possible to reconnect?


  • Phuturist said:
    EvertorN said:
    v1.4.0 is on Github.
    - Added auto reconnect on init (after homey boots)
    Thanx for this. I have a question related to this. Most of the time my Kodi system is offline. So when Homey reboots it wont be able to connect even with this auto reconnect feature.

    Is there any way (other then restarting the app) to reconnect Homey to Kodi when my Kodi system comes online some time after the Homey reboot. For instance, a configured trigger from Kodi to Homey that it is now possible to reconnect?


    Yeah it will work when you eventually turn on your Kodi. You will just get a lot of log messages saying:
    - Trying to reconnect
    - Still cannot reconnect..

    The new reconnect functionality makes sure that if you've made a succesful connection during pairing, it will always reconnect when Kodi comes online no matter how many Homey / Kodi reboots.

    About the reconnect trigger. I reckon this will be really hard (if not impossible) to do without writing a script/addon that needs to be installed on Kodi. Because this is a Homey-app, Homey is the initiator of connections to Kodi (not the other way around). And then you'd still have the same problem, only from a Kodi perspective. What happens when Homey is offline when Kodi boots? ;-).
    There might be an option where Homey can register itself as a subscriber to Kodi during pairing. This would allow Kodi to send 'heartbeat / alive' signals to Homey upon boot. I am not sure whether this exists, I'll have a look into it.
  • EvertorN said:
    Phuturist said:
    EvertorN said:
    v1.4.0 is on Github.
    - Added auto reconnect on init (after homey boots)
    Thanx for this. I have a question related to this. Most of the time my Kodi system is offline. So when Homey reboots it wont be able to connect even with this auto reconnect feature.

    Is there any way (other then restarting the app) to reconnect Homey to Kodi when my Kodi system comes online some time after the Homey reboot. For instance, a configured trigger from Kodi to Homey that it is now possible to reconnect?


    Yeah it will work when you eventually turn on your Kodi. You will just get a lot of log messages saying:
    - Trying to reconnect
    - Still cannot reconnect..

    The new reconnect functionality makes sure that if you've made a succesful connection during pairing, it will always reconnect when Kodi comes online no matter how many Homey / Kodi reboots.

    About the reconnect trigger. I reckon this will be really hard (if not impossible) to do without writing a script/addon that needs to be installed on Kodi. Because this is a Homey-app, Homey is the initiator of connections to Kodi (not the other way around). And then you'd still have the same problem, only from a Kodi perspective. What happens when Homey is offline when Kodi boots? ;-).
    There might be an option where Homey can register itself as a subscriber to Kodi during pairing. This would allow Kodi to send 'heartbeat / alive' signals to Homey upon boot. I am not sure whether this exists, I'll have a look into it.
    OK, thanx for the explanation. As it's reconnecting even when kodi has been offline there is no need for a trigger from kodi side then.
  • Phuturist said:
    EvertorN said:
    Phuturist said:
    EvertorN said:
    v1.4.0 is on Github.
    - Added auto reconnect on init (after homey boots)
    Thanx for this. I have a question related to this. Most of the time my Kodi system is offline. So when Homey reboots it wont be able to connect even with this auto reconnect feature.

    Is there any way (other then restarting the app) to reconnect Homey to Kodi when my Kodi system comes online some time after the Homey reboot. For instance, a configured trigger from Kodi to Homey that it is now possible to reconnect?


    Yeah it will work when you eventually turn on your Kodi. You will just get a lot of log messages saying:
    - Trying to reconnect
    - Still cannot reconnect..

    The new reconnect functionality makes sure that if you've made a succesful connection during pairing, it will always reconnect when Kodi comes online no matter how many Homey / Kodi reboots.

    About the reconnect trigger. I reckon this will be really hard (if not impossible) to do without writing a script/addon that needs to be installed on Kodi. Because this is a Homey-app, Homey is the initiator of connections to Kodi (not the other way around). And then you'd still have the same problem, only from a Kodi perspective. What happens when Homey is offline when Kodi boots? ;-).
    There might be an option where Homey can register itself as a subscriber to Kodi during pairing. This would allow Kodi to send 'heartbeat / alive' signals to Homey upon boot. I am not sure whether this exists, I'll have a look into it.
    OK, thanx for the explanation. As it's reconnecting even when kodi has been offline there is no need for a trigger from kodi side then.
    Only downside I can come up with is that you unnecessarily stress Homey by letting it try to reconnect every 10secs
  • RobinVanKekemRobinVanKekem Member
    edited June 2016
    Yes, and if you back off to a larger time gap, the situation could occur your starting a movie/serie in Kodi and Homey reacts real late.

    So that's no solution either, in my opinion.
  • swtttswttt Member
    First of all i am not using kodi, so i am not using this app, but (without looking at your code) wouldnt it be possible to create 2 timers? One on a 5 seconds interval wich checks if kodi is online, and if kodi is online it enables the second timer until kodi becomes unavailable again. 

    According to Emile a timer with the minimal of 5 seconds would be ok. And it is better to use setInterval then the homey build-in cron. (don't ask me why, just what emile said :) )

  • OverlordOverlord Member
    edited June 2016
    @EvertorN
    Still in pursuit of trying to connect Homey to my Kodi install.
    I'm running the 1.4.0 from the zip, but i'm wondering where I can find the logging you mentioned earlier, that you build in. On screen there's not that much, and can't find it in the app directoy on my computer?

    C:\Data\HomeyKodi-master>athom project --run
    ? Select active Homey: Homey @ 192.168.0.135:80
    1/4 - Archiving...
    2/4 - Uploading to Homey @ 192.168.0.135:80...
    3/4 - Running `nl.marvinschenkel.kodi`, press CTRL+C to abort...
    4/4 - Debugging...
    -------------------------------------------------
    init()

  • Overlord said:
    @EvertorN
    Still in pursuit of trying to connect Homey to my Kodi install.
    I'm running the 1.4.0 from the zip, but i'm wondering where I can find the logging you mentioned earlier, that you build in. On screen there's not that much, and can't find it in the app directoy on my computer?

    C:\Data\HomeyKodi-master>athom project --run
    ? Select active Homey: Homey @ 192.168.0.135:80
    1/4 - Archiving...
    2/4 - Uploading to Homey @ 192.168.0.135:80...
    3/4 - Running `nl.marvinschenkel.kodi`, press CTRL+C to abort...
    4/4 - Debugging...
    -------------------------------------------------
    init()

    Its under the Kodi settings menu on the configuration page of Homey.
  • @Phuturist ;

    The problem is that I can't get to connect to my Kodi install. and that is the continuing story with all the versions sofar!
    Even after a clean install of my system with a defaultKodi




  • @Overlord thanks for the detailed info. I think I know what's going on. You've enabled HTTP support as well and configured the port of the Web server to be 9090. What happens now is that Kodi starts a webserver listening on port 9090, thus blocking other incoming TCP requests of Homey. This also explains the 200 ok, since this is an http response. The value of the TCP port cannot be changed through the user interface, so we can assume that's 9090 too. Try the following:
    - Change the http port back to the default for http: 8080
    - reboot kodi
    - try adding your kodi device to homey

    Let me know if it works. I'll start a FAQ section in the OP to put solutions to issues like this. 
  • Just a quick heads up: connecting and reconnecting to my Kodi install on my Nexus Player worked like a charm!

    0.8.38
    Kodi app version 1.3.1
  • @EvertorN ;
    That's it, I was assuming when you said that port 9090 was needed you had to change http on Kodi to 9090.
    Now I have a connection!
    this evening I will play with it  ;)
  • Overlord said:
    @EvertorN ;
    That's it, I was assuming when you said that port 9090 was needed you had to change http on Kodi to 9090.
    Now I have a connection!
    this evening I will play with it  ;)
    Awesome! Glad to hear it's working. I will add a section to the OP for FAQ. Probably should clarify this in the settings page as well during pairing.
  • Nice work!!!!

    Allso works with MrMc for Apple tv 4, only problem is that you can set it to port 9090, but got it to work by on the apple tv. Set MrMC to 9090, error pop up, let it be, then make new device in Homey, and bingo, its works... ;)

  • EvertorNEvertorN Member
    edited July 2016
    Took a while, but 1.4.0 has finally been approved in the app store

    Changelog:
    • Added OnMovieStop trigger (fires when a movie finishes, including credits)
    • Added OnEpisodeStop trigger (fires when an episode finishes, including credits)
    • Added auto reconnect on init (after homey boots)
  • Fire69Fire69 Member
    EvertorN said:

    Changelog:
    • Added OnMovieStop trigger (fires when a movie finishes, including credits)
    What do you mean with 'including credits'?  It just runs to the end and then stops? :)
    So if a movie/episode is playing and you stop it yourself before the end, that's a different event?
Sign In or Register to comment.