-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update models for updated schema and new resource types (#219)
- Loading branch information
1 parent
25b4391
commit 541e232
Showing
12 changed files
with
403 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
""" | ||
Model(s) for camera_motion resource on HUE bridge. | ||
https://developers.meethue.com/develop/hue-api-v2/api-reference/#resource_camera_motion | ||
""" | ||
from dataclasses import dataclass | ||
from typing import Optional | ||
from .feature import ( | ||
MotionSensingFeature, | ||
MotionSensingFeatureSensitivity, | ||
MotionSensingFeatureSensitivityPut, | ||
) | ||
from .resource import ResourceIdentifier, ResourceTypes | ||
|
||
|
||
@dataclass | ||
class CameraMotion: | ||
""" | ||
Represent a (full) `CameraMotion` resource when retrieved from the api. | ||
https://developers.meethue.com/develop/hue-api-v2/api-reference/#resource_camera_motion_get | ||
""" | ||
|
||
id: str | ||
owner: ResourceIdentifier | ||
# enabled: required(boolean) | ||
# true when sensor is activated, false when deactivated | ||
enabled: bool | ||
motion: MotionSensingFeature | ||
sensitivity: Optional[MotionSensingFeatureSensitivity] | ||
|
||
id_v1: Optional[str] = None | ||
type: ResourceTypes = ResourceTypes.CAMERA_MOTION | ||
|
||
|
||
@dataclass | ||
class CameraMotionPut: | ||
""" | ||
CameraMotion resource properties that can be set/updated with a PUT request. | ||
https://developers.meethue.com/develop/hue-api-v2/api-reference/#resource_camera_motion__id__put | ||
""" | ||
|
||
enabled: Optional[bool] = None | ||
sensitivity: Optional[MotionSensingFeatureSensitivityPut] = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
""" | ||
Model(s) for contact resource on HUE bridge. | ||
https://developers.meethue.com/develop/hue-api-v2/api-reference/#resource_contact | ||
""" | ||
from dataclasses import dataclass | ||
from datetime import datetime | ||
from enum import Enum | ||
from typing import Optional | ||
|
||
from .resource import ResourceIdentifier, ResourceTypes | ||
|
||
|
||
class ContactState(Enum): | ||
"""State of a Contact sensor.""" | ||
|
||
CONTACT = "contact" | ||
NO_CONTACT = "no_contact" | ||
|
||
|
||
@dataclass | ||
class ContactReport: | ||
""" | ||
Represent ContactReport as retrieved from api. | ||
https://developers.meethue.com/develop/hue-api-v2/api-reference/#resource_contact_get | ||
""" | ||
|
||
changed: datetime | ||
state: ContactState | ||
|
||
|
||
@dataclass | ||
class Contact: | ||
""" | ||
Represent a (full) `Contact` resource when retrieved from the api. | ||
https://developers.meethue.com/develop/hue-api-v2/api-reference/#resource_contact_get | ||
""" | ||
|
||
id: str | ||
owner: ResourceIdentifier | ||
# enabled: required(boolean) | ||
# true when sensor is activated, false when deactivated | ||
enabled: bool | ||
contact_report: Optional[ContactReport] = None | ||
|
||
id_v1: Optional[str] = None | ||
type: ResourceTypes = ResourceTypes.CONTACT | ||
|
||
|
||
@dataclass | ||
class ContactPut: | ||
""" | ||
Contact resource properties that can be set/updated with a PUT request. | ||
https://developers.meethue.com/develop/hue-api-v2/api-reference/#resource_contact__id__put | ||
""" | ||
|
||
enabled: Optional[bool] = None |
Oops, something went wrong.