Skip to content

Commit

Permalink
Support for Floodlight (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdeath authored Mar 24, 2022
1 parent b3fb1d5 commit 4cdbc4f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/wyzeapy/services/camera_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def __init__(self, dictionary: Dict[Any, Any]):
self.last_event_ts: int = int(time.time() * 1000)
self.on: bool = True
self.siren: bool = False
self.floodlight: bool = False


class CameraService(BaseService):
Expand Down Expand Up @@ -57,7 +58,9 @@ async def update(self, camera: Camera):
camera.on = value == "1"
if property is PropertyIDs.CAMERA_SIREN:
camera.siren = value == "1"

if property is PropertyIDs.FLOOD_LIGHT:
camera.floodlight = value == "1"

return camera

async def register_for_updates(self, camera: Camera, callback: Callable[[Camera], None]):
Expand Down Expand Up @@ -106,6 +109,12 @@ async def siren_on(self, camera: Camera):
async def siren_off(self, camera: Camera):
await self._run_action(camera, "siren_off")

async def floodlight_on(self, camera: Camera):
await self._set_property(camera, PropertyIDs.FLOOD_LIGHT.value, "1")

async def floodlight_off(self, camera: Camera):
await self._set_property(camera, PropertyIDs.FLOOD_LIGHT.value, "2")

async def turn_on_notifications(self, camera: Camera):
plist = [
create_pid_pair(PropertyIDs.NOTIFICATION, "1")
Expand Down
1 change: 1 addition & 0 deletions src/wyzeapy/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class PropertyIDs(Enum):
CONTACT_STATE = "P1301"
MOTION_STATE = "P1302"
CAMERA_SIREN = "P1049"
FLOOD_LIGHT = "P1056"


class ThermostatProps(Enum):
Expand Down

0 comments on commit 4cdbc4f

Please sign in to comment.