Getting Current Mobile Location (Lat/Lon)?

Is there a way via a ST Smartapp to obtain the current lat/lon of the ST registered mobile or Life360?

Using the Presences Android mobile and Life360, I have developed my own presence app that triggers certain events once the set Presences arrive Overall, it works fine when I am driving and I hit my “Home Circle” but my problem is when I am walking, Even though I may be as far as a block away as soon as I walk into the “Home Circle” (set a small as possible) the event “Presence arrived” occurs. Initially, I overcame this problem by calling Tasker (Get Location) to obtain current Lat/Lon and calculating the number of feet from my home.Tasker takes an eternity to obtain the location. Simply not practical.

I need a means to get the lat/lon directly within my smartapp. Is there a means to do this? (i.e. obtain them from Presence Life360)

Does Life 360 have a Cloud-Cloud API (or is it already in a Device Type Handler?).

I have some privacy concerns, but modifying the Device Type might work.

I’m just not sure it’s the best way to solve the issue you describe…

1 Like

Yup… Life360 User. I briefly looked at it but not sure how one can pick lat/lon out of it :frowning:

My recommendation from an “architecture” point of view is not to expose lat/lon directly, but create a new Presence Device Type that allows tuning the parameters and granularity of control.

Do you have a link to the Life 360 Device Type Handler?

 *  Copyright 2015 SmartThings
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *  Life360-User
 *  Author: jeff
 *  Date: 2013-08-15
metadata {
	definition (name: "Life360 User", namespace: "smartthings", author: "SmartThings") {
		capability "Presence Sensor"
		capability "Sensor"

	simulator {
		status "present": "presence: 1"
		status "not present": "presence: 0"

	tiles {
		standardTile("presence", "device.presence", width: 2, height: 2, canChangeBackground: true) {
			state("present", labelIcon:"", backgroundColor:"#53a7c0")
			state("not present", labelIcon:"", backgroundColor:"#ffffff")

		main "presence"
		details "presence"

def generatePresenceEvent(boolean present) {
	log.debug "Here in generatePresenceEvent!"
	def value = formatValue(present)
	def linkText = getLinkText(device)
	def descriptionText = formatDescriptionText(linkText, present)
	def handlerName = getState(present)

	def results = [
		name: "presence",
		value: value,
		unit: null,
		linkText: linkText,
		descriptionText: descriptionText,
		handlerName: handlerName
	log.debug "Generating Event: ${results}"
	sendEvent (results)

def setMemberId (String memberId) {
   log.debug "MemberId = ${memberId}"
   state.life360MemberId = memberId

def getMemberId () {

	log.debug "MemberId = ${state.life360MemberId}"

private String formatValue(boolean present) {
	if (present)
    	return "present"
    	return "not present"

private formatDescriptionText(String linkText, boolean present) {
	if (present)
		return "Life360 User $linkText has arrived"
    	return "Life360 User $linkText has left"

private getState(boolean present) {
	if (present)
		return "arrived"
    	return "left"
1 Like

Is there a Service Manager SmartApp to go along with that Device Type Handler?

Not sure what a Service Manager Smartapp is. :frowning: However… No specific app was installed when I added Life360 as a presence device to ST. At least none that appears under my SmartApps tab

I’m looking into this more deeply and will get back shortly… : Life360 is definitely serviced by a service manager (“Connect”) SmartApp

I stand corrected :blush:


Indeed, the Life360 User Device Type is served by a this Service Manager SmartApp (presuming the SmartThings public repository is up to date…)…

This SmartApp has access to "latitude, longitude" internally

NB: Notice that the sensitivity radius reference place.radius, which is fetched from Life 360 and stored in SmartApp.state

Here is the internal SmartApp.state[] as viewed in the IDE:
[{id=a6bxxx2-6xxx5e2-xxxx-81d8-478d1262b48d, ownerId=c2xxxxx-2aaa-4652-9b18-0xxxx2e10, name=75 MyStreet Ave, 90210, longitude=-99.438197, radius=152.4, latitude=99.111138, typeLabel=Other, type=1, circleId=924bb839-93c4-4fb7-901d-fb57d87cfc0a}, {id=f7bdcd55-5d02-4819-9286-a918ec677d6f, ownerId=c2bbeae2-2aaa-4652-9b18-07fa9a1a2e10, name=Home, longitude=-99.11101, radius=152.4, latitude=99.111772, typeLabel=Other, type=1, circleId=924bb839-93c4-4fb7-901d-fb57d87cfc0a}]

Also note the only information this SmartApp sends to the Child Devices (“Life 360 User” instances) is: generatePresenceEvent(presenceState) – search the SmartApp sourcecode and see if I’m correct.

Now this is the “correct” way to do things, except that you believe it would be helpful to have a *tighter radius around a “place”. There are two “good ways” this could be done:

  1. Life360 needs to have that option in their system’s profile for you and each “place”.
  2. The Life360 SmartApp needs to permit the input of a custom radius for SmartThings (i.e., as a parameter to/from each Child Device)

##What Next?

  • I don’t know enough about Life360 at this moment to know if you can set a tighter “radius” that would be stored and shared by their API.
  • I don’t think you can’t just copy and modify (hack) the Connect SmartApp because you need API keys for it to access Life360 (but that’s worth looking into … i.e., is there a Community modified version of the SmartApp available?).
  • Perhaps it is not difficult to get a “developer API key” from Life360 which would permit you to create a new version of Life360 for SmartThings using the current SmartApp as a great starting point.

Let me know your thoughts / questions…!

@cdikland … bump! Any thoughts on this?

I have not given it a lot of thoughts as the idea of creating a new version of life360 sounds scary :scream:Not sure that would be within my ability let alone time :slightly_smiling:
I have found a faster way to get the lat/lon from Tasker within the “Get Location” action by reducing the Timeout to 10s. I guess this means less accurate results but it might be acceptable. The issue is the time. Even 10+ seconds added to the time before life360 is within the circle is annoying. My presence sensors have notified me we have arrived yet my smartapp is waiting for Tasker to confirm we are within 100’ The wait seems an eternity :slightly_smiling:

Found this from the dead and thinking how useful it would be if I could even get a “location” update from Life360 in smartthings. Meaning an update when a person arrives and leaves a place already defined in Life360 (since that is already there and working) then Smartthings would know when my son gets to or leaves “school” has anyone figured this out?

You can do this in SmartThings, but I don’t know if it would be part of life 360. But smartthings will let you set up a location that doesn’t have a hub in it and react to that. The example usually given is to have one location for your office and one for your home, where only your home has a hub.

However, this thread is not the place to ask that, because the answer you are looking for is going to be very different from the coding answers that would fit this thread.

Start your own thread in the following forum category and ask your question there and hopefully someone will be able to help you.