python-tado 0.18.6__tar.gz → 0.19.0__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.
Files changed (36) hide show
  1. python_tado-0.19.0/PKG-INFO +205 -0
  2. {python_tado-0.18.6 → python_tado-0.19.0}/PyTado/__main__.py +7 -22
  3. {python_tado-0.18.6 → python_tado-0.19.0}/PyTado/const.py +5 -12
  4. python_tado-0.19.0/PyTado/http.py +442 -0
  5. {python_tado-0.18.6 → python_tado-0.19.0}/PyTado/interface/__init__.py +2 -0
  6. {python_tado-0.18.6 → python_tado-0.19.0}/PyTado/interface/api/__init__.py +2 -0
  7. {python_tado-0.18.6 → python_tado-0.19.0}/PyTado/interface/api/hops_tado.py +63 -37
  8. {python_tado-0.18.6 → python_tado-0.19.0}/PyTado/interface/api/my_tado.py +15 -45
  9. {python_tado-0.18.6 → python_tado-0.19.0}/PyTado/interface/interface.py +38 -21
  10. python_tado-0.19.0/PyTado/logger.py +24 -0
  11. {python_tado-0.18.6 → python_tado-0.19.0}/PyTado/zone/__init__.py +2 -0
  12. {python_tado-0.18.6 → python_tado-0.19.0}/PyTado/zone/hops_zone.py +17 -34
  13. {python_tado-0.18.6 → python_tado-0.19.0}/PyTado/zone/my_zone.py +34 -81
  14. {python_tado-0.18.6 → python_tado-0.19.0}/README.md +48 -13
  15. python_tado-0.19.0/pyproject.toml +74 -0
  16. python_tado-0.18.6/PKG-INFO +0 -840
  17. python_tado-0.18.6/PyTado/http.py +0 -351
  18. python_tado-0.18.6/PyTado/logger.py +0 -50
  19. python_tado-0.18.6/pyproject.toml +0 -309
  20. python_tado-0.18.6/python_tado.egg-info/PKG-INFO +0 -840
  21. python_tado-0.18.6/python_tado.egg-info/SOURCES.txt +0 -30
  22. python_tado-0.18.6/python_tado.egg-info/dependency_links.txt +0 -1
  23. python_tado-0.18.6/python_tado.egg-info/entry_points.txt +0 -2
  24. python_tado-0.18.6/python_tado.egg-info/not-zip-safe +0 -1
  25. python_tado-0.18.6/python_tado.egg-info/requires.txt +0 -16
  26. python_tado-0.18.6/python_tado.egg-info/top_level.txt +0 -1
  27. python_tado-0.18.6/setup.cfg +0 -4
  28. python_tado-0.18.6/tests/test_hops_zone.py +0 -147
  29. python_tado-0.18.6/tests/test_http.py +0 -185
  30. python_tado-0.18.6/tests/test_my_tado.py +0 -94
  31. python_tado-0.18.6/tests/test_my_zone.py +0 -676
  32. python_tado-0.18.6/tests/test_tado_interface.py +0 -84
  33. {python_tado-0.18.6 → python_tado-0.19.0}/AUTHORS +0 -0
  34. {python_tado-0.18.6 → python_tado-0.19.0}/LICENSE +0 -0
  35. {python_tado-0.18.6 → python_tado-0.19.0}/PyTado/__init__.py +0 -0
  36. {python_tado-0.18.6 → python_tado-0.19.0}/PyTado/exceptions.py +0 -0
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.3
2
+ Name: python-tado
3
+ Version: 0.19.0
4
+ Summary: PyTado from chrism0dwk, modified by w.malgadey, diplix, michaelarnauts, LenhartStephan, splifter, syssi, andersonshatch, Yippy, p0thi, Coffee2CodeNL, chiefdragon, FilBr, nikilase, albertomontesg, Moritz-Schmidt, palazzem
5
+ License: GPL-3.0-or-later
6
+ Keywords: tado
7
+ Author: Chris Jewell
8
+ Author-email: chrism0dwk@gmail.com
9
+ Requires-Python: >=3.11
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
13
+ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
14
+ Classifier: Natural Language :: English
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Home Automation
20
+ Provides-Extra: all
21
+ Provides-Extra: dev
22
+ Provides-Extra: lint
23
+ Provides-Extra: test
24
+ Requires-Dist: black (>=24.3) ; extra == "lint" or extra == "all"
25
+ Requires-Dist: pre-commit ; extra == "dev" or extra == "all"
26
+ Requires-Dist: pylint ; extra == "lint" or extra == "all"
27
+ Requires-Dist: pytest ; extra == "test" or extra == "all"
28
+ Requires-Dist: pytest-cov ; extra == "test" or extra == "all"
29
+ Requires-Dist: pytest-mock ; extra == "test" or extra == "all"
30
+ Requires-Dist: pytest-socket ; extra == "test" or extra == "all"
31
+ Requires-Dist: pytype ; extra == "dev" or extra == "all"
32
+ Requires-Dist: requests
33
+ Requires-Dist: responses ; extra == "test" or extra == "all"
34
+ Requires-Dist: types-requests ; extra == "dev" or extra == "all"
35
+ Project-URL: Documentation, https://wmalgadey.github.io/PyTado/
36
+ Project-URL: Homepage, https://github.com/wmalgadey/PyTado
37
+ Project-URL: Repository, https://github.com/wmalgadey/PyTado
38
+ Description-Content-Type: text/markdown
39
+
40
+ # PyTado -- Pythonize your central heating
41
+
42
+ [![Linting and testing](https://github.com/wmalgadey/PyTado/actions/workflows/lint-and-test-matrix.yml/badge.svg)](https://github.com/wmalgadey/PyTado/actions/workflows/lint-and-test-matrix.yml)
43
+ [![Build and deploy to pypi](https://github.com/wmalgadey/PyTado/actions/workflows/publish-to-pypi.yml/badge.svg?event=release)](https://github.com/wmalgadey/PyTado/actions/workflows/publish-to-pypi.yml)
44
+ [![PyPI version](https://badge.fury.io/py/python-tado.svg)](https://badge.fury.io/py/python-tado)
45
+ [![codecov](https://codecov.io/github/wmalgadey/PyTado/graph/badge.svg?token=14TT00IWJI)](https://codecov.io/github/wmalgadey/PyTado)
46
+ [![Open in Dev Containers][devcontainer-shield]][devcontainer]
47
+
48
+ PyTado is a Python module implementing an interface to the Tado web API. It allows a user to interact with their
49
+ Tado heating system for the purposes of monitoring or controlling their heating system, beyond what Tado themselves
50
+ currently offer.
51
+
52
+ It is hoped that this module might be used by those who wish to tweak their Tado systems, and further optimise their
53
+ heating setups.
54
+
55
+ ---
56
+
57
+ Original author: Chris Jewell <chrism0dwk@gmail.com>
58
+
59
+ Licence: GPL v3
60
+
61
+ Copyright: Chris Jewell 2016-2018
62
+
63
+ ## Disclaimer
64
+
65
+ Besides owning a Tado system, I have no connection with the Tado company themselves. PyTado was created for my own use,
66
+ and for others who may wish to experiment with personal Internet of Things systems. I receive no help (financial or
67
+ otherwise) from Tado, and have no business interest with them. This software is provided without warranty, according to
68
+ the GNU Public Licence version 3, and should therefore not be used where it may endanger life, financial stakes, or
69
+ cause discomfort and inconvenience to others.
70
+
71
+ ## Usage
72
+ As of the 15th of March 2025, Tado has updated their OAuth2 authentication flow. It will now use the device flow, instead of a username/password flow. This means that the user will have to authenticate the device using a browser, and then enter the code that is displayed on the browser into the terminal.
73
+
74
+ PyTado handles this as following:
75
+
76
+ 1. The `_login_device_flow()` will be invoked at the initialization of a PyTado object. This will start the device flow and will return a URL and a code that the user will have to enter in the browser. The URL can be obtained via the method `device_verification_url()`. Or, when in debug mode, the URL will be printed. Alternatively, you can use the `device_activation_status()` method to check if the device has been activated. It returns three statuses: `NOT_STARTED`, `PENDING`, and `COMPLETED`. Wait to invoke the `device_activation()` method until the status is `PENDING`.
77
+
78
+ 2. Once the URL is obtained, the user will have to enter the code that is displayed on the browser into the terminal. By default, the URL has the `user_code` attached, for the ease of going trough the flow. At this point, run the method `device_activation()`. It will poll every five seconds to see if the flow has been completed. If the flow has been completed, the method will return a token that will be used for all further requests. It will timeout after five minutes.
79
+
80
+ 3. Once the token has been obtained, the user can use the PyTado object to interact with the Tado API. The token will be stored in the `Tado` object, and will be used for all further requests. The token will be refreshed automatically when it expires.
81
+ The `device_verification_url()` will be reset to `None` and the `device_activation_status()` will return `COMPLETED`.
82
+
83
+ ### Screenshots of the device flow
84
+ ![Tado device flow: invoking](/screenshots/tado-device-flow-0.png)
85
+ ![Tado device flow: browser](/screenshots/tado-device-flow-1.png)
86
+ ![Tado device flow: complete](/screenshots/tado-device-flow-2.png)
87
+
88
+ ## Example code
89
+ ```python
90
+ """Example client for PyTado"""
91
+
92
+ from PyTado.interface.interface import Tado
93
+
94
+
95
+ def main() -> None:
96
+ """Retrieve all zones, once successfully logged in"""
97
+ tado = Tado()
98
+
99
+ print("Device activation status: ", tado.device_activation_status())
100
+ print("Device verification URL: ", tado.device_verification_url())
101
+
102
+ print("Starting device activation")
103
+ tado.device_activation()
104
+
105
+ print("Device activation status: ", tado.device_activation_status())
106
+
107
+ zones = tado.get_zones()
108
+ print(zones)
109
+
110
+
111
+ if __name__ == "__main__":
112
+ main()
113
+ ```
114
+
115
+ Note: For developers, there is an `example.py` script in `examples/` which is configured to fetch data from your account.
116
+ You can then invoke `python examples/example.py`.
117
+
118
+
119
+ ## Contributing
120
+
121
+ We are very open to the community's contributions - be it a quick fix of a typo, or a completely new feature!
122
+
123
+ You don't need to be a Python expert to provide meaningful improvements. To learn how to get started, check out our
124
+ [Contributor Guidelines](https://github.com/wmalgadey/econnect-python/blob/main/CONTRIBUTING.md) first, and ask for help
125
+ in [GitHub Discussions](https://github.com/wmalgadey/PyTado/discussions) if you have questions.
126
+
127
+ ## Development
128
+
129
+ We welcome external contributions, even though the project was initially intended for personal use. If you think some
130
+ parts could be exposed with a more generic interface, please open a [GitHub issue](https://github.com/wmalgadey/PyTado/issues)
131
+ to discuss your suggestion.
132
+
133
+ ### Setting up a devcontainer
134
+
135
+ The easiest way to start, is by opening a CodeSpace here on GitHub, or by using
136
+ the [Dev Container][devcontainer] feature of Visual Studio Code.
137
+
138
+ [![Open in Dev Containers][devcontainer-shield]][devcontainer]
139
+
140
+ ### Dev Environment
141
+
142
+ To contribute to this repository, you should first clone your fork and then setup your development environment. Clone
143
+ your repository as follows (replace yourusername with your GitHub account name):
144
+
145
+ ```bash
146
+ git clone https://github.com/yourusername/PyTado.git
147
+ cd PyTado
148
+ ```
149
+
150
+ Then, to create your development environment and install the project with its dependencies, execute the following
151
+ commands in your terminal:
152
+
153
+ ```bash
154
+ # Create and activate a new virtual environment
155
+ python3 -m venv venv
156
+ source venv/bin/activate
157
+
158
+ # install all dependencies
159
+ poetry install
160
+
161
+ # Install pre-commit hooks
162
+ poetry run pre-commit install
163
+ ```
164
+
165
+ ### Coding Guidelines
166
+
167
+ To maintain a consistent codebase, we utilize [black][1]. Consistency is crucial as it helps readability, reduces errors,
168
+ and facilitates collaboration among developers.
169
+
170
+ To ensure that every commit adheres to our coding standards, we've integrated [pre-commit hooks][2]. These hooks
171
+ automatically run `black` before each commit, ensuring that all code changes are automatically checked and formatted.
172
+
173
+ For details on how to set up your development environment to make use of these hooks, please refer to the
174
+ [Development][3] section of our documentation.
175
+
176
+ [1]: https://github.com/ambv/black
177
+ [2]: https://pre-commit.com/
178
+ [3]: https://github.com/wmalgadey/PyTado#development
179
+
180
+ ### Testing
181
+
182
+ Ensuring the robustness and reliability of our code is paramount. Therefore, all contributions must include at least one
183
+ test to verify the intended behavior.
184
+
185
+ To run tests locally, execute the test suite using `pytest` with the following command:
186
+
187
+ ```bash
188
+ pytest tests/ --cov --cov-branch -vv
189
+ ```
190
+
191
+ ---
192
+
193
+ A message from the original author:
194
+
195
+ > This software is at a purely experimental stage. If you're interested and can write Python, clone the Github repo,
196
+ > drop me a line, and get involved!
197
+ >
198
+ > Best wishes and a warm winter to all!
199
+ >
200
+ > Chris Jewell
201
+
202
+
203
+ [devcontainer-shield]: https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode
204
+ [devcontainer]: https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/wmalgadey/PyTado
205
+
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
2
 
4
3
  """Module for querying and controlling Tado smart thermostats."""
5
4
 
@@ -54,14 +53,10 @@ def main():
54
53
  required=True,
55
54
  help=("Tado username in the form of an email address."),
56
55
  )
57
- required_flags.add_argument(
58
- "--password", required=True, help="Tado password."
59
- )
56
+ required_flags.add_argument("--password", required=True, help="Tado password.")
60
57
 
61
58
  # Flags with default values go here.
62
- log_levels = dict(
63
- (logging.getLevelName(level), level) for level in [10, 20, 30, 40, 50]
64
- )
59
+ log_levels = {logging.getLevelName(level): level for level in [10, 20, 30, 40, 50]}
65
60
  parser.add_argument(
66
61
  "--loglevel",
67
62
  default="INFO",
@@ -71,30 +66,20 @@ def main():
71
66
 
72
67
  subparsers = parser.add_subparsers()
73
68
 
74
- show_config_parser = subparsers.add_parser(
75
- "get_me", help="Get home information."
76
- )
69
+ show_config_parser = subparsers.add_parser("get_me", help="Get home information.")
77
70
  show_config_parser.set_defaults(func=get_me)
78
71
 
79
- start_activity_parser = subparsers.add_parser(
80
- "get_state", help="Get state of zone."
81
- )
82
- start_activity_parser.add_argument(
83
- "--zone", help="Zone to get the state of."
84
- )
72
+ start_activity_parser = subparsers.add_parser("get_state", help="Get state of zone.")
73
+ start_activity_parser.add_argument("--zone", help="Zone to get the state of.")
85
74
  start_activity_parser.set_defaults(func=get_state)
86
75
 
87
- start_activity_parser = subparsers.add_parser(
88
- "get_states", help="Get states of all zones."
89
- )
76
+ start_activity_parser = subparsers.add_parser("get_states", help="Get states of all zones.")
90
77
  start_activity_parser.set_defaults(func=get_states)
91
78
 
92
79
  start_activity_parser = subparsers.add_parser(
93
80
  "get_capabilities", help="Get capabilities of zone."
94
81
  )
95
- start_activity_parser.add_argument(
96
- "--zone", help="Zone to get the capabilities of."
97
- )
82
+ start_activity_parser.add_argument("--zone", help="Zone to get the capabilities of.")
98
83
  start_activity_parser.set_defaults(func=get_capabilities)
99
84
 
100
85
  args = parser.parse_args()
@@ -1,10 +1,7 @@
1
1
  """Constant values for the Tado component."""
2
2
 
3
- # Api credentials
4
- CLIENT_ID = "tado-web-app"
5
- CLIENT_SECRET = (
6
- "wZaRN7rpjn3FoNyF5IFuxg9uMzYJcvOoQ8QWiIqS3hfk6gLhVlG57j5YNoZL2Rtc"
7
- )
3
+ # API client ID
4
+ CLIENT_ID_DEVICE = "1bb50063-6b0c-4d11-bd99-387f4a91cc46" # nosec B105
8
5
 
9
6
  # Types
10
7
  TYPE_AIR_CONDITIONING = "AIR_CONDITIONING"
@@ -49,12 +46,8 @@ CONST_HORIZONTAL_SWING_MID_RIGHT = "MID_RIGHT"
49
46
  CONST_HORIZONTAL_SWING_RIGHT = "RIGHT"
50
47
 
51
48
  # When we change the temperature setting, we need an overlay mode
52
- CONST_OVERLAY_TADO_MODE = (
53
- "NEXT_TIME_BLOCK" # wait until tado changes the mode automatic
54
- )
55
- CONST_OVERLAY_MANUAL = (
56
- "MANUAL" # the user has changed the temperature or mode manually
57
- )
49
+ CONST_OVERLAY_TADO_MODE = "NEXT_TIME_BLOCK" # wait until tado changes the mode automatic
50
+ CONST_OVERLAY_MANUAL = "MANUAL" # the user has changed the temperature or mode manually
58
51
  CONST_OVERLAY_TIMER = "TIMER" # the temperature will be reset after a timespan
59
52
 
60
53
  # Heat always comes first since we get the
@@ -103,4 +96,4 @@ DEFAULT_TADO_PRECISION = 0.1
103
96
  DEFAULT_TADOX_PRECISION = 0.01
104
97
 
105
98
  HOME_DOMAIN = "homes"
106
- DEVICE_DOMAIN = "devices"
99
+ DEVICE_DOMAIN = "devices"