Skip to content

Commit 345802f

Browse files
authored
Merge pull request #211 from kpustelnik/dev
Update entity (state) & service model
2 parents d104b1b + 063df21 commit 345802f

19 files changed

Lines changed: 743 additions & 170 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ venv/
1818
.breakpoints
1919

2020
# Informal testing
21-
main.py
21+
main*.py
2222

2323
# Cache files
2424
*.sqlite
@@ -88,6 +88,7 @@ instance/
8888
# Scrapy stuff:
8989
.scrapy
9090

91+
9192
# Sphinx documentation
9293
docs/_build/
9394

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repos:
55
additional_dependencies:
66
- types-requests
77
- types-simplejson
8-
rev: "v0.931"
8+
rev: "v1.17.1"
99
- repo: https://github.com/pre-commit/pre-commit-hooks
1010
hooks:
1111
- id: trailing-whitespace

compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ services:
1919
HOMEASSISTANTAPI_URL: http://server:8123/api
2020
HOMEASSISTANTAPI_WS_URL: ws://server:8123/api/websocket
2121
HOMEASSISTANTAPI_TOKEN: ${HOMEASSISTANTAPI_TOKEN}
22-
DELAY: 60
22+
DELAY: 10
2323

2424
networks:
2525
default:

docs/conf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
# The full version, including alpha/beta/rc tags
2828
with open("../pyproject.toml") as f:
2929
pyproject = f.read()
30-
release = version = re.search('version = "(.+?)"', pyproject).group(1)
30+
search_result = re.search('version = "(.+?)"', pyproject)
31+
assert search_result is not None
32+
release = version = search_result.group(1)
3133

3234
# -- General configuration ---------------------------------------------------
3335

@@ -46,6 +48,8 @@
4648
"sphinx.ext.autosectionlabel",
4749
]
4850

51+
autodoc_pydantic_model_show_json = False
52+
4953
resource_links = {
5054
"repo": "https://github.com/GrandMoff100/HomeassistantAPI/",
5155
"issues": "https://github.com/GrandMoff100/HomeassistantAPI/issues",

entrypoint.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
. .venv/bin/activate
2+
echo "Waiting $DELAY seconds for Home Assistant to start..."
23
python -c "import time; time.sleep($DELAY)"
4+
echo "Finished waiting $DELAY seconds. Starting tests..."
35
pytest tests --disable-warnings --cov --cov-report xml:coverage/coverage.xml

homeassistant_api/models/base.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
from pydantic import BaseModel as PydanticBaseModel
77
from pydantic import ConfigDict, PlainSerializer
88

9+
__all__ = (
10+
"BaseModel",
11+
"DatetimeIsoField",
12+
)
13+
914
DatetimeIsoField = Annotated[
1015
datetime,
1116
PlainSerializer(lambda x: x.isoformat(), return_type=str, when_used="json"),
@@ -18,4 +23,6 @@ class BaseModel(PydanticBaseModel):
1823
model_config = ConfigDict(
1924
arbitrary_types_allowed=True,
2025
validate_assignment=True,
26+
extra="forbid",
27+
protected_namespaces=(),
2128
)

0 commit comments

Comments
 (0)