HomeAssistant-API 5.0.2.post2__tar.gz → 6.0.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 (40) hide show
  1. homeassistant_api-6.0.0/.gitignore +161 -0
  2. {homeassistant_api-5.0.2.post2 → homeassistant_api-6.0.0}/PKG-INFO +15 -34
  3. {homeassistant_api-5.0.2.post2 → homeassistant_api-6.0.0}/README.md +7 -12
  4. homeassistant_api-6.0.0/homeassistant_api/__init__.py +127 -0
  5. homeassistant_api-6.0.0/homeassistant_api/asyncclient.py +411 -0
  6. homeassistant_api-6.0.0/homeassistant_api/asyncwebsocket.py +779 -0
  7. homeassistant_api-5.0.2.post2/homeassistant_api/rawbaseclient.py → homeassistant_api-6.0.0/homeassistant_api/baseclient.py +35 -36
  8. homeassistant_api-6.0.0/homeassistant_api/basewebsocket.py +78 -0
  9. homeassistant_api-6.0.0/homeassistant_api/client.py +409 -0
  10. {homeassistant_api-5.0.2.post2 → homeassistant_api-6.0.0}/homeassistant_api/errors.py +10 -8
  11. homeassistant_api-6.0.0/homeassistant_api/models/__init__.py +83 -0
  12. {homeassistant_api-5.0.2.post2 → homeassistant_api-6.0.0}/homeassistant_api/models/base.py +12 -2
  13. homeassistant_api-6.0.0/homeassistant_api/models/config_entries.py +157 -0
  14. homeassistant_api-6.0.0/homeassistant_api/models/domains.py +660 -0
  15. {homeassistant_api-5.0.2.post2 → homeassistant_api-6.0.0}/homeassistant_api/models/entity.py +89 -37
  16. homeassistant_api-6.0.0/homeassistant_api/models/entity_registry.py +97 -0
  17. homeassistant_api-6.0.0/homeassistant_api/models/events.py +69 -0
  18. homeassistant_api-6.0.0/homeassistant_api/models/history.py +32 -0
  19. homeassistant_api-6.0.0/homeassistant_api/models/logbook.py +28 -0
  20. {homeassistant_api-5.0.2.post2 → homeassistant_api-6.0.0}/homeassistant_api/models/states.py +17 -23
  21. {homeassistant_api-5.0.2.post2 → homeassistant_api-6.0.0}/homeassistant_api/models/websocket.py +21 -20
  22. homeassistant_api-6.0.0/homeassistant_api/processing.py +141 -0
  23. {homeassistant_api-5.0.2.post2 → homeassistant_api-6.0.0}/homeassistant_api/utils.py +8 -16
  24. homeassistant_api-6.0.0/homeassistant_api/websocket.py +750 -0
  25. homeassistant_api-6.0.0/pyproject.toml +118 -0
  26. homeassistant_api-5.0.2.post2/homeassistant_api/__init__.py +0 -48
  27. homeassistant_api-5.0.2.post2/homeassistant_api/client.py +0 -44
  28. homeassistant_api-5.0.2.post2/homeassistant_api/models/__init__.py +0 -24
  29. homeassistant_api-5.0.2.post2/homeassistant_api/models/domains.py +0 -699
  30. homeassistant_api-5.0.2.post2/homeassistant_api/models/events.py +0 -45
  31. homeassistant_api-5.0.2.post2/homeassistant_api/models/history.py +0 -27
  32. homeassistant_api-5.0.2.post2/homeassistant_api/models/logbook.py +0 -26
  33. homeassistant_api-5.0.2.post2/homeassistant_api/processing.py +0 -145
  34. homeassistant_api-5.0.2.post2/homeassistant_api/rawasyncclient.py +0 -418
  35. homeassistant_api-5.0.2.post2/homeassistant_api/rawclient.py +0 -421
  36. homeassistant_api-5.0.2.post2/homeassistant_api/rawwebsocket.py +0 -208
  37. homeassistant_api-5.0.2.post2/homeassistant_api/websocket.py +0 -380
  38. homeassistant_api-5.0.2.post2/pyproject.toml +0 -99
  39. {homeassistant_api-5.0.2.post2 → homeassistant_api-6.0.0}/LICENSE +0 -0
  40. {homeassistant_api-5.0.2.post2 → homeassistant_api-6.0.0}/homeassistant_api/py.typed +0 -0
