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

1356711

Comments

  • edited February 2017
    ingmar said:
    @ingmar
    cool it is working 



    Created a tag "Gebruiker" and set a variable 



    you get the variable menno with value enter (or leave)



    You know that when you enable "extended data" you can have homey tell you when to recharge your battery .....
    Looks great, but will it still be usable as my tutorial? So knowing who is coming home and leaving. Based on that doing some some logic determining if everybody left the house?

    As you are really enthusiastic and quick in developing new stuff, we might go some steps further. I am thinking of specifying a household, so adding some users and keeping track if they are or aren't in the home geofence. The users specified must be the same ids as in the app on iOS/android as well as the home geofence. Based on that you could create a condition someone home, everybody home etc etc. Is this something you want to work out with me? :-)
    I already keep track of users... Last known location is stored in lon/lat and also Adress in my reverse lookup tests ;-) 

    In the next release there will be an array of users created based upon the received messages. The current geofence a user is in is stored, as mentioned lon/lat. 

    This data can be viewed in the log part. Nothing is done with it yet. 

    The idea was to implement voice so you can ask "where is ingmar" and homey responds with the name of the geofence (and later the Adress based on lon/lat) 

    But I don't know how to implement that yet. 
  • webwalser said:

    If MQTT package is not starting:

    1) ssh to your synology and log in with your normal account

    2) execute: cd /var/packages/mosquitto/scripts

    3) sudo vi start-stop-status (you need to be root, hence the sudo), give your admin password when requested

    4) using vi, comment the line which declares the USER such that it reads:

    #USER="mosquitto"

    and you need to ad 

    listener 9001
    listener 1883
    websockets 

    to mosquitto.conf

    @webwalser
     Have a problem with the config file, have add the following:
    listener 9001 [ip-adres]
    listener 1883 [ip-adrres]
    But what do I add with websockets
  • you don't have to put your ip adress in it
    only type

    listener 9001
    listener 1883
    websockets 
  • webwalser said:
    you don't have to put your ip adress in it
    only type

    listener 9001
    listener 1883
    websockets 
    If i then restart the mosquitto app on the synology nas it would not run..
  • try a clean install.
    remove (if there is one ) user mosquitto.
    remove mosquitto app from you NAS.
    restart your NAS
    instal mosquitto (but don't start it)

    then do the folowing:

    login with putty on your NAS with normal user name and passw

    then type SUDO SU
    then  type your admin passw
    then do the following

    1) ssh to your synology and log in with your normal account

    2) execute: cd /var/packages/mosquitto/scripts

    3) sudo vi start-stop-status (you need to be root, hence the sudo), give your admin password when requested

    4) using vi, comment the line which declares the USER such that it reads:

    #USER="mosquitto"

    be sure you save this correctly with ":wq! 

    now you must find mosquitto.conf

    /usr/mosquitto/ or something like that (because on my search everybody has another directory)

    type VI MOSQUITTO.CONF

    and put this three list at the bottom.

    listener 9001
    listener 1883
    websockets 

    save this with ":WQ! 

    open poort 1883 on your router

    now start mosquitto on you nas



  • webwalser said:
    try a clean install.
    remove (if there is one ) user mosquitto.
    remove mosquitto app from you NAS.
    restart your NAS
    instal mosquitto (but don't start it)

    then do the folowing:

    login with putty on your NAS with normal user name and passw

    then type SUDO SU
    then  type your admin passw
    then do the following

    1) ssh to your synology and log in with your normal account

    2) execute: cd /var/packages/mosquitto/scripts

    3) sudo vi start-stop-status (you need to be root, hence the sudo), give your admin password when requested

    4) using vi, comment the line which declares the USER such that it reads:

    #USER="mosquitto"

    be sure you save this correctly with ":wq! 

    now you must find mosquitto.conf

    /usr/mosquitto/ or something like that (because on my search everybody has another directory)

    type VI MOSQUITTO.CONF

    and put this three list at the bottom.

    listener 9001
    listener 1883
    websockets 

    save this with ":WQ! 

    open poort 1883 on your router

    now start mosquitto on you nas



    gonna try..thanks

  • mbalik79 said:
    webwalser said:
    try a clean install.
    remove (if there is one ) user mosquitto.
    remove mosquitto app from you NAS.
    restart your NAS
    instal mosquitto (but don't start it)

    then do the folowing:

    login with putty on your NAS with normal user name and passw

    then type SUDO SU
    then  type your admin passw
    then do the following

    1) ssh to your synology and log in with your normal account

    2) execute: cd /var/packages/mosquitto/scripts

    3) sudo vi start-stop-status (you need to be root, hence the sudo), give your admin password when requested

    4) using vi, comment the line which declares the USER such that it reads:

    #USER="mosquitto"

    be sure you save this correctly with ":wq! 

    now you must find mosquitto.conf

    /usr/mosquitto/ or something like that (because on my search everybody has another directory)

    type VI MOSQUITTO.CONF

    and put this three list at the bottom.

    listener 9001
    listener 1883
    websockets 

    save this with ":WQ! 

    open poort 1883 on your router

    now start mosquitto on you nas



    gonna try..thanks

    save is only ":wq""?

  • sorry you must hold down the esc key

  • yup..first the escape button and then type "wq"

  • don't forget : and !
  • sudo su is not working with my admin's password. If I use sudo su - i will get root acces, am I wright?

  • @Ingmar if you want to see all the messages that the phone apps are sending, create a dummy flow with a trigger card that contains owntracks/# as topic. 

    Subscribing to that topic means that all topics beginning with owntracks/  are being received. The app itself will not trigger the card because it does not recognize the # wildcard (and will not because it will get triggered with every lon/lat change). 

    But you will see all messages that are received in the log. Besides that, I have uploaded a new version for approval that includes the userid addition. 
  • nope it is all not working, Mosquitto is not starting with the 3 extra lines in the config.
    Have mosquitto 1.4.9-5

  • is the admin account active on your nas?

    i do not know if with -i you have root acces
  • mbalik79mbalik79 Member
    edited February 2017
    I can change and save everything, but when I add the 3lines in the config Mosquitto would not start anymore.
    Could it be that I have an other version of Mosquitto?



  • reboot you nas
  • do you have reboot your nas?
    and by actie activeren ?
  • it's rebooting again

  • mbalik79 said:
    it's rebooting again

    Yup, but mosquitto is not starting with the 3 lines in the config-file
    have to putt
     listener 9001 [ip-adres]
     listener 1883 [ip-adres]
     protocol websockets

    Here is an articel  http://jpmens.net/2014/07/03/the-mosquitto-mqtt-broker-gets-websockets-support/


  • mbalik79 said:
    you need to do this:

    2) execute: cd /var/packages/mosquitto/scripts

    3) sudo vi start-stop-status (you need to be root, hence the sudo), give your admin password when requested

    4) using vi, comment the line which declares the USER such that it reads:

    #USER="mosquitto"

    So change

    USER="mosquitto"

    to

    #USER="mosquitto"


  • it's starting, but I add the following lines

    listener 9001 ip-adres
    listener 1883 ip-adres
    protocols websockets

  • i have the lines without ip adress.
    found it somewhere on the internet.
    hope it work for you

  • I will try tomorrow...thanks for all the help! You guys are the best !
  • @Ingmar if you want to see all the messages that the phone apps are sending, create a dummy flow with a trigger card that contains owntracks/# as topic. 

    Subscribing to that topic means that all topics beginning with owntracks/  are being received. The app itself will not trigger the card because it does not recognize the # wildcard (and will not because it will get triggered with every lon/lat change). 

    But you will see all messages that are received in the log. Besides that, I have uploaded a new version for approval that includes the userid addition. 
    Brilliant! Will check asap! Thanks,
  • mbalik79 said:
    it's starting, but I add the following lines

    listener 9001 ip-adres
    listener 1883 ip-adres
    protocols websockets

    There is no need to add those on Synology, if you read the config file you can see those are already in there..
  • EternityEternity Member
    edited February 2017
    I am not receiving updates. I installed the server on my NAS, the App on my android phone and on my sons Apple 6. After an hour in the App on my phone, I saw where my sons Apple was. Great! I too saw my updated location. Everything seems to work nicely. 

    However, after that check, no location updates where delivered or seen of either phone... Only if I switch on GPS on my phone, I get my current location in the App. But, it worked without GPS on my phone and my sons 6 phone too. 

    So, what could cause it to be broken after a successful start? 
  • tweaqer said:
    mbalik79 said:
    it's starting, but I add the following lines

    listener 9001 ip-adres
    listener 1883 ip-adres
    protocols websockets

    There is no need to add those on Synology, if you read the config file you can see those are already in there..
    Ok, thanks. I will give it a try when I have some spare time.

  • Now I get this... App on the android phone says connected, but still no report received (i think)

Sign In or Register to comment.