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.

Setup Homey with MQTT for location detection

1235711

Comments

  • i'm not quite sure what you mean @Denn1992 .


  • can you see anything in MQTTLENS @Eternity?
    in subscribe put owntracks/#
  • EternityEternity Member
    edited March 2017
    In mqttlens - pushing the top right arrow in screen on my phone in the Owntracks App adds items to the log (I put a couple of X's in for privacy reasons):

    {"_type":"location","tid":"EA","acc":32,"batt":76,"conn":"w","doze":false,"lat":XX.6296778,"lon":X.7468055,"t":"u","tst":1488536841}

    So, my phone and my NAS are communicating. In my router I forwarded the port 1883 to  my NAS. This works.
    The Owntracks App says it is "connected" in the status settings. I see messages "leaving" show up, if I change the radius to 0. And 'entering' if I change it back to 50 meters. The region is shared.

    I installed the Homey App, set the IP adres and port to connect to my NAS, but the log shows nothing:

    20170303-11:37:24 topics:
    20170303-11:37:24 topics:
    20170303-11:37:27 getUserArray called
    20170303-11:37:27 getLogLines called
    20170303-11:40:55 getUserArray called
    20170303-11:40:55 getLogLines called


    Somehow HOmey + Owntracks client are not connecting to my NAS.
  • Eternity said:
    @Denn1992

    Hmm I gave up.... Ik managed to set up my Syno and phones. I got updates once, where I could see where my phone and my sons phone was. Than it stopped working. No more region updates in the log file. 

    Any chance you can explain how you managed to get your setup to work.... 




    What version of the honey app are you using? Version 0.5.1 should fix that problem. 
  • do you have in owntrack app on your homey and in mqttlens you local nas ip adress?



  • try this flow and look what you see in mqttlens
  • diansdians Member
    Had already this problem (everything working perfect from outside but not from inside my network at home) but I thought that I solved this. Well not, still receive an Error (mqttExeption (0) - java.net.SocketTimeoutExeption) when I on my internal network.
    So probably a routing/dns issue. Anyone familiar with this? 
  • if you did the changes to you're  mosquitto.conf file with
    listener 9001
    listener 1883
    websocket 

    then try poort 9001 in mqttlens

  • @Eternity
    The log from the homey app shows that the app is not subscribed to any topics. Did you make a flow with one of the triggercards?

    Because at the moment you need at least one triggercard (in the next release that is solved and the app will subscribe to topic owntracks/# even without triggercards)
  • EternityEternity Member
    edited March 2017
    Thanks for all the responses!


    WORKING NOW!!!

    I re-booted my NAS and phone.
  • my reaction on the ports was for @dians ;

    And for you  @Eternity see reaction from @MennoVanGrinsven
  • JschuetzJschuetz Member
    edited March 2017
    I tried cloudmqtt and my own mosquitto server (pi2). In both servers i can see a client connection (homey) and my mobile device. Both are connected but i can't see any presence data in the homey log.

    20170303-13:09:12 MQTT client connected
    20170303-13:09:12 Connected Topics: owntracks/mqtt/Julian/event
    20170303-13:09:12 reconnectedClient true
    20170303-13:09:12 waiting owntracks/mqtt/Julian/event
    20170303-13:09:21 getUserArray called
    20170303-13:09:21 getLogLines called
    20170303-13:11:55 getLogLines called
    20170303-13:11:55 getUserArray called
    20170303-13:12:20 getUserArray called
    20170303-13:12:20 getLogLines called
    20170303-13:20:38 getLogLines called
    20170303-13:20:38 getUserArray called
    20170303-13:20:39 getLogLines called
    20170303-13:20:39 getUserArray called
    20170303-13:20:43 getLogLines called

    Log Pi2:
    1488544739: Config loaded from /etc/mosquitto/mosquitto.conf.
    1488544739: Opening ipv4 listen socket on port 1883.
    1488544739: Opening ipv6 listen socket on port 1883.
    1488544739: New connection from 192.168.10.106 on port 1883.
    1488544739: New client connected from 192.168.10.106 as mqttjs_6e29d1b (c1, k10, u'mqtt').
    1488544766: New connection from 192.168.10.200 on port 1883.
    1488544766: Client mqtt/Julian disconnected.
    1488544766: New client connected from 192.168.10.200 as mqtt/Julian (c0, k60, u'mqtt').
    1488544771: Client mqtt/Julian disconnected.
    1488544804: New connection from 192.168.10.200 on port 1883.
    1488544804: Client mqtt/Julian disconnected.
    1488544804: New client connected from 192.168.10.200 as mqtt/Julian (c0, k60, u'mqtt').
    1488544827: Client mqtt/Julian disconnected.
    1488544853: New connection from 192.168.10.200 on port 1883.
    1488544853: Client mqtt/Julian disconnected.


  • diansdians Member
    webwalser said:
    if you did the changes to you're  mosquitto.conf file with
    listener 9001
    listener 1883
    websocket 

    then try poort 9001 in mqttlens

    Hmm, Mosquitto on my synology, connecting by default on port 1883 no need for websocket on port 9001, and as I mentioned from public no problems at all. But I shall give it a try. Thanks for so far ;-)
  • Jschuetz said:
    I tried cloudmqtt and my own mosquitto server (pi2). In both servers i can see a client connection (homey) and my mobile device. Both are connected but i can't see any presence data in the homey log.

    20170303-13:09:12 MQTT client connected
    20170303-13:09:12 Connected Topics: owntracks/mqtt/Julian/event
    20170303-13:09:12 reconnectedClient true
    20170303-13:09:12 waiting owntracks/mqtt/Julian/event
    20170303-13:09:21 getUserArray called
    20170303-13:09:21 getLogLines called
    20170303-13:11:55 getLogLines called
    20170303-13:11:55 getUserArray called
    20170303-13:12:20 getUserArray called
    20170303-13:12:20 getLogLines called
    20170303-13:20:38 getLogLines called
    20170303-13:20:38 getUserArray called
    20170303-13:20:39 getLogLines called
    20170303-13:20:39 getUserArray called
    20170303-13:20:43 getLogLines called

    Log Pi2:
    1488544739: Config loaded from /etc/mosquitto/mosquitto.conf.
    1488544739: Opening ipv4 listen socket on port 1883.
    1488544739: Opening ipv6 listen socket on port 1883.
    1488544739: New connection from 192.168.10.106 on port 1883.
    1488544739: New client connected from 192.168.10.106 as mqttjs_6e29d1b (c1, k10, u'mqtt').
    1488544766: New connection from 192.168.10.200 on port 1883.
    1488544766: Client mqtt/Julian disconnected.
    1488544766: New client connected from 192.168.10.200 as mqtt/Julian (c0, k60, u'mqtt').
    1488544771: Client mqtt/Julian disconnected.
    1488544804: New connection from 192.168.10.200 on port 1883.
    1488544804: Client mqtt/Julian disconnected.
    1488544804: New client connected from 192.168.10.200 as mqtt/Julian (c0, k60, u'mqtt').
    1488544827: Client mqtt/Julian disconnected.
    1488544853: New connection from 192.168.10.200 on port 1883.
    1488544853: Client mqtt/Julian disconnected.




    Make a dummy flow with the topic owntracks/# then you will see all messages that the homey app can receive.
  • Jschuetz said:
    I tried cloudmqtt and my own mosquitto server (pi2). In both servers i can see a client connection (homey) and my mobile device. Both are connected but i can't see any presence data in the homey log.

    20170303-13:09:12 MQTT client connected
    20170303-13:09:12 Connected Topics: owntracks/mqtt/Julian/event
    20170303-13:09:12 reconnectedClient true
    20170303-13:09:12 waiting owntracks/mqtt/Julian/event
    20170303-13:09:21 getUserArray called
    20170303-13:09:21 getLogLines called
    20170303-13:11:55 getLogLines called
    20170303-13:11:55 getUserArray called
    20170303-13:12:20 getUserArray called
    20170303-13:12:20 getLogLines called
    20170303-13:20:38 getLogLines called
    20170303-13:20:38 getUserArray called
    20170303-13:20:39 getLogLines called
    20170303-13:20:39 getUserArray called
    20170303-13:20:43 getLogLines called

    Log Pi2:
    1488544739: Config loaded from /etc/mosquitto/mosquitto.conf.
    1488544739: Opening ipv4 listen socket on port 1883.
    1488544739: Opening ipv6 listen socket on port 1883.
    1488544739: New connection from 192.168.10.106 on port 1883.
    1488544739: New client connected from 192.168.10.106 as mqttjs_6e29d1b (c1, k10, u'mqtt').
    1488544766: New connection from 192.168.10.200 on port 1883.
    1488544766: Client mqtt/Julian disconnected.
    1488544766: New client connected from 192.168.10.200 as mqtt/Julian (c0, k60, u'mqtt').
    1488544771: Client mqtt/Julian disconnected.
    1488544804: New connection from 192.168.10.200 on port 1883.
    1488544804: Client mqtt/Julian disconnected.
    1488544804: New client connected from 192.168.10.200 as mqtt/Julian (c0, k60, u'mqtt').
    1488544827: Client mqtt/Julian disconnected.
    1488544853: New connection from 192.168.10.200 on port 1883.
    1488544853: Client mqtt/Julian disconnected.




    Make a dummy flow with the topic owntracks/# then you will see all messages that the homey app can receive.
    Thank you so much!

    Now i see 

    0170303-16:10:30 received '{"tst":1488553846,"acc":65,"_type":"location","alt":95,"lon":8.107945064524912,"vac":10,"p":99.10999298095703,"lat":51.57079243774687,"batt":79,"conn":"w","tid":"ju"}' on 'owntracks/mqtt/Julian'
  • OskarOskar Member
    Just a question about the use-case for MQTT.
    Since I have Homey I looked at geofencing and many different app options, including MQTT (although this was a while back). IFTTT works, with multiple accounts (just put in the key with a semicolon as a separator for each user).
    This works easy and seems to be much simpler than the instllation description and challenges that I see in this post.

    Where is this different than what I can already do with IFTTT; is there more functionallity for me to consider switching over to MQTT? 
  • Oskar said:
    Just a question about the use-case for MQTT.
    Since I have Homey I looked at geofencing and many different app options, including MQTT (although this was a while back). IFTTT works, with multiple accounts (just put in the key with a semicolon as a separator for each user).
    This works easy and seems to be much simpler than the instllation description and challenges that I see in this post.

    Where is this different than what I can already do with IFTTT; is there more functionallity for me to consider switching over to MQTT? 
    Can you describe your multi user ifttt solution?
  • diansdians Member
    dians said:
    webwalser said:
    if you did the changes to you're  mosquitto.conf file with
    listener 9001
    listener 1883
    websocket 

    then try poort 9001 in mqttlens

    Hmm, Mosquitto on my synology, connecting by default on port 1883 no need for websocket on port 9001, and as I mentioned from public no problems at all. But I shall give it a try. Thanks for so far ;-)
    Finally fixed, Loopback nat protocol didn't work as it shout be on my (Asus)router with alternative firmware (asuswrt-merlin). After changing the protocol to the original asus setting (known issue), a working connection extern and on my internal network :-)
  • OskarOskar Member
    Jschuetz said:
    Oskar said:
    Just a question about the use-case for MQTT.
    Since I have Homey I looked at geofencing and many different app options, including MQTT (although this was a while back). IFTTT works, with multiple accounts (just put in the key with a semicolon as a separator for each user).
    This works easy and seems to be much simpler than the instllation description and challenges that I see in this post.

    Where is this different than what I can already do with IFTTT; is there more functionallity for me to consider switching over to MQTT? 
    Can you describe your multi user ifttt solutiion
  • OskarOskar Member
    Oskar said:
    Jschuetz said:
    Oskar said:
    Just a question about the use-case for MQTT.
    Since I have Homey I looked at geofencing and many different app options, including MQTT (although this was a while back). IFTTT works, with multiple accounts (just put in the key with a semicolon as a separator for each user).
    This works easy and seems to be much simpler than the instllation description and challenges that I see in this post.

    Where is this different than what I can already do with IFTTT; is there more functionallity for me to consider switching over to MQTT? 
    Can you describe your multi user ifttt solutiion
    I've set up IFTTT on Homey. My 4family members have their own IFTTT account, and when setting up the connection from IFTTT to homey, they all use the same Homey acount to make the link.

    Than, I've set up a flow called "coming home" (trigger from IFTTT app).
    There are 3 parameters that you can use to play with. I've set the first one to the name of the person, the second is the name of the location that IFTTT can report on, and for now the 3rd one unused.

    In IFTTT each user sets up a Applet with a geofence and let homey select the flow "coming home" with the 3 paramenters. First is the name of the user and second is the location you'd like to refer to. Works on IOS as well as Andoid.

    The only thing I'm still looking for is a way to sk homey where someone is and that Homey tells me the address of the individual. it's the only part I've not been able to fugure out yet. But note, I am not a developer, so any bright idea's on how to do that would be appreciated.
    Voila.
  • EternityEternity Member
    edited March 2017
    I am almost there..... need a wee bit more help please :-)

    Homey log shows my phones activity:

    20170304-16:41:55 received '{"_type":"location","tid":"EA","acc":20,"batt":71,"conn":"m","doze":false,"lat":XX.XXXXXXX,"lon":X.XX73791,"tst":1488642113}' on 'owntracks/Ernst/EvdB'

    My phone displays a notification that it is leaving a region I set as 'Home'. However, this is not seen in Homey...



    What is that last bit that I am missing?

    THANKS!
  • edited March 2017
    @eternity what topic did you subscribe to? owntracks/.. /.. /event? So in your case owntracks/Ernst/EvdB/event
  • EternityEternity Member
    edited March 2017
    Yes, the last one:

    owntracks/Ernst/EvdB/event

    Is what is entered in my trigger flow card. 

    Perhaps I am missing something in Android settings? 
  • adjuadju Member
    Eternity said:
    Yes, the last one:

    owntracks/Ernst/EvdB/event

    Is what is entered in my trigger flow card. 

    Perhaps I am missing something in Android settings? 
    This works for me

  • EternityEternity Member
    edited March 2017
    Thanks again guys!

    I have copied the suggested Android setting, I saw no errors.

    In MQTTLens subscribing to owntracks/Ernst/EvdB/ I see log entries:



    In Homey I made this flow, but it doesn't do anything:



    What I am aiming for is to have this flow work:


    In the trigger card it has owntracks/Ernst/EvdB/event in the first box.

    So; my phone seems to move in and out a region, but this region change is not seen by in Homey.
  • adjuadju Member
    @Eternity

    Did you create any booleans?
    If not, I think that you better read the first post about creating booleans and creating flows.


  • EternityEternity Member
    edited March 2017
    Hmm... I doubt that. But, I am doubting a lot recently. 

    I am not sure what region updates not showing in Homey log and in Mqttlens has to do with boolean variables. 

    If I want to alter a boolean, I need a trigger first. I am not getting a region trigger to Homey. 




  • adjuadju Member
    edited March 2017
    @Eternity

    I all so been struggling for a few days now and finally this morning it worked. 
    Did you check the log off the app? 
    One thing I know, you need the booleans to get a message to your telephone. I also started with the "simple" flow as you and had no response either. 

    Edit: Saw earlier that you checked the log. 
  • @adju

    Thanks again. I will follow your suggestions tomorrow. 

    Thanks for helping! 
  • @Eternity
    i only see location events in your log
    the trigger will only fire when there is a transition message (i.e. enter/leave a geofence).
Sign In or Register to comment.