@@ -0,0 +1,161 @@
1
+ CHANGELOG.draft.md
2
+
3
+ # Byte-compiled / optimized / DLL files
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+
8
+ # C extensions
9
+ *.so
10
+
11
+ # Pycharm
12
+ .idea/
13
+ venv/
14
+
15
+ # Ruff
16
+ .ruff_cache
17
+
18
+ # Repl.it
19
+ .replit
20
+ .breakpoints
21
+
22
+ # Informal testing
23
+ main*.py
24
+
25
+ # Cache files
26
+ *.sqlite
27
+
28
+ # Test Server
29
+ test_server/
30
+
31
+ # Custom Components
32
+ volumes/config/.storage/custom_components/
33
+
34
+ # Distribution / packaging
35
+ .Python
36
+ build/
37
+ develop-eggs/
38
+ dist/
39
+ downloads/
40
+ eggs/
41
+ .eggs/
42
+ lib/
43
+ lib64/
44
+ parts/
45
+ sdist/
46
+ var/
47
+ wheels/
48
+ pip-wheel-metadata/
49
+ share/python-wheels/
50
+ *.egg-info/
51
+ .installed.cfg
52
+ *.egg
53
+ MANIFEST
54
+
55
+ # PyInstaller
56
+ # Usually these files are written by a python script from a template
57
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
58
+ *.manifest
59
+ *.spec
60
+
61
+ # Installer logs
62
+ pip-log.txt
63
+ pip-delete-this-directory.txt
64
+
65
+ # Unit test / coverage reports
66
+ htmlcov/
67
+ .tox/
68
+ .nox/
69
+ .coverage
70
+ .coverage.*
71
+ .cache
72
+ nosetests.xml
73
+ coverage.xml
74
+ *.cover
75
+ *.py,cover
76
+ .hypothesis/
77
+ .pytest_cache/
78
+
79
+ # Translations
80
+ *.mo
81
+ *.pot
82
+
83
+ # Django stuff:
84
+ *.log
85
+ local_settings.py
86
+ db.sqlite3
87
+ db.sqlite3-journal
88
+
89
+ # Flask stuff:
90
+ instance/
91
+ .webassets-cache
92
+
93
+ # Scrapy stuff:
94
+ .scrapy
95
+
96
+
97
+ # Sphinx documentation
98
+ docs/_build/
99
+
100
+ # PyBuilder
101
+ target/
102
+
103
+ # Jupyter Notebook
104
+ .ipynb_checkpoints
105
+
106
+ # IPython
107
+ profile_default/
108
+ ipython_config.py
109
+
110
+ # pyenv
111
+ .python-version
112
+
113
+ # pipenv
114
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
115
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
116
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
117
+ # install all needed dependencies.
118
+ #Pipfile.lock
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+ uv.lock
139
+ poetry.lock
140
+
141
+ # Spyder project settings
142
+ .spyderproject
143
+ .spyproject
144
+
145
+ # Rope project settings
146
+ .ropeproject
147
+
148
+ # mkdocs documentation
149
+ /site
150
+
151
+ # mypy
152
+ .mypy_cache/
153
+ .dmypy.json
154
+ dmypy.json
155
+
156
+ # Docker Outputs
157
+ volumes/coverage/
158
+ volumes/config/.HA_VERSION
159
+ volumes/config/home-assistant*
160
+ volumes/config/deps
161
+ .code-graph/
@@ -1,30 +1,17 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: HomeAssistant-API
3
- Version: 5.0.2.post2
3
+ Version: 6.0.0
4
4
  Summary: Python Wrapper for Homeassistant's REST API
