[RELEASE] Life360 - With Added Refresh Command & More


(www.smartukhome.co.uk) #1

This has been available for sometime in the topic about Life360 not being reliable.
But recently @btrial added some more features and I feel more people should know about it

  • distance from your chosen place (can be used in webCore),
  • sleep / awake status (can be used in webCore)
  • last location update date/time

Ideas and some code snippets taken from webCore presence sensor by @ady624 (so praise goes to him)

Install - Very Important
Even though the code is the same as the official Life360 you cant just install this code and expect it to work, SmartThings will just continue to use the official code. You will have to completely remove the Official App and Devices before you can install using this code & enable OAuth

Owner: tmleafs
Name: life360-smartthings-refresh
Branch: master

Now the idea is to use webCore to monitor the Life360 for inconsistencies and then fire the refresh if needed for example @sdbg posted this yesterday as a example


If you don’t have a another presence sensor to compare to you could fire the refresh every day at set times for example


Life360 Presence Setup and Multiple Circles
(Michael Deffendall) #2

One more to add to my ‘find time to check it out’ list. :grin:


(Michael Deffendall) #3

And when I try to install it after adding the SmartApp via IDE, I get an unexpected error trying to add my Life360 users :frowning:

Solved and thank you!:


(John) #4

Can you explain how Life360 is not reliable? I find that it’s extremely reliable and accurate. Wondering, as I’m looking to use Life360 to automate the Home/Away mode changes.


#5

I’m curious for the same reason. Never had a blip with it.


(www.smartukhome.co.uk) #6

My guess is you haven’t published the life360 user DH or not enabled OAuth on the app
If not post some IDE logs


(www.smartukhome.co.uk) #7

Just look at the mount of posts about life360 https://community.smartthings.com/search?q=life360

It was more a thing in mid 2016 when I originally made this. Some people no longer have the problem, even I no longer have but thats because we have better phones and 4G signal than we had in 2016, but it was also due to Life360 breaking the app too. Back in mid 2016 early 2017 once or twice a week life360 didn’t work correctly. This is the main thread at the time Life360 seems to send notifications properly, but presence status not updated? moaning about the problems of life360 at the time.


(Paul James) #8

This is working nice for me. I made a small change and changed it from reporting Km to miles from home on the tile.


(www.smartukhome.co.uk) #9

Can you send me what you have changed I could possibly make it so a user can change it the settings


(Michael Deffendall) #10

And you would be correct. Didn’t realize it had a DH as well. :slight_smile: Thank you!


(Matthew) #11

I would like that ability too. You can change the SmartApp where is calculates the distance by dividing the result by 1.609344 to convert the Km to Miles. Or, you can do it in the DTH by dividing the result by the same 1.609344. Either way the DTH still needs to be updated as it is ‘hardcoded’ as ‘km from: home’ and I changed that to ‘mi from: home.’ Could you add in a user selectable option for Km or Miles and then make that conversion and text label change based on their selection?

Great work. Thanks.


(Michael Deffendall) #12

Thank you for this! Using webCoRE, I was able to use the distance metric from a Life360 user and stored it to a global variable and then set it into a virtual temperature sensor. That in turn allowed me to add my new virtual temperature sensor to my ActionTiles Tablet.


(www.smartukhome.co.uk) #13

@Paul_James @scottma61 @Michael_Deffendall

I have added a user switch for the distance display in miles or km

I have also added distanceKm & distanceMiles attribute theses are all ways updated doesn’t matter on the display switch


(Matthew) #14

The actual miles was showing, but the text still showed “km from Home:”. I looked at the DTH code and altered it to this:

    if(units == "Kilometers" || units == null || units == "")
	    def status = sprintf("%.2f", homeDistance / 1000) + " km from: Home"
    else
	    def status = sprintf("%.2f", (homeDistance / 1000) / 1.609344) + " Miles from: Home"

    sendEvent( name: "status", value: status, isStateChange: true, displayed: false )

It works now. Can you take a look and see if this is the correct way to do it?

Thanks again.


(www.smartukhome.co.uk) #15

That’s the way I originally had it and it should work but for me it isn’t

I get just get status with that code
Screenshot_20180128-190830 (Small)


(Matthew) #16

My Error. I did not re-run the SmartApp to recreate the devices after I updated the code. When I reverted to your code and did that everything works as expected. Sorry for my oversight and thanks again for this.


(Bob) #17

Since the recent app update I’m getting a ? appear in the main tile.
Anyone else seeing this?


(www.smartukhome.co.uk) #18

I’m getting the same are your on android, I feel this is a might be the app rather than my code as It cant just stop working. @btrial what you think?

Anyone on iOS wanna let me know if its working


#19

(Bartek) #20

I also see “?” on Android, instead of icons. It was working properly before.

As @Nezmo pointed, there is missing type:“generic”.
I have pushed an update to my repo and yours @tmleafs,
meantime you see on the screenshot attached, what and where to add it.