forked from Leggin/dirigera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
device.py
58 lines (47 loc) · 1.36 KB
/
device.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from __future__ import annotations
import datetime
from enum import Enum
from typing import Any, Dict, Optional, List
from .base_ikea_model import BaseIkeaModel
class StartupEnum(Enum):
START_ON = "startOn"
START_OFF = "startOff"
START_PREVIOUS = "startPrevious"
START_TOGGLE = "startToggle"
class Attributes(BaseIkeaModel):
custom_name: str
model: str
manufacturer: str
firmware_version: str
hardware_version: str
serial_number: Optional[str] = None
product_code: Optional[str] = None
ota_status: Optional[str] = None
ota_state: Optional[str] = None
ota_progress: Optional[int] = None
ota_policy: Optional[str] = None
ota_schedule_start: Optional[datetime.time] = None
ota_schedule_end: Optional[datetime.time] = None
class Capabilities(BaseIkeaModel):
can_send: List[str]
can_receive: List[str]
class Room(BaseIkeaModel):
id: str
name: str
color: str
icon: str
class Device(BaseIkeaModel):
id: str
type: str
device_type: str
created_at: datetime.datetime
is_reachable: bool
last_seen: datetime.datetime
attributes: Attributes
capabilities: Capabilities
room: Optional[Room] = None
device_set: List
remote_links: List[str]
is_hidden: Optional[bool] = None
def _reload(self, data: Dict[str, Any]) -> Device:
return Device(**data)