Skip to content

Commit f51765e

Browse files
authored
Merge pull request #1188 from charrus/use_appdaemon_452
Update to AppDaemon 4.5.2 to fix #1184
2 parents 8d66769 + 694f27e commit f51765e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1342
-1167
lines changed

.github/workflows/cicd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
python-version: ["3.9", "3.10", "3.11"]
16+
python-version: ["3.10", "3.11", "3.12"]
1717
fail-fast: false
1818
steps:
1919
- uses: actions/checkout@v4

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
python_version: ["3.9", "3.10", "3.11"]
18+
python_version: ["3.10", "3.11", "3.12"]
1919
steps:
2020
- name: Checkout repository
2121
uses: actions/checkout@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,4 @@ dmypy.json
135135

136136
# Project
137137
apps.yaml
138+
appdaemon.yaml

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repos:
1515
- id: python-check-mock-methods
1616
- id: python-check-blanket-type-ignore
1717
- repo: https://github.com/python-jsonschema/check-jsonschema
18-
rev: 0.32.1
18+
rev: 0.33.0
1919
hooks:
2020
- id: check-github-workflows
2121
- id: check-dependabot
@@ -37,19 +37,19 @@ repos:
3737
hooks:
3838
- id: black
3939
- repo: https://github.com/asottile/pyupgrade
40-
rev: v3.19.1
40+
rev: v3.20.0
4141
hooks:
4242
- id: pyupgrade
43-
args: [--py39-plus]
43+
args: [--py310-plus]
4444
- repo: https://github.com/PyCQA/flake8
4545
rev: 7.2.0
4646
hooks:
4747
- id: flake8
4848
- repo: https://github.com/pre-commit/mirrors-mypy
49-
rev: v1.15.0
49+
rev: v1.16.0
5050
hooks:
5151
- id: mypy
5252
additional_dependencies:
53-
- types-PyYAML==6.0.12
54-
- types-mock==5.0.0
55-
- pytest==7.3.1
53+
- types-PyYAML==6.0.12.20250516
54+
- types-mock==5.2.0.20250516
55+
- pytest==8.4.0

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ poetry shell
1010
pre-commit install
1111
```
1212

13-
_Note: I recommend working with Python 3.8 since is the minimum version supported._
13+
_Note: I recommend working with Python 3.10 since is the minimum version supported._
1414

1515
## Adding a new controller
1616

@@ -112,6 +112,7 @@ This will start AppDaemon with the apps on the `apps.yaml`. Note that if you wan
112112
docker run --pull=always --rm \
113113
-v $PWD/apps/controllerx:/usr/src/app/conf/apps/controllerx \
114114
-v $PWD/apps.yaml:/usr/src/app/conf/apps/apps.yaml \
115+
-v $PWD/appdaemon.yaml:/usr/src/app/conf/appdaemon.yaml.example \
115116
-e DASH_URL=http://127.0.0.1:5050 \
116117
-e HA_URL="http://YOUR_HA_IP:8123" \
117118
-e TOKEN="YOUR_HA_TOKEN" \

RELEASE_NOTES.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
[![downloads](https://img.shields.io/github/downloads/xaviml/controllerx/VERSION_TAG/total?style=for-the-badge)](http://github.com/xaviml/controllerx/releases/VERSION_TAG)
22

3-
<!--:warning: This major/minor change contains a breaking change.-->
3+
Special thanks to @charrus for working on the quick fix for this release.
44

5-
_This minor change does not contain any breaking changes._
5+
:warning: This major change contains a breaking change.
6+
7+
<!--_This minor change does not contain any breaking changes._-->
68

79
**_Note: Remember to restart the AppDaemon addon/server after updating to a new version._**
810

9-
<!--
1011
## :pencil2: Features
11-
-->
12+
13+
- :warning: Add support to AppDaemon 4.5.X. This is a breaking change, so if you are running on AppDaemon <4.5, make sure to update first.
14+
- Drop support for Python 3.9
15+
- Add support for Python 3.12
1216

1317
<!--
1418
## :video_game: New devices

apps/controllerx/cx_const.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from collections.abc import Awaitable
2-
from typing import Any, Callable, Optional, Union
1+
from collections.abc import Awaitable, Callable
2+
from typing import Any, Optional, Union
33

44
ActionFunction = Callable[..., Awaitable[Any]]
55
ActionParams = tuple[Any, ...]

apps/controllerx/cx_core/action_type/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from abc import ABC, abstractmethod
2-
from typing import TYPE_CHECKING, Any, Optional
2+
from typing import TYPE_CHECKING, Any
33

44
from cx_core.integration import EventData
55

@@ -18,7 +18,7 @@ def initialize(self, **kwargs: Any) -> None:
1818
pass
1919

2020
@abstractmethod
21-
async def run(self, extra: Optional[EventData] = None) -> None:
21+
async def run(self, extra: EventData | None = None) -> None:
2222
raise NotImplementedError
2323

2424
def __str__(self) -> str:

apps/controllerx/cx_core/action_type/call_service_action_type.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import TYPE_CHECKING, Any, Optional, cast
1+
from typing import TYPE_CHECKING, Any, cast
22

33
from cx_core.action_type.base import ActionType
44
from cx_core.integration import EventData
@@ -13,7 +13,7 @@ class CallServiceActionType(ActionType):
1313
# - Inside data
1414
# - In the same level as "service"
1515
# - From the main config if the domain matches
16-
entity_id: Optional[str]
16+
entity_id: str | None
1717
data: dict[str, Any]
1818

1919
def initialize(self, **kwargs: Any) -> None:
@@ -40,7 +40,7 @@ def _check_controller_isinstance_type_controller(self) -> bool:
4040
def _get_service_domain(self, service: str) -> str:
4141
return service.replace(".", "/").split("/")[0]
4242

43-
async def run(self, extra: Optional[EventData] = None) -> None:
43+
async def run(self, extra: EventData | None = None) -> None:
4444
if self.entity_id:
4545
await self.controller.call_service(
4646
self.service, entity_id=self.entity_id, **self.data

apps/controllerx/cx_core/action_type/delay_action_type.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Optional
1+
from typing import Any
22

33
from cx_core.action_type.base import ActionType
44
from cx_core.integration import EventData
@@ -10,7 +10,7 @@ class DelayActionType(ActionType):
1010
def initialize(self, **kwargs: Any) -> None:
1111
self.delay = kwargs["delay"]
1212

13-
async def run(self, extra: Optional[EventData] = None) -> None:
13+
async def run(self, extra: EventData | None = None) -> None:
1414
await self.controller.sleep(self.delay)
1515

1616
def __str__(self) -> str:

apps/controllerx/cx_core/action_type/predefined_action_type.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import inspect
2-
from typing import Any, Optional
2+
from typing import Any
33

44
from cx_const import (
55
ActionFunction,
@@ -23,7 +23,7 @@ def _get_arguments(
2323
action: ActionFunction,
2424
args: ActionParams,
2525
predefined_action_kwargs: dict[str, Any],
26-
extra: Optional[EventData],
26+
extra: EventData | None,
2727
) -> tuple[ActionParams, dict[str, Any]]:
2828
action_parameters = inspect.signature(action).parameters
2929
action_parameters_without_extra = {
@@ -105,7 +105,7 @@ def initialize(self, **kwargs: Any) -> None:
105105
self.predefined_action_key, self.predefined_actions_mapping
106106
)
107107

108-
async def run(self, extra: Optional[EventData] = None) -> None:
108+
async def run(self, extra: EventData | None = None) -> None:
109109
action_key = await self.controller.render_value(self.predefined_action_key)
110110
if action_key not in self.predefined_actions_mapping:
111111
self._raise_action_key_not_found(

apps/controllerx/cx_core/action_type/scene_action_type.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Optional
1+
from typing import Any
22

33
from cx_core.action_type.base import ActionType
44
from cx_core.integration import EventData
@@ -10,7 +10,7 @@ class SceneActionType(ActionType):
1010
def initialize(self, **kwargs: Any) -> None:
1111
self.scene = kwargs["scene"]
1212

13-
async def run(self, extra: Optional[EventData] = None) -> None:
13+
async def run(self, extra: EventData | None = None) -> None:
1414
await self.controller.call_service("scene/turn_on", entity_id=self.scene)
1515

1616
def __str__(self) -> str:

apps/controllerx/cx_core/color_helper.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import Union
2-
31
Color = tuple[float, float]
42
Colors = list[Color]
53

@@ -68,7 +66,7 @@
6866
}
6967

7068

71-
def get_color_wheel(colors: Union[str, Colors]) -> Colors:
69+
def get_color_wheel(colors: str | Colors) -> Colors:
7270
if isinstance(colors, str):
7371
if colors not in COLOR_WHEELS:
7472
raise ValueError(

0 commit comments

Comments
 (0)