diff --git a/changelog b/changelog index b1536fdf..addfceb1 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ aarlo/pyaarlo +0.7.4b17: + Play catch up with Arlo. 0.7.4b16: Fix auth headers. 0.7.4b15: diff --git a/custom_components.json b/custom_components.json index 5b4582c2..735662f8 100644 --- a/custom_components.json +++ b/custom_components.json @@ -1,6 +1,6 @@ { "aarlo": { - "version": "0.7.4b16", + "version": "0.7.4b17", "local_location": "/custom_components/aarlo/__init__.py", "remote_location": "https://raw.githubusercontent.com/twrecked/hass-aarlo/master/custom_components/aarlo/__init__.py", "visit_repo": "https://github.com/twrecked/hass-aarlo", @@ -18,7 +18,7 @@ ] }, "pyaarlo": { - "version": "0.7.4b16", + "version": "0.7.4b17", "local_location": "/custom_components/aarlo/pyaarlo/__init__.py", "remote_location": "https://raw.githubusercontent.com/twrecked/hass-aarlo/master/custom_components/aarlo/pyaarlo/__init__.py", "visit_repo": "https://github.com/twrecked/hass-aarlo", diff --git a/custom_components/aarlo/__init__.py b/custom_components/aarlo/__init__.py index 070f0bb8..f255282f 100644 --- a/custom_components/aarlo/__init__.py +++ b/custom_components/aarlo/__init__.py @@ -33,7 +33,7 @@ SIREN_STATE_KEY ) -__version__ = "0.7.4b16" +__version__ = "0.7.4b17" _LOGGER = logging.getLogger(__name__) diff --git a/custom_components/aarlo/manifest.json b/custom_components/aarlo/manifest.json index 37f1a08c..22869307 100644 --- a/custom_components/aarlo/manifest.json +++ b/custom_components/aarlo/manifest.json @@ -6,6 +6,6 @@ "dependencies": ["ffmpeg"], "codeowners": ["@twrecked"], "requirements": ["unidecode","cloudscraper>=1.2.71", "paho-mqtt"], - "version": "0.7.4b16", + "version": "0.7.4b17", "iot_class": "cloud_push" } diff --git a/custom_components/aarlo/pyaarlo/__init__.py b/custom_components/aarlo/pyaarlo/__init__.py index 51431317..e01416d8 100644 --- a/custom_components/aarlo/pyaarlo/__init__.py +++ b/custom_components/aarlo/pyaarlo/__init__.py @@ -44,7 +44,7 @@ _LOGGER = logging.getLogger("pyaarlo") -__version__ = "0.7.4b16" +__version__ = "0.7.4b17" class PyArlo(object): diff --git a/custom_components/aarlo/pyaarlo/backend.py b/custom_components/aarlo/pyaarlo/backend.py index 8ab36d55..1f2578b5 100644 --- a/custom_components/aarlo/pyaarlo/backend.py +++ b/custom_components/aarlo/pyaarlo/backend.py @@ -521,7 +521,7 @@ def _sse_main(self): self._event_client = SSEClient( self._arlo, self._arlo.cfg.host + SUBSCRIBE_PATH, - session=self._session, + headers=self._headers(), reconnect_cb=self._sse_reconnected, ) else: @@ -533,7 +533,7 @@ def _sse_main(self): self._event_client = SSEClient( self._arlo, self._arlo.cfg.host + SUBSCRIBE_PATH, - session=self._session, + headers=self._headers(), reconnect_cb=self._sse_reconnected, timeout=self._arlo.cfg.stream_timeout, ) @@ -646,13 +646,43 @@ def _auth_headers(self): "Accept": "application/json, text/plain, */*", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "en-GB,en;q=0.9,en-US;q=0.8", + "Cache-Control": "no-cache", "Origin": ORIGIN_HOST, + "Pragma": "no-cache", "Referer": REFERER_HOST, + # "Sec-Ch-Ua": '"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"', + # "Sec-Ch-Ua-Mobile": "?0", + # "Sec-Ch-Ua-Platform": "Linux", + # "Sec-Fetch-Dest": "empty", + # "Sec-Fetch-Mode": "cors", + # "Sec-Fetch-Site": "same-site", "Source": "arloCamWeb", "User-Agent": self._user_agent, - "x-user-device-id": self._user_device_id, - "x-user-device-automation-name": "QlJPV1NFUg==", - "x-user-device-type": "BROWSER", + "X-User-Device-Automation-name": "QlJPV1NFUg==", + "X-User-Device-Id": self._user_device_id, + "X-User-Device-Type": "BROWSER", + } + + def _headers(self): + return { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate, br", + "Accept-Language": "en-GB,en;q=0.9,en-US;q=0.8", + "Auth-Version": "2", + "Authorization": self._token, + "Cache-Control": "no-cache", + "Content-Type": "application/json; charset=utf-8;", + "Origin": ORIGIN_HOST, + "Pragma": "no-cache", + "Referer": REFERER_HOST, + # "SchemaVersion": "1", + # "Sec-Ch-Ua": '"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"', + # "Sec-Ch-Ua-Mobile": "?0", + # "Sec-Ch-Ua-Platform": "Linux", + # "Sec-Fetch-Dest": "empty", + # "Sec-Fetch-Mode": "cors", + # "Sec-Fetch-Site": "same-site", + "User-Agent": self._user_agent, } def _auth(self): @@ -834,19 +864,7 @@ def _login(self): self._arlo.debug("newish sessions, re-using") # update sessions headers - headers = { - "Accept": "application/json", - "Accept-Encoding": "gzip, deflate, br", - "Accept-Language": "en-GB,en;q=0.9,en-US;q=0.8", - "Auth-Version": "2", - "Authorization": self._token, - "Content-Type": "application/json; charset=utf-8;", - "Origin": ORIGIN_HOST, - "Pragma": "no-cache", - "Referer": REFERER_HOST, - "SchemaVersion": "1", - "User-Agent": self._user_agent, - } + headers = self._headers() self._session.headers.update(headers) # Grab a session. Needed for new session and used to check existing