Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle wake-up scenes #71

Merged
merged 3 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ All available devices (Light, Controller, Outlet, ...) consist of the core data

```python
id: str
relation_id: Optional[str] = None
type: str
device_type: str
created_at: datetime.datetime
Expand Down Expand Up @@ -261,6 +262,7 @@ The controller object has the following attributes (additional to the core attri
```python
is_on: bool
battery_percentage: Optional[int] = None
switch_label: Optional[str] = None
```

Available methods for controller are:
Expand Down
1 change: 1 addition & 0 deletions src/dirigera/devices/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class ControllerAttributes(Attributes):
is_on: bool
battery_percentage: Optional[int] = None
switch_label: Optional[str] = None


class Controller(Device):
Expand Down
1 change: 1 addition & 0 deletions src/dirigera/devices/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class SceneType(Enum):
USER_SCENE = "userScene"
CUSTOM_SCENE = "customScene"
PLAYLIST_SCENE = "playlistScene"
WAKEUP_SCENE = "wakeUpScene"


class Scene(BaseIkeaModel):
Expand Down
8 changes: 8 additions & 0 deletions tests/test_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ def test_dict_to_controller(fake_client: FakeDirigeraHub) -> None:

controller = dict_to_controller(somrig_button_1, fake_client)
assert controller.relation_id == somrig_button_1["relationId"]
assert (
controller.attributes.switch_label
== somrig_button_1["attributes"]["switchLabel"]
)

somrig_button_2: Dict[str, Any] = {
"id": "1111aaaa-1111-1111-aa11-1a1aa1a111a1_2",
Expand Down Expand Up @@ -210,3 +214,7 @@ def test_dict_to_controller(fake_client: FakeDirigeraHub) -> None:

controller = dict_to_controller(somrig_button_2, fake_client)
assert controller.relation_id == somrig_button_2["relationId"]
assert (
controller.attributes.switch_label
== somrig_button_2["attributes"]["switchLabel"]
)
Loading