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

15791011

Comments

  • youlabeestyoulabeest Member
    edited March 2017

    Hi all,

    I've setup everything according the above.
    On my synology everything is working, the IOS app says it's connected. (I've made regions, Home and Work and set ratio to 100m, it also says I'm at home.. (Red dot))

    My log files on Homey are:

    20170313-19:49:07 getLogLines called
    20170313-19:56:29 connectedClient == null
    20170313-19:56:29 Broker URL: mqtt://(ipadres):1883
    20170313-19:56:29 state.topic = x topic = owntracks/homey/(myname)/event state.fence = x geofence = Home
    20170313-19:56:30 MQTT client connected
    20170313-19:56:30 Connected Topics: owntracks/homey/(myname)/event
    20170313-19:56:30 reconnectedClient false
    20170313-19:56:30 waiting owntracks/homey/(myname)/event
    20170313-19:58:16 getLogLines called
    20170313-19:58:16 getUserArray called
    20170314-17:51:50 getUserArray called
    20170314-17:51:50 getLogLines called
    20170314-18:15:18 getLogLines called
    20170314-18:15:18 getUserArray called
    20170314-19:07:43 getUserArray called
    20170314-19:07:43 getLogLines called
    20170314-19:30:21 getUserArray called
    20170314-19:30:21 getLogLines called
    20170314-19:31:09 getUserArray called
    20170314-19:31:09 getLogLines called

    I've made the following flow:

    When I push test, I get a notification on my Iphone. When I leave my house I don't get a notification..
    What am I missing? Thanks in advance!

  • @youlabeest
    Add a dummy trigger card with the topic owntracks/#

    And see what messages homey received. 
    Most probably the topic you are subscribing to does not match the topic the owntracks app on your phone is posting on. 

    In the picture it says owntracks/+/+ (did you also add /event behind it?). 

    In the log it says:
    20170313-19:56:30 Connected Topics: owntracks/homey/(myname)/event

    And that is weird. That should state owntracks/+/+/event. 

    If you changed the topic, try to restart the homey owntracks app. 
  • @youlabeest
    Add a dummy trigger card with the topic owntracks/#

    And see what messages homey received. 
    Most probably the topic you are subscribing to does not match the topic the owntracks app on your phone is posting on. 

    In the picture it says owntracks/+/+ (did you also add /event behind it?). 

    In the log it says:
    20170313-19:56:30 Connected Topics: owntracks/homey/(myname)/event

    And that is weird. That should state owntracks/+/+/event. 

    If you changed the topic, try to restart the homey owntracks app. 


    Thanks for your reply!

    How can I check the topic in the IOS-app?

    With a dummy trigger card you mean:
    In the "als"-colum -> Geo-fence verlaten trigger -> owntracks/# -> Home

    The log says homey/myname because i just made the +/+ adjustment in the flow. I can't find a way to restart the homey app. Do I have to delete it and reinstall?

  • @youlabeest
    In Settings/Apps you have the possibility to disable/enable an app, but that should not be needed. As you changed the topic. 

    I mean like this:



    If you add a trigger like that, it will add owntracks/# as topic. This specific topic will tell the client to get all the messages that the owntracks phone client will send to the broker. This way you can see in the log what messages there are and what topics these messages are posted on.

    In the next version, the homey app will automatically subscribe to this topic.
  • @youlabeest
    In Settings/Apps you have the possibility to disable/enable an app, but that should not be needed. As you changed the topic. 

    I mean like this:



    If you add a trigger like that, it will add owntracks/# as topic. This specific topic will tell the client to get all the messages that the owntracks phone client will send to the broker. This way you can see in the log what messages there are and what topics these messages are posted on.

    In the next version, the homey app will automatically subscribe to this topic.

    @ the moment this is my log..
    Still not receiving any push notifications on my phone..

    Name: homey Fence: Lon: 5.84222203243139 Lat: 50.99542176317974

    Laatste log regels:

    Log ophalen

    20170316-08:33:37 We have received a location message
    20170316-08:39:43 OnMessage called
    20170316-08:39:43 received '{"tst":1489649983,"acc":65,"_type":"location","alt":60,"lon":5.842260999914406,"vac":10,"p":101.8660049438477,"lat":50.99538455774678,"batt":93,"conn":"w","tid":"YD"}' on 'owntracks/homey/iYouri'
    20170316-08:39:43 We have received a location message
    20170316-09:13:45 OnMessage called
    20170316-09:13:45 received '{"batt":93,"lon":5.841694004064644,"acc":543,"p":101.7898483276367,"vac":10,"lat":50.99533693546134,"t":"p","conn":"w","tst":1489652024,"alt":60,"_type":"location","tid":"YD"}' on 'owntracks/homey/iYouri'
    20170316-09:13:45 We have received a location message
    20170316-09:21:02 OnMessage called
    20170316-09:21:02 received '{"batt":91,"lon":5.842289302916417,"acc":65,"p":101.767936706543,"vac":10,"lat":50.99540399778385,"t":"p","conn":"w","tst":1489652461,"alt":60,"_type":"location","tid":"YD"}' on 'owntracks/homey/iYouri'
    20170316-09:21:02 We have received a location message
    20170316-09:36:56 OnMessage called
    20170316-09:36:56 received '{"batt":90,"lon":5.842320200777685,"acc":65,"p":101.7551040649414,"vac":10,"lat":50.99531340271404,"t":"p","conn":"w","tst":1489653415,"alt":60,"_type":"location","tid":"YD"}' on 'owntracks/homey/iYouri'
    20170316-09:36:56 We have received a location message
    20170316-09:51:32 OnMessage called
    20170316-09:51:32 received '{"batt":89,"lon":5.842293009248989,"acc":65,"p":101.7348709106445,"vac":10,"lat":50.99540598621758,"t":"p","conn":"w","tst":1489654290,"alt":60,"_type":"location","tid":"YD"}' on 'owntracks/homey/iYouri'
    20170316-09:51:32 We have received a location message
    20170316-10:06:29 OnMessage called
    20170316-10:06:29 received '{"batt":89,"lon":5.84222203243139,"acc":65,"p":101.719123840332,"vac":10,"lat":50.99542176317974,"t":"p","conn":"w","tst":1489655189,"alt":60,"_type":"location","tid":"YD"}' on 'owntracks/homey/iYouri'
    20170316-10:06:29 We have received a location message
    20170316-11:10:41 getLogLines called


  • @youlabeest
    I do not see any transition message in you log. So the homey app did not receive any enter/leave events. 
  • @youlabeest
    I do not see any transition message in you log. So the homey app did not receive any enter/leave events. 

    How can I make this happen?
  • @youlabeest
    I do not see any transition message in you log. So the homey app did not receive any enter/leave events. 

    How can I make this happen?

    Make sure you are entering or leaving you defined geofence. You can do this by setting the radius for you geofence to 0 wait a bit and the  set it to 50 or some other value. 
  • Anybody got bluetooth beacon working? I just received mine from China. I'm able to see it in LightBlue and configured the region in Owntracks with the UUID found in the Lightblue (beacon diagnostics app), but it beacon icon always stays blue.
  • Yannick said:
    Anybody got bluetooth beacon working? I just received mine from China. I'm able to see it in LightBlue and configured the region in Owntracks with the UUID found in the Lightblue (beacon diagnostics app), but it beacon icon always stays blue.
    And when you go outside? The beacon signal is quite strong...
    it is working with my raspberry Pi 3
  • ingmar said:
    Yannick said:
    Anybody got bluetooth beacon working? I just received mine from China. I'm able to see it in LightBlue and configured the region in Owntracks with the UUID found in the Lightblue (beacon diagnostics app), but it beacon icon always stays blue.
    And when you go outside? The beacon signal is quite strong...
    it is working with my raspberry Pi 3
    no luck
  • Yannick said:
    ingmar said:
    Yannick said:
    Anybody got bluetooth beacon working? I just received mine from China. I'm able to see it in LightBlue and configured the region in Owntracks with the UUID found in the Lightblue (beacon diagnostics app), but it beacon icon always stays blue.
    And when you go outside? The beacon signal is quite strong...
    it is working with my raspberry Pi 3
    no luck

    probably you have seen this, but if you follow it by the letter, it should work http://owntracks.org/booklet/features/beacons/

    For instance, I have started the name with a minus "-' preventing it from ping ponging away/connected/away/... etc. I also set radius to zero
  • yes done all that and studied that booklet intensively but it just never comes into range. Here is a screenshot of my config:
  • Yannick said:
    yes done all that and studied that booklet intensively but it just never comes into range. Here is a screenshot of my config:

    Strange... Buy a raspberry and it will work ;-)
  • don't think the device is the problem as LightBlue is seeing the Beacon just fine.
  • But that is still the own tracks app that does not recognize the beacon right? Because if it does, it should send a waypoint message or a transition message to the MQTT broker.
  • YannickYannick Member
    edited March 2017
    waypoint is sent correctly:
    {"_type":"waypoint","tst":1488910078,"lat":52.109957990386,"lon":4.2822382880878,"rad":0,"desc":"-HomeFrontdoor:891CBDBB-9553-4018-B252-1CD100585819"}
    just no transition.
    Owntracks iPhone app never marks the region as entered (or red icon in Regions view)
  • Yannick said:
    waypoint is sent correctly:
    {"_type":"waypoint","tst":1488910078,"lat":52.109957990386,"lon":4.2822382880878,"rad":0,"desc":"-HomeFrontdoor:891CBDBB-9553-4018-B252-1CD100585819"}
    just no transition.
    Owntracks iPhone app never marks the region as entered (or red icon in Regions view)

    A waypoint never triggers an event. You should set a radius in you phone owntracks app. Then it becomes a fence. 
  • not for beacons
  • Yannick said:
    not for beacons
    Ah OK. I do not have any tokens, so can not test it out sadly. 


  • YannickYannick Member
    edited March 2017
    I found the problem and my beacon detection is now working properly.
    The reason was that I had the wrong UUID. My device apparently has 2 UUID's. 1 for configuration and for the iBeacon function.
  • It works! Thanks! :)

    20170407-18:57:07 state.topic = x topic = owntracks/pb/pim state.fence = x geofence = home
  • Yannick said:
    I found the problem and my beacon detection is now working properly.
    The reason was that I had the wrong UUID. My device apparently has 2 UUID's. 1 for configuration and for the iBeacon function.

    PimBliek said:
    It works! Thanks! :)

    20170407-18:57:07 state.topic = x topic = owntracks/pb/pim state.fence = x geofence = home
    Cool that it works. 

    Anyone tested beacons already on Android? 
  • viktorviktor Member
    edited April 2017
    Hi @MennoVanGrinsven

    Can you please help me with my setup? Trying everything but no chance to get it working:
    I have 4 Regions in my Android App and Homey Flows with like Entering Trigger: "owntracks/viktor/viktor/event" and then Geofence "BHZ".

    No chance to trigger my Flows on any Region.

    My last Log is:

    Last known user data:

    Name: viktor Fence: Lon: 8.xxx Lat: 47.xxx

    Log lines:

    Get logs
    20170411-06:44:27 We are not waiting for this topic
    20170411-06:44:27 state.topic = x topic = owntracks/viktor/viktor/event state.fence = x geofence = BHZ
    20170411-06:44:27 We are not waiting for this topic
    20170411-06:44:27 state.topic = x topic = owntracks/viktor/viktor/event state.fence = x geofence = Buero
    20170411-06:44:27 We are not waiting for this topic
    20170411-06:44:27 state.topic = x topic = owntracks/viktor/viktor/event state.fence = x geofence = Schlafzimmer
    20170411-06:44:27 We are not waiting for this topic
    20170411-06:44:28 MQTT client connected
    20170411-06:44:28 Connected Topics: owntracks/#,owntracks/viktor/viktor/event
    20170411-06:44:28 reconnectedClient false
    20170411-06:44:28 waiting owntracks/#
    20170411-06:44:28 MQTT client connected
    20170411-06:44:28 Connected Topics: owntracks/#,owntracks/viktor/viktor/event
    20170411-06:44:28 reconnectedClient false
    20170411-06:44:28 waiting owntracks/viktor/viktor/event
    20170411-06:44:28 OnMessage called
    20170411-06:44:28 received '{"_type":"location","tid":"or","acc":73,"batt":81,"conn":"m","doze":false,"lat":47.xxx,"lon":8.xxx,"tst":1491885862}' on 'owntracks/viktor/viktor'
    20170411-06:44:28 We have received a location message
    20170411-06:44:43 getUserArray called
    20170411-06:44:43 getLogLines called

    --------------------------------

    Later after changing the accuracy in Region:

    20170411-06:50:12 OnMessage called
    20170411-06:50:12 received '{"_type":"location","tid":"or","acc":83,"batt":80,"conn":"m","doze":false,"lat":47.xxx,"lon":8.xxx,"tst":1491886219}' on 'owntracks/viktor/viktor'
    20170411-06:50:12 We have received a location message
    20170411-06:50:32 OnMessage called
    20170411-06:50:32 received '{"_type":"transition","tid":"or","acc":82.5,"event":"enter","lat":47.xxx,"lon":8.xxx,"tst":xxx,"wtst":1491827105,"t":"c"}' on 'owntracks/viktor/viktor/event'
    20170411-06:50:32 Accuracy is within limits
    20170411-06:50:32 Trigger enter card for undefined
    20170411-06:50:32 Trigger generic card for undefined
    20170411-06:50:32 state.topic = owntracks/viktor/viktor/event topic = owntracks/viktor/viktor/event state.fence = undefined geofence = Garage
    20170411-06:50:32 state.topic = owntracks/viktor/viktor/event topic = owntracks/viktor/viktor/event state.fence = undefined geofence = BHZ
    20170411-06:50:32 state.topic = owntracks/viktor/viktor/event topic = owntracks/viktor/viktor/event state.fence = undefined geofence = Buero
    20170411-06:50:32 state.topic = owntracks/viktor/viktor/event topic = owntracks/viktor/viktor/event state.fence = undefined geofence = Schlafzimmer
    20170411-06:50:32 state.topic = owntracks/viktor/viktor/event topic = owntracks/# state.fence = undefined geofence = BHZ
    20170411-06:50:32 We are not waiting for this topic
    20170411-06:50:40 getUserArray called
    20170411-06:50:40 getLogLines called

    Thanks
    Viktor
  • @viktor so it is working for you now after you changed the accuracy. Seems so according to your added log. 
  • Hi @MennoVanGrinsven
    Not yet, after the second log i have the transition. But my flows are not running. Restarted the App and Phone, nothing.

    Tnx
  • Here my flows with "owntracks/viktor/viktor/event" in the forms.
    1.PNG 236.7K
    2.PNG 247.9K
  • viktor said:
    Hi @MennoVanGrinsven
    Not yet, after the second log i have the transition. But my flows are not running. Restarted the App and Phone, nothing.

    Tnx

    20170411-06:50:32 Trigger enter card for undefined
    20170411-06:50:32 Trigger generic card for undefined

    Is in your second log. The card is triggered but with undefined.. That is weird. 

  • Yes, i have always "state.fence = undefined"
  • viktor said:
    Yes, i have always "state.fence = undefined"

    You just might have found a bug  :/
    Because it should be set. 
    Will have a look at the code tonight after work. 

    Are you willing to use a beta version? Because I rewrote the app, added voice and am about to publish it in beta channel
Sign In or Register to comment.