5
- License: GPL-3.0-or-later
6
- License-File: LICENSE
7
- Author: GrandMoff100
8
- Author-email: minecraftcrusher100@gmail.com
9
- Requires-Python: >=3.9,<4.0
10
- Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: Programming Language :: Python :: 3.10
14
- Classifier: Programming Language :: Python :: 3.11
15
- Classifier: Programming Language :: Python :: 3.12
16
- Classifier: Programming Language :: Python :: 3.13
17
- Classifier: Programming Language :: Python :: 3.14
18
- Requires-Dist: aiohttp (>=3,<4)
19
- Requires-Dist: aiohttp-client-cache (>=0,<1)
20
- Requires-Dist: pydantic (>=2,<3)
21
- Requires-Dist: requests (>=2,<3)
22
- Requires-Dist: requests-cache (>=1,<2)
23
- Requires-Dist: simplejson (>=3,<4)
24
- Requires-Dist: websockets (>=15,<16)
25
5
  Project-URL: Documentation, https://homeassistantapi.readthedocs.io
26
6
  Project-URL: Homepage, https://github.com/GrandMoff100/HomeAssistantAPI
27
7
  Project-URL: Repository, https://github.com/GrandMoff100/HomeAssistantAPI
8
+ Author-email: GrandMoff100 <minecraftcrusher100@gmail.com>
9
+ License-Expression: GPL-3.0-or-later
10
+ License-File: LICENSE
11
+ Requires-Python: <4.0,>=3.11
12
+ Requires-Dist: niquests[ws]>=3
13
+ Requires-Dist: pydantic<3,>=2
14
+ Requires-Dist: simplejson<4,>=3
28
15
  Description-Content-Type: text/markdown
29
16
 
30
17
  # HomeassistantAPI
@@ -54,25 +41,22 @@ with Client(
54
41
  '<API Server URL>', # i.e. 'http://homeassistant.local:8123/api/'
55
42
  '<Your Long Lived Access-Token>'
56
43
  ) as client:
57
- light = client.trigger_service('light', 'turn_on', entity_id="light.living_room")
44
+ client.trigger_service('light', 'turn_on', entity_id="light.living_room")
58
45
  ```
59
46
 
60
- All the methods also support async/await!
61
- Just prefix the method with `async_` and pass the `use_async=True` argument to the `Client` constructor.
62
- Then you can use the methods as coroutines
63
- (i.e. `await light.async_turn_on(...)`).
47
+ All four client classes share the same method names.
48
+ The async clients (`AsyncClient`, `AsyncWebsocketClient`) use `async def` methods that you `await`.
64
49
 
65
50
  ```py
66
51
  import asyncio
67
- from homeassistant_api import Client
52
+ from homeassistant_api import AsyncClient
68
53
 
69
54
  async def main():
