-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
51 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"""Expose device and introspection capabilities from deCONZ.""" | ||
|
||
import logging | ||
from typing import Callable, Dict, Optional, Tuple, Union | ||
|
||
from .api import APIItem, APIItems | ||
|
||
# from .deconzdevice import DeconzDevice | ||
|
||
LOGGER = logging.getLogger(__name__) | ||
# RESOURCE_TYPE = "devices" | ||
URL = "/devices" | ||
|
||
|
||
class Device(APIItem): | ||
pass | ||
|
||
|
||
class Devices(APIItems): | ||
"""Represent deCONZ devices.""" | ||
|
||
def __init__( | ||
self, | ||
raw: dict, | ||
request: Callable[..., Optional[dict]], | ||
) -> None: | ||
"""Initialize device manager.""" | ||
super().__init__(raw, request, URL, Device) | ||
|
||
async def introspect_button_event(self, model_unique_ids: Dict[str, str]) -> dict: | ||
"""Introspect button event for unique ID.""" | ||
button_events = {} | ||
for model_id, unique_id in model_unique_ids.items(): | ||
path = f"/{URL}/{unique_id}/state/buttonevent/introspect" | ||
raw = await self._request("get", path) | ||
button_events[model_id] = raw | ||
|
||
return button_events |
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