Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
cf7cedf
Update domains model
kpustelnik Aug 9, 2025
b3aa068
Update state model
kpustelnik Aug 9, 2025
f7ad523
Import List from typing
kpustelnik Aug 9, 2025
c9776be
Change | to Union
kpustelnik Aug 13, 2025
2f42979
Update the service models
kpustelnik Aug 24, 2025
b7942d6
For future, disallow extra json keys in API responses so we can catch…
GrandMoff100 Aug 12, 2025
2e26a6f
Fix misc type hinting
GrandMoff100 Aug 12, 2025
8a65e44
Remove deprecated utcnow
GrandMoff100 Aug 12, 2025
11d4c3c
Clean up code
GrandMoff100 Aug 30, 2025
0b30a80
Add JSONType
GrandMoff100 Aug 30, 2025
65d788f
Remove debugging imports and things
GrandMoff100 Aug 30, 2025
b80386d
Fix circular type schema error
GrandMoff100 Aug 30, 2025
0907e5a
Fix type aliasing
GrandMoff100 Aug 30, 2025
6aa0dd7
Fix TypeAlias import
GrandMoff100 Aug 30, 2025
8e0ab31
Update dependencies
GrandMoff100 Aug 30, 2025
557d011
Actually fix recursion error with autodoc-pydantic
GrandMoff100 Sep 1, 2025
195defe
Fix typing issues
GrandMoff100 Sep 1, 2025
295144b
Implement @kpustelnik's optional type changes
GrandMoff100 Sep 1, 2025
5e58e41
Fix recursive type to work with pydantic
GrandMoff100 Sep 1, 2025
85920c7
Tell ruff that Union actually is used
GrandMoff100 Sep 1, 2025
066ace5
Patch object selector's fields property
kpustelnik Sep 2, 2025
1236f1e
Fix validation errors
GrandMoff100 Sep 2, 2025
d46fafd
Add new keys to Error model
GrandMoff100 Sep 2, 2025
7e7870b
Remove `entity_id` parameter
GrandMoff100 Sep 3, 2025
6d5b867
Remove last usage of `entity_id`
GrandMoff100 Sep 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ venv/
.breakpoints

# Informal testing
main.py
main*.py

# Cache files
*.sqlite
Expand Down Expand Up @@ -88,6 +88,7 @@ instance/
# Scrapy stuff:
.scrapy


# Sphinx documentation
docs/_build/

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
additional_dependencies:
- types-requests
- types-simplejson
rev: "v0.931"
rev: "v1.17.1"
- repo: https://github.com/pre-commit/pre-commit-hooks
hooks:
- id: trailing-whitespace
Expand Down
2 changes: 1 addition & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
HOMEASSISTANTAPI_URL: http://server:8123/api
HOMEASSISTANTAPI_WS_URL: ws://server:8123/api/websocket
HOMEASSISTANTAPI_TOKEN: ${HOMEASSISTANTAPI_TOKEN}
DELAY: 60
DELAY: 10

networks:
default:
Expand Down
6 changes: 5 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
# The full version, including alpha/beta/rc tags
with open("../pyproject.toml") as f:
pyproject = f.read()
release = version = re.search('version = "(.+?)"', pyproject).group(1)
search_result = re.search('version = "(.+?)"', pyproject)
assert search_result is not None
release = version = search_result.group(1)

# -- General configuration ---------------------------------------------------

Expand All @@ -46,6 +48,8 @@
"sphinx.ext.autosectionlabel",
]

autodoc_pydantic_model_show_json = False

resource_links = {
"repo": "https://github.com/GrandMoff100/HomeassistantAPI/",
"issues": "https://github.com/GrandMoff100/HomeassistantAPI/issues",
Expand Down
2 changes: 2 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
. .venv/bin/activate
echo "Waiting $DELAY seconds for Home Assistant to start..."
python -c "import time; time.sleep($DELAY)"
echo "Finished waiting $DELAY seconds. Starting tests..."
pytest tests --disable-warnings --cov --cov-report xml:coverage/coverage.xml
7 changes: 7 additions & 0 deletions homeassistant_api/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
from pydantic import BaseModel as PydanticBaseModel
from pydantic import ConfigDict, PlainSerializer

__all__ = (
"BaseModel",
"DatetimeIsoField",
)

DatetimeIsoField = Annotated[
datetime,
PlainSerializer(lambda x: x.isoformat(), return_type=str, when_used="json"),
Expand All @@ -18,4 +23,6 @@ class BaseModel(PydanticBaseModel):
model_config = ConfigDict(
arbitrary_types_allowed=True,
validate_assignment=True,
extra="forbid",
protected_namespaces=(),
)
Loading