Skip to content

Commit

Permalink
Added basic support for ourdoor camera base station [#13]
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaun Tarves committed May 12, 2021
1 parent 7d0f92b commit bc11bce
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
14 changes: 8 additions & 6 deletions wyze_sdk/models/devices/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Classes for constructing Wyze-specific data strtucture"""
from __future__ import annotations

from .base import (AbstractWirelessNetworkedDevice, ClimateMixin, # noqa
ContactMixin, Device, DeviceModels, DeviceProp, DeviceProps,
LockableMixin, MotionMixin, PropDef, SwitchableMixin,
VoltageMixin)
from .base import (AbstractNetworkedDevice, AbstractWirelessNetworkedDevice, # noqa
ClimateMixin, ContactMixin, Device, DeviceModels,
DeviceProp, DeviceProps, LockableMixin, MotionMixin,
PropDef, SwitchableMixin, VoltageMixin)
from .bulbs import Bulb, BulbProps, MeshBulb # noqa
from .cameras import Camera, CameraProps # noqa
from .cameras import BaseStation, Camera, CameraProps # noqa
from .locks import (Lock, LockEventType, LockGateway, LockProps, # noqa
LockRecord, LockRecordDetail)
from .plugs import OutdoorPlug, Plug, PlugProps # noqa
Expand Down Expand Up @@ -35,7 +35,9 @@ def parse(cls, device: Union[dict, "Device"]) -> Optional["Device"]:
else:
if "product_type" in device:
type = device["product_type"]
if type == Bulb.type:
if type == BaseStation.type:
return BaseStation(**device)
elif type == Bulb.type:
return Bulb(**device)
elif type == Camera.type:
return Camera(**device)
Expand Down
14 changes: 13 additions & 1 deletion wyze_sdk/models/devices/cameras.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Optional, Sequence, Set

from wyze_sdk.models import PropDef, show_unknown_key_warning
from wyze_sdk.models.devices import (AbstractWirelessNetworkedDevice,
from wyze_sdk.models.devices import (AbstractNetworkedDevice, AbstractWirelessNetworkedDevice,
ClimateMixin, DeviceProp, DeviceProps, MotionMixin,
SwitchableMixin, VoltageMixin)
from wyze_sdk.models.events import Event
Expand Down Expand Up @@ -215,3 +215,15 @@ def is_motion_alarm(self) -> bool:
@property
def is_smoke_alarm(self) -> bool:
return self._suppprts_smoke_alarm if self._suppprts_smoke_alarm is not None else False


class BaseStation(AbstractNetworkedDevice):

type = "BaseStation"

def __init__(
self,
**others: dict
):
super().__init__(type=self.type, **others)
show_unknown_key_warning(self, others)

0 comments on commit bc11bce

Please sign in to comment.