Skip to content

Commit b591f2e

Browse files
committed
Continue working on the docs...
1 parent 1549dfd commit b591f2e

6 files changed

Lines changed: 109 additions & 15 deletions

File tree

docs/api.rst

Lines changed: 77 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,80 @@
11
Code Reference
22
***************
33

4-
.. automodule:: homeassistant_api
5-
:platform: Linux, Windows, MacOS
6-
:inherited-members:
7-
:exclude-members: model_json_schema, model_copy, model_rebuild, model_dump, construct, copy, dict, from_orm, json, parse_file, model_validate, parse_raw, parse_obj, parse_str, parse_url, schema, schema_json, schema_yaml, schema_yml, to_orm, update_forward_refs, validate, validate_file, validate_obj, validate_raw, validate_str, validate_url, model_validate_strings, model_validate_json, model_validate, model_post_init, model_parametrized_name, model_extra, model_fields_set, model_dump_json, model_construct, model_computed_fields
4+
Here you can find a detailed reference for most classes and methods in the library.
5+
6+
7+
Clients
8+
=======
9+
10+
.. autoclass:: homeassistant_api.Client
11+
:members:
12+
13+
14+
.. autoclass:: homeassistant_api.AsyncClient
15+
:members:
16+
17+
18+
.. autoclass:: homeassistant_api.WebsocketClient
19+
:members:
20+
21+
22+
Data Models
23+
===========
24+
25+
26+
Domains
27+
--------
28+
29+
.. automodule:: homeassistant_api.models.domains
30+
:members:
31+
32+
Entities
33+
--------
34+
35+
.. automodule:: homeassistant_api.models.entity
36+
:members:
37+
38+
39+
Events
40+
-------
41+
42+
.. automodule:: homeassistant_api.models.events
43+
:members:
44+
45+
History
46+
--------
47+
48+
.. automodule:: homeassistant_api.models.history
49+
:members:
50+
51+
Logbook
52+
--------
53+
54+
.. automodule:: homeassistant_api.models.logbook
55+
:members:
56+
57+
Entity States
58+
--------------
59+
60+
.. automodule:: homeassistant_api.models.states
61+
:members:
62+
63+
Websocket Models
64+
----------------
65+
66+
.. automodule:: homeassistant_api.models.websocket
67+
:members:
68+
69+
Request Processing
70+
==================
71+
72+
.. automodule:: homeassistant_api.processing
73+
:members:
74+
75+
76+
Errors
77+
=======
78+
79+
.. automodule:: homeassistant_api.errors
80+
:members:

docs/conf.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
import re
1616
import sys
1717

18+
1819
sys.path.insert(0, os.path.abspath("../"))
1920
sys.path.append(os.path.abspath("extensions"))
2021

2122
# -- Project information -----------------------------------------------------
2223

2324
project = "Homeassistant API"
24-
copyright = "2023-2025, Nathan Larsen" # pylint: disable=redefined-builtin
25+
copyright = "2023-2026, Nathan Larsen" # pylint: disable=redefined-builtin
2526
author = "Nathan Larsen"
2627
repo_url = "https://github.com/GrandMoff100/HomeassistantAPI"
2728

@@ -50,6 +51,8 @@
5051
]
5152

5253
autodoc_pydantic_model_show_json = False
54+
autodoc_pydantic_model_show_config = False
55+
5356

