FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add own device type for smartstrip children by rytilahti · Pull Request #201 · python-kasa/python-kasa · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
18 changes: 12 additions & 6 deletions kasa/smartdevice.py
This file contains hidden or 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
Expand Up @@ -16,7 +16,7 @@
import logging
from dataclasses import dataclass
from datetime import datetime, timedelta
from enum import Enum
from enum import Enum, auto
from typing import Any, Dict, List, Optional

from .exceptions import SmartDeviceException
Expand All @@ -28,11 +28,12 @@
class DeviceType(Enum):
"""Device type enum."""

Plug = 1
Bulb = 2
Strip = 3
Dimmer = 4
LightStrip = 5
Plug = auto()
Bulb = auto()
Strip = auto()
StripSocket = auto()
Dimmer = auto()
LightStrip = auto()
Unknown = -1


Expand Down Expand Up @@ -743,6 +744,11 @@ def is_strip(self) -> bool:
"""Return True if the device is a strip."""
return self._device_type == DeviceType.Strip

@property
def is_strip_socket(self) -> bool:
"""Return True if the device is a strip socket."""
return self._device_type == DeviceType.StripSocket

@property
def is_dimmer(self) -> bool:
"""Return True if the device is a dimmer."""
Expand Down
1 change: 1 addition & 0 deletions kasa/smartstrip.py
This file contains hidden or 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
Expand Up @@ -211,6 +211,7 @@ def __init__(self, host: str, parent: "SmartStrip", child_id: str) -> None:
self.child_id = child_id
self._last_update = parent._last_update
self._sys_info = parent._sys_info
self._device_type = DeviceType.StripSocket

async def update(self):
"""Override the update to no-op and inform the user."""
Expand Down

Back | FazBrowse Home | New Git URL