python-tado 0.18.9__tar.gz → 0.18.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_tado-0.18.9/python_tado.egg-info → python_tado-0.18.11}/PKG-INFO +3 -2
- {python_tado-0.18.9 → python_tado-0.18.11}/PyTado/http.py +8 -6
- {python_tado-0.18.9 → python_tado-0.18.11}/PyTado/interface/api/hops_tado.py +1 -1
- {python_tado-0.18.9 → python_tado-0.18.11}/pyproject.toml +1 -1
- {python_tado-0.18.9 → python_tado-0.18.11/python_tado.egg-info}/PKG-INFO +3 -2
- {python_tado-0.18.9 → python_tado-0.18.11}/tests/test_http.py +4 -4
- {python_tado-0.18.9 → python_tado-0.18.11}/AUTHORS +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/LICENSE +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/PyTado/__init__.py +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/PyTado/__main__.py +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/PyTado/const.py +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/PyTado/exceptions.py +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/PyTado/interface/__init__.py +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/PyTado/interface/api/__init__.py +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/PyTado/interface/api/my_tado.py +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/PyTado/interface/interface.py +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/PyTado/logger.py +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/PyTado/zone/__init__.py +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/PyTado/zone/hops_zone.py +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/PyTado/zone/my_zone.py +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/README.md +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/python_tado.egg-info/SOURCES.txt +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/python_tado.egg-info/dependency_links.txt +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/python_tado.egg-info/entry_points.txt +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/python_tado.egg-info/not-zip-safe +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/python_tado.egg-info/requires.txt +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/python_tado.egg-info/top_level.txt +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/setup.cfg +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/tests/test_hops_zone.py +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/tests/test_my_tado.py +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/tests/test_my_zone.py +0 -0
- {python_tado-0.18.9 → python_tado-0.18.11}/tests/test_tado_interface.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: python-tado
|
|
3
|
-
Version: 0.18.
|
|
3
|
+
Version: 0.18.11
|
|
4
4
|
Summary: PyTado from chrism0dwk, modfied by w.malgadey, diplix, michaelarnauts, LenhartStephan, splifter, syssi, andersonshatch, Yippy, p0thi, Coffee2CodeNL, chiefdragon, FilBr, nikilase, albertomontesg, Moritz-Schmidt, palazzem
|
|
5
5
|
Author-email: Chris Jewell <chrism0dwk@gmail.com>, "w.malgadey" <w.malgadey@gmail.com>, FilBr <filippo.barba@protonmail.com>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
@@ -707,6 +707,7 @@ Requires-Dist: pytest; extra == "dev"
|
|
|
707
707
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
708
708
|
Provides-Extra: all
|
|
709
709
|
Requires-Dist: python-tado[dev]; extra == "all"
|
|
710
|
+
Dynamic: license-file
|
|
710
711
|
|
|
711
712
|
# PyTado -- Pythonize your central heating
|
|
712
713
|
|
|
@@ -8,7 +8,7 @@ import logging
|
|
|
8
8
|
import os
|
|
9
9
|
import pprint
|
|
10
10
|
import time
|
|
11
|
-
from datetime import datetime, timedelta
|
|
11
|
+
from datetime import datetime, timedelta, timezone
|
|
12
12
|
from json import dump as json_dump
|
|
13
13
|
from json import load as json_load
|
|
14
14
|
from pathlib import Path
|
|
@@ -174,7 +174,7 @@ class Http:
|
|
|
174
174
|
else:
|
|
175
175
|
_LOGGER.setLevel(logging.WARNING)
|
|
176
176
|
|
|
177
|
-
self._refresh_at = datetime.now() + timedelta(minutes=10)
|
|
177
|
+
self._refresh_at = datetime.now(timezone.utc) + timedelta(minutes=10)
|
|
178
178
|
self._session = http_session or self._create_session()
|
|
179
179
|
self._session.hooks["response"].append(self._log_response)
|
|
180
180
|
self._headers = {"Referer": "https://app.tado.com/"}
|
|
@@ -347,7 +347,7 @@ class Http:
|
|
|
347
347
|
refresh_token = data["refresh_token"]
|
|
348
348
|
|
|
349
349
|
self._token_refresh = refresh_token
|
|
350
|
-
self._refresh_at = datetime.now()
|
|
350
|
+
self._refresh_at = datetime.now(timezone.utc)
|
|
351
351
|
self._refresh_at = self._refresh_at + timedelta(seconds=expires_in)
|
|
352
352
|
# We subtract 30 seconds from the correct refresh time.
|
|
353
353
|
# Then we have a 30 seconds timespan to get a new refresh_token
|
|
@@ -397,7 +397,7 @@ class Http:
|
|
|
397
397
|
and force_refresh is False.
|
|
398
398
|
"""
|
|
399
399
|
|
|
400
|
-
if self._refresh_at >= datetime.now() and not force_refresh:
|
|
400
|
+
if self._refresh_at >= datetime.now(timezone.utc) and not force_refresh:
|
|
401
401
|
return True
|
|
402
402
|
|
|
403
403
|
url = "https://login.tado.com/oauth2/token"
|
|
@@ -504,7 +504,7 @@ class Http:
|
|
|
504
504
|
_LOGGER.info("Please visit the following URL: %s", visit_url)
|
|
505
505
|
|
|
506
506
|
expires_in_seconds = self._device_flow_data["expires_in"]
|
|
507
|
-
self._expires_at = datetime.now() + timedelta(seconds=expires_in_seconds)
|
|
507
|
+
self._expires_at = datetime.now(timezone.utc) + timedelta(seconds=expires_in_seconds)
|
|
508
508
|
|
|
509
509
|
_LOGGER.info(
|
|
510
510
|
"Waiting for user to authorize the device. Expires at %s",
|
|
@@ -514,7 +514,9 @@ class Http:
|
|
|
514
514
|
return DeviceActivationStatus.PENDING
|
|
515
515
|
|
|
516
516
|
def _check_device_activation(self) -> bool:
|
|
517
|
-
if self._expires_at is not None and datetime.timestamp(datetime.now()) > datetime.timestamp(
|
|
517
|
+
if self._expires_at is not None and datetime.timestamp(datetime.now(timezone.utc)) > datetime.timestamp(
|
|
518
|
+
self._expires_at
|
|
519
|
+
):
|
|
518
520
|
raise TadoException("User took too long to enter key")
|
|
519
521
|
|
|
520
522
|
# Await the desired interval, before polling the API again
|
|
@@ -62,7 +62,7 @@ class TadoX(Tado):
|
|
|
62
62
|
for device in devices:
|
|
63
63
|
request = TadoXRequest()
|
|
64
64
|
request.domain = Domain.DEVICES
|
|
65
|
-
request.device = device["
|
|
65
|
+
request.device = device["serialNumber"]
|
|
66
66
|
device.update(self._http.request(request))
|
|
67
67
|
|
|
68
68
|
if "otherDevices" in rooms_and_devices:
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "python-tado"
|
|
7
|
-
version = "0.18.
|
|
7
|
+
version = "0.18.11"
|
|
8
8
|
description = "PyTado from chrism0dwk, modfied by w.malgadey, diplix, michaelarnauts, LenhartStephan, splifter, syssi, andersonshatch, Yippy, p0thi, Coffee2CodeNL, chiefdragon, FilBr, nikilase, albertomontesg, Moritz-Schmidt, palazzem"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "Chris Jewell", email = "chrism0dwk@gmail.com" },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: python-tado
|
|
3
|
-
Version: 0.18.
|
|
3
|
+
Version: 0.18.11
|
|
4
4
|
Summary: PyTado from chrism0dwk, modfied by w.malgadey, diplix, michaelarnauts, LenhartStephan, splifter, syssi, andersonshatch, Yippy, p0thi, Coffee2CodeNL, chiefdragon, FilBr, nikilase, albertomontesg, Moritz-Schmidt, palazzem
|
|
5
5
|
Author-email: Chris Jewell <chrism0dwk@gmail.com>, "w.malgadey" <w.malgadey@gmail.com>, FilBr <filippo.barba@protonmail.com>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
@@ -707,6 +707,7 @@ Requires-Dist: pytest; extra == "dev"
|
|
|
707
707
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
708
708
|
Provides-Extra: all
|
|
709
709
|
Requires-Dist: python-tado[dev]; extra == "all"
|
|
710
|
+
Dynamic: license-file
|
|
710
711
|
|
|
711
712
|
# PyTado -- Pythonize your central heating
|
|
712
713
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Test the Http class."""
|
|
2
2
|
|
|
3
|
-
from datetime import datetime, timedelta
|
|
3
|
+
from datetime import datetime, timedelta, timezone
|
|
4
4
|
import io
|
|
5
5
|
import json
|
|
6
6
|
import unittest
|
|
@@ -151,7 +151,7 @@ class TestHttp(unittest.TestCase):
|
|
|
151
151
|
)
|
|
152
152
|
|
|
153
153
|
# Force token refresh
|
|
154
|
-
instance._refresh_at = datetime.now() - timedelta(seconds=1)
|
|
154
|
+
instance._refresh_at = datetime.now(timezone.utc) - timedelta(seconds=1)
|
|
155
155
|
instance._refresh_token()
|
|
156
156
|
|
|
157
157
|
assert refresh_token.call_count == 1
|
|
@@ -174,7 +174,7 @@ class TestHttp(unittest.TestCase):
|
|
|
174
174
|
)
|
|
175
175
|
|
|
176
176
|
# Force token refresh
|
|
177
|
-
instance._refresh_at = datetime.now() - timedelta(seconds=1)
|
|
177
|
+
instance._refresh_at = datetime.now(timezone.utc) - timedelta(seconds=1)
|
|
178
178
|
|
|
179
179
|
with self.assertRaises(TadoException):
|
|
180
180
|
instance._refresh_token()
|
|
@@ -221,7 +221,7 @@ class TestHttp(unittest.TestCase):
|
|
|
221
221
|
|
|
222
222
|
http = Http()
|
|
223
223
|
http._device_flow_data = {"interval": 5, "device_code": "mock_code"}
|
|
224
|
-
http._expires_at = datetime.now() + timedelta(minutes=5)
|
|
224
|
+
http._expires_at = datetime.now(timezone.utc) + timedelta(minutes=5)
|
|
225
225
|
|
|
226
226
|
result = http._check_device_activation()
|
|
227
227
|
self.assertTrue(result)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|