5457
resource_links = {
5558
"repo": repo_url,
@@ -86,11 +89,15 @@
8689
autodoc_default_options = {
8790
"members": True,
8891
"member-order": "bysource",
92+
"exclude-members": "model_config",
8993
}
9094
intersphinx_mapping = {
91-
"python": (
92-
"https://docs.python.org/3",
93-
None,
94-
),
95+
"python": ("https://docs.python.org/3", None),
9596
"homeassistant_api": ("https://homeassistantapi.readthedocs.io/en/stable", None),
97+
"niquests": ("https://niquests.readthedocs.io/en/stable", None),
98+
"niquests-cache": ("https://niquests-cache.readthedocs.io/en/stable/", None)
9699
}
100+
101+
autodoc_type_aliases = {
102+
"JsonValue": "typing.Any",
103+
}

docs/quickstart.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Prerequisites
66
==============
77

88
1. Homeassistant
9-
---------------
9+
----------------
1010
Before using this library, you need to have Home Assistant running on a device.
1111
Something like a `Raspberry Pi 3 or 4 <https://www.raspberrypi.com>`_ or spare laptop.
1212
If you don't want to do that you can setup a Home Assistant container on your laptop or desktop with docker.
@@ -27,15 +27,15 @@ If you are not sure if it is enabled or not, chances are if your frontend is ena
2727
.. _access_token_setup:
2828

2929
2. Access Token
30-
--------------
30+
---------------
3131
Then once you have done that you need to head over to your profile and set up a "Long Lived Access Token" to use in your code later.
3232
A good guide on how to do that is `here <https://www.home-assistant.io/docs/authentication/#your-account-profile>`__
3333
Also if you are building a website and want to integrate Home Assistant you can use a refresh token instead.
3434
See their `Authentication API docs <https://developers.home-assistant.io/docs/auth_api/>`__ for more information.
3535
Every time you refresh your token you will need to update the :py:attr:`Client.token` attribute of your :py:class:`Client` instance.
3636

3737
3. Exposing Home Assistant to the Web (optional)
38-
--------------------------------------
38+
------------------------------------------------
3939
You may want to setup remote access through a Dynamic DNS server like DuckDNS (a good youtube tutorial on how to do that
4040
`here <https://www.youtube.com/watch?v=AK5E2T5tWyM>`__, keep in mind you will need to port forward to set that up.)
4141
If you do pursue this your API URL will be something like :code:`https://yourhomeassistant.duckdns.org:8123/api`.
@@ -47,7 +47,7 @@ Installation
4747
There are a variety of our different ways you can install the library.
4848

4949
Installing with :code:`pip` (recommended)
50-
-----------------------------------
50+
-----------------------------------------
5151

5252
Installation with pip is really easy and will install the dependencies this project needs.
5353
This installs the latest stable version from :resource:`PyPI <pypi>`

homeassistant_api/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
"AuthInvalid",
1212
"AuthOk",
1313
"AuthRequired",
14+
"BaseClient",
1415
"BaseDomain",
1516
"BaseEntity",
1617
"BaseEvent",
1718
"BaseGroup",
1819
"BaseService",
20+
"BaseWebsocketClient",
1921
"Client",
2022
"ConfigEntry",
2123
"ConfigEntryChange",
@@ -51,10 +53,13 @@
5153
"ServiceField",
5254
"State",
5355
"WebsocketClient",
56+
"WebsocketClient",
5457
)
5558

5659
from .asyncclient import AsyncClient
5760
from .asyncwebsocket import AsyncWebsocketClient
61+
from .baseclient import BaseClient
62+
from .basewebsocket import BaseWebsocketClient
5863
from .client import Client
5964
from .models.config_entries import ConfigEntry
6065
from .models.config_entries import ConfigEntryChange

homeassistant_api/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Client(BaseClient):
4444
:param token: The refresh or long lived access token to authenticate your requests. Required.
4545
:param session: A custom :py:class:`niquests.Session` instance. Optional.
4646
:param verify_ssl: Whether to verify SSL certificates. Default :code:`True`.
47-
:param global_request_kwargs: Kwargs to pass to :func:`requests.request`. Optional.
47+
:param global_request_kwargs: Kwargs to pass to :py:meth:`niquests.Session.request`. Optional.
4848
""" # pylint: disable=line-too-long
4949

5050
_session: Session

homeassistant_api/models/domains.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@
2424

2525
from .states import State
2626

27+
__all__ = (
28+
"AsyncDomain",
29+
"BaseDomain",
30+
"Domain",
31+
"BaseService",
32+
"AsyncService",
33+
"Service"
34+
)
35+
2736

2837
class BaseDomain(BaseModel):
2938
"""Model representing the domain that services belong to."""
@@ -64,7 +73,7 @@ def _add_service(self, service_id: str, **data: Any) -> None:
6473
raise NotImplementedError
6574

6675
def get_service(self, service_id: str) -> BaseService | None:
67-
"""Return a Service with the given service_id, returns None if no such service exists"""
76+
"""Return a Service with the given :code:`service_id`, returns None if no such service exists"""
6877
return self.services.get(service_id)
6978

7079
def __getattr__(self, attr: str) -> Any:

0 commit comments

Comments
 (0)