pnbruckner / life360

A simple python life360 client
MIT License
16 stars 6 forks source link

Update API configuration #10

Closed pantherale0 closed 6 months ago

pantherale0 commented 6 months ago

This updates the user agent and associated API endpoints to resolve https://github.com/home-assistant/core/issues/105816?

dcmeglio commented 6 months ago

I tried applying your changes manually in HA and I now get: a 404 when it tries to load the places endpoint: 2023-12-20 18:42:32.127 DEBUG (MainThread) [life360.api] Error GET(https://api-cloudfront.life360.com/v4/circles/REDACTED/places), attempt 1: ClientResponseError(RequestInfo(url=URL('https://api-cloudfront.life360.com/v4/circles/REDACTED/places'), ... status=404, message='Not Found'

dcmeglio commented 6 months ago

The members and places endpoints might be in v3, not v4

pantherale0 commented 6 months ago

They might be, I need to look over the proxy logs again to see.

I know it pulls the circles from v4, but some requests are v5, V6 etc (hence my comment in the core issue about the API being messy).

I'm hoping if we can get this to work with a recent version of the mobile app, we'll stand a good chance "long term".

dcmeglio commented 6 months ago

I added the following and it now loads properly in HA. Obviously I haven't tested every workflow but it initializes and detects location status again.

_CIRCLE_URL_FMT_V3 = f"{_BASE_CMD_V3}circles/{{circle_id}}"
_CIRCLE_MEMBERS_URL_FMT = f"{_CIRCLE_URL_FMT_V3}/members"
_CIRCLE_PLACES_URL_FMT = f"{_CIRCLE_URL_FMT_V3}/places"
JeedHome44 commented 6 months ago

I added the following and it now loads properly in HA. Obviously I haven't tested every workflow but it initializes and detects location status again.


_CIRCLE_URL_FMT_V3 = f"{_BASE_CMD_V3}circles/{{circle_id}}"

_CIRCLE_MEMBERS_URL_FMT = f"{_CIRCLE_URL_FMT_V3}/members"

_CIRCLE_PLACES_URL_FMT = f"{_CIRCLE_URL_FMT_V3}/places"

good job! It's work for me too !

pnbruckner commented 6 months ago

@dcmeglio thank you!

Starting from the last commit from @pantherale0 in this PR, and changing only this line back to V3 seems to make everything work:

_CIRCLE_URL_FMT = f"{_BASE_CMD_V3}circles/{{circle_id}}"

I'll suggest that change in the PR review.

jcarlier commented 6 months ago

if I understood correctly, while waiting for 2023.12.4 you need to restore life360 (https://github.com/pantherale0/life360/tree/a8acbefdd3b75edd6af6e7df81f3a57649ef21af) in the /homeassistant directory (same level as 'custom_components') and then restart??????

pdecker414 commented 6 months ago

if I understood correctly, while waiting for 2023.12.4 you need to restore life360 (https://github.com/pantherale0/life360/tree/a8acbefdd3b75edd6af6e7df81f3a57649ef21af) in the /homeassistant directory (same level as 'custom_components') and then restart??????

I made the changes as listed and got mine working again until they release so I am happy. It really wasn't too many lines to fix. Thank you to the Dev for working on this so quickly. I use it to keep an eye on my teanage son with notifications if he goes outside of areas we have allowed.

pnbruckner commented 6 months ago

@jcarlier there are a couple of different workarounds that have been suggested. This is not the place to ask about those. Please check the HA community forum or discord. There are plenty of posts with details and people who can help with your exact install configuration.