Hello guys,
I recently start to use GPSTracker due the IFTTT Problems.
And I have a few question that can’t be sloved by searching or looking up the OwnTracks Binding page, And believe me I tried.
I just want to simply make a rule when every time I arrive to my home, It will turn on a switch.
Of course OwnTracks is installed on my phone and have a full sync with openhab with no problem, I just dont know what to do from here.
Edit: I post that I need help with GPSTracker, and I got confue, it’s OwnTracks.
You will need to add a channel to your thing of type distance. This is the region for your home. Once configured. Add your switch item to the Region Trigger section. Once added a second box will pop up where you can link the distance channel you added before.
This switch is on if you are in region. Home or Away. From there you can trigger a rule off that switch to do whatever logic you want.
so you want a rule which triggers off the atHomeEX switch
Try something like this.
rule "Turn Switch On when Home"
when
Item atHomeEX received command
then
if (atHomeEX.state == ON)
{
mySwitch.sendCommand(ON)
}
else if (atHomeEX.state == OFF)
{
mySwitch.sendCommand(OFF)
}
end
Thank you Chris, I will check that, Just last question, the GPSTracker App, its need to be open on my device? I want it to be automaticly when I arrive home , with out open the app, do I need to something special?
Oh, god I am using Owntracks as well, my bad, so you saying it’s it’s persistent notification to stop it from closing, and on the main page, should I leave it on Play, pause/play, Stop, or Pause?
you want last reported location under ongoing notifications turned on. I have it on the Play icon, which is significant changes monitoring mode. owntracks docs are here https://owntracks.org/booklet/
I’ve those settings as well, and i’ts not working.
Any idea?, and do I need " OwnTracks (formerly MQTTitude) Binding (1.x) " binding?
Rules:
rule “Turn Switch On when Home”
when
Item atHomeEX received command
then
if (atHomeEX.state == ON)
{
sendBroadcastNotification(“CHECK”)
}
else if (atHomeEX.state == OFF)
{
sendBroadcastNotification(“TEST”)
}
end
You dont need the mqtt binding if you are using gpstracker binding.
Ok you are falling foul of the item state being updated after the command is received.
Try this…
rule “Turn Switch On when Home”
when
Item atHomeEX received command
then
if (receivedCommand == ON)
{
sendBroadcastNotification(“CHECK”)
}
else if (receivedCommand == OFF)
{
sendBroadcastNotification(“TEST”)
}
end
I know you’ve said that OwnTracks is working on your phone, but is it properly setup to still work when away from your home/the host network? If not then with the rules above you’ll never trigger the atHomeEX.state==OFF.
It would help you to add some logging to the rule to see what, if anything is changing.
"but is it properly setup to still work when away from your home/the host network? " I am not sure I setup it properly. How can I check, and what about that “atHomeEX.state==OFF” ?
If you turn off the wifi on your phone can Owntracks still connect to the broker you set up on your home network? If not then when owntracks notices you’ve left your home location it won’t be able to send a message to say so, which in turn means no rule will fire in OH.
Have you set up a reverse proxy like nginx? Or do you use a dynamic DNS service with port forwarding? There are a few different ways to allow owntracks to connect to openhab no matter where you are.