70
- with Client(
55
+ async with AsyncClient(
71
56
  '<REST API Server URL>', # i.e. 'http://homeassistant.local:8123/api/'
72
57
  '<Your Long Lived Access-Token>',
73
- use_async=True
74
58
  ) as client:
75
- light = await client.async_trigger_service('light', 'turn_on', entity_id="light.living_room")
59
+ await client.trigger_service('light', 'turn_on', entity_id="light.living_room")
76
60
 
77
61
  asyncio.run(main())
78
62
  ```
@@ -86,11 +70,9 @@ with WebsocketClient(
86
70
  '<WS API Server URL>', # i.e. 'ws://homeassistant.local:8123/api/websocket'
87
71
  '<Your Long Lived Access-Token>'
88
72
  ) as ws_client:
89
- light = ws_client.trigger_service('light', 'turn_on', entity_id="light.living_room")
73
+ ws_client.trigger_service('light', 'turn_on', entity_id="light.living_room")
90
74
  ```
91
75
 
92
- > Note: The Websocket API is not yet supported in async/await mode.
93
-
94
76
  ## Documentation
95
77
 
96
78
  All documentation, API reference, contribution guidelines and pretty much everything else
@@ -105,4 +87,3 @@ We'd love to hear about how you use our library!!
105
87
  ## License
106
88
 
107
89
  This project is under the GNU GPLv3 license, as defined by the Free Software Foundation.
108
-
@@ -25,25 +25,22 @@ with Client(
25
25
  '<API Server URL>', # i.e. 'http://homeassistant.local:8123/api/'
26
26
  '<Your Long Lived Access-Token>'
27
27
  ) as client:
28
- light = client.trigger_service('light', 'turn_on', entity_id="light.living_room")
28
+ client.trigger_service('light', 'turn_on', entity_id="light.living_room")
29
29
  ```
30
30
 
31
- All the methods also support async/await!
32
- Just prefix the method with `async_` and pass the `use_async=True` argument to the `Client` constructor.
33
- Then you can use the methods as coroutines
34
- (i.e. `await light.async_turn_on(...)`).
31
+ All four client classes share the same method names.
32
+ The async clients (`AsyncClient`, `AsyncWebsocketClient`) use `async def` methods that you `await`.
35
33
 
36
34
  ```py
37
35
  import asyncio
38
- from homeassistant_api import Client
36
+ from homeassistant_api import AsyncClient
39
37
 
40
38
  async def main():
41
- with Client(
39
+ async with AsyncClient(
42
40
  '<REST API Server URL>', # i.e. 'http://homeassistant.local:8123/api/'
43
41
  '<Your Long Lived Access-Token>',
44
- use_async=True
45
42
  ) as client:
46
- light = await client.async_trigger_service('light', 'turn_on', entity_id="light.living_room")
43
+ await client.trigger_service('light', 'turn_on', entity_id="light.living_room")
47
44
 
48
45
  asyncio.run(main())
49
46
  ```
@@ -57,11 +54,9 @@ with WebsocketClient(
57
54
  '<WS API Server URL>', # i.e. 'ws://homeassistant.local:8123/api/websocket'
58
55
  '<Your Long Lived Access-Token>'
59
56
  ) as ws_client:
60
- light = ws_client.trigger_service('light', 'turn_on', entity_id="light.living_room")
57
+ ws_client.trigger_service('light', 'turn_on', entity_id="light.living_room")
61
58
  ```
62
59
 
63
- > Note: The Websocket API is not yet supported in async/await mode.
64
-
65
60
  ## Documentation
66
61
 
67
62
  All documentation, API reference, contribution guidelines and pretty much everything else
@@ -0,0 +1,127 @@
1
+ """Interact with your Homeassistant Instance remotely."""
2
+
3
+ __all__ = (
4
+ "AsyncClient",
5
+ "AsyncDomain",
6
+ "AsyncEntity",
7
+ "AsyncEvent",
8
+ "AsyncGroup",
9
+ "AsyncService",
10
+ "AsyncWebsocketClient",
11
+ "AuthInvalid",
12
+ "AuthOk",
13
+ "AuthRequired",
14
+ "BaseDomain",
15
+ "BaseEntity",
16
+ "BaseEvent",
17
+ "BaseGroup",
18
+ "BaseService",
19
+ "Client",
20
+ "ConfigEntry",
21
+ "ConfigEntryChange",
22
+ "ConfigEntryDisabler",
23
+ "ConfigEntryEvent",
24
+ "ConfigEntryState",
25
+ "ConfigFlowContext",
26
+ "ConfigSubEntry",
27
+ "Context",
28
+ "DisableEnableResult",
29
+ "DiscoveryKey",
30
+ "Domain",
31
+ "Entity",
32
+ "EntityCategory",
33
+ "EntityDisabledBy",
34
+ "EntityHiddenBy",
35
+ "EntityRegistryEntry",
36
+ "EntityRegistryEntryExtended",
37
+ "EntityRegistryUpdateResult",
38
+ "ErrorResponse",
39
+ "Event",
40
+ "EventResponse",
41
+ "FlowContext",
42
+ "FlowResult",
43
+ "FlowResultType",
44
+ "Group",
45
+ "History",
46
+ "IntegrationTypes",
47
+ "LogbookEntry",
48
+ "PingResponse",
49
+ "ResultResponse",
50
+ "Service",
51
+ "ServiceField",
52
+ "State",
53
+ "WebsocketClient",
54
+ )
55
+
56
+ from .asyncclient import AsyncClient
57
+ from .asyncwebsocket import AsyncWebsocketClient
58
+ from .client import Client
59
+ from .models.config_entries import ConfigEntry
60
+ from .models.config_entries import ConfigEntryChange
61
+ from .models.config_entries import ConfigEntryDisabler
62
+ from .models.config_entries import ConfigEntryEvent
63
+ from .models.config_entries import ConfigEntryState
64
+ from .models.config_entries import ConfigFlowContext
65
+ from .models.config_entries import ConfigSubEntry
66
+ from .models.config_entries import DisableEnableResult
67
+ from .models.config_entries import DiscoveryKey
68
+ from .models.config_entries import FlowContext
69
+ from .models.config_entries import FlowResult
70
+ from .models.config_entries import FlowResultType
71
+ from .models.config_entries import IntegrationTypes
72
+ from .models.domains import AsyncDomain
73
+ from .models.domains import AsyncService
74
+ from .models.domains import BaseDomain
75
+ from .models.domains import BaseService
76
+ from .models.domains import Domain
77
+ from .models.domains import Service
78
+ from .models.domains import ServiceField
79
+ from .models.domains import ServiceFieldSelector
80
+ from .models.domains import ServiceFieldSelectorObjectField
81
+ from .models.entity import AsyncEntity
82
+ from .models.entity import AsyncGroup
83
+ from .models.entity import BaseEntity
84
+ from .models.entity import BaseGroup
85
+ from .models.entity import Entity
86
+ from .models.entity import Group
87
+ from .models.entity_registry import EntityCategory
88
+ from .models.entity_registry import EntityDisabledBy
89
+ from .models.entity_registry import EntityHiddenBy
90
+ from .models.entity_registry import EntityRegistryEntry
91
+ from .models.entity_registry import EntityRegistryEntryExtended
92
+ from .models.entity_registry import EntityRegistryUpdateResult
93
+ from .models.events import AsyncEvent
94
+ from .models.events import BaseEvent
95
+ from .models.events import Event
96
+ from .models.history import History
97
+ from .models.logbook import LogbookEntry
98
+ from .models.states import Context
99
+ from .models.states import State
100
+ from .models.websocket import AuthInvalid
101
+ from .models.websocket import AuthOk
102
+ from .models.websocket import AuthRequired
103
+ from .models.websocket import ErrorResponse
104
+ from .models.websocket import EventResponse
105
+ from .models.websocket import PingResponse
106
+ from .models.websocket import ResultResponse
107
+ from .websocket import WebsocketClient
108
+
109
+ AsyncDomain.model_rebuild()
110
+ AsyncEntity.model_rebuild()
111
+ AsyncEvent.model_rebuild()
112
+ AsyncGroup.model_rebuild()
113
+ AsyncService.model_rebuild()
114
+ BaseDomain.model_rebuild()
115
+ BaseEntity.model_rebuild()
116
+ BaseEvent.model_rebuild()
117
+ BaseGroup.model_rebuild()
118
+ BaseService.model_rebuild()
119
+ Domain.model_rebuild()
120
+ Entity.model_rebuild()
121
+ Event.model_rebuild()
122
+ Group.model_rebuild()
123
+ History.model_rebuild()
124
+ Service.model_rebuild()
125
+ ServiceFieldSelector.model_rebuild()
126
+ ServiceFieldSelectorObjectField.model_rebuild()
127
+ State.model_rebuild()