コード例 #1
0
ファイル: camera.py プロジェクト: 2Fake/core
 def perform_alarm_sound(self, level: int) -> None:
     """Enable/Disable movement sound alarm."""
     try:
         self.coordinator.ezviz_client.alarm_sound(self._serial, level, 1)
     except HTTPError as err:
         raise HTTPError(
             "Cannot set alarm sound level for on movement detected"
         ) from err
コード例 #2
0
ファイル: camera.py プロジェクト: 2Fake/core
    def perform_ptz(self, direction: str, speed: int) -> None:
        """Perform a PTZ action on the camera."""
        try:
            self.coordinator.ezviz_client.ptz_control(
                str(direction).upper(), self._serial, "START", speed)
            self.coordinator.ezviz_client.ptz_control(
                str(direction).upper(), self._serial, "STOP", speed)

        except HTTPError as err:
            raise HTTPError("Cannot perform PTZ") from err
コード例 #3
0
    def alarm_arm_away(self, code: Any = None) -> None:
        """Send arm away command."""
        try:
            service_switch = getattr(DefenseModeType, ATTR_AWAY)
            self.coordinator.ezviz_client.api_set_defence_mode(
                service_switch.value)

        except HTTPError as err:
            raise HTTPError("Cannot arm alarm") from err

        self._attr_state = STATE_ALARM_ARMED_AWAY
コード例 #4
0
ファイル: camera.py プロジェクト: xuefer/home-assistant-core
    def perform_ptz(self, direction, speed):
        """Perform a PTZ action on the camera."""
        _LOGGER.debug("PTZ action '%s' on %s", direction, self._name)
        try:
            self.coordinator.ezviz_client.ptz_control(
                str(direction).upper(), self._serial, "START", speed)
            self.coordinator.ezviz_client.ptz_control(
                str(direction).upper(), self._serial, "STOP", speed)

        except HTTPError as err:
            raise HTTPError("Cannot perform PTZ") from err
コード例 #5
0
ファイル: camera.py プロジェクト: 2Fake/core
 def perform_sound_alarm(self, enable: int) -> None:
     """Sound the alarm on a camera."""
     try:
         self.coordinator.ezviz_client.sound_alarm(self._serial, enable)
     except HTTPError as err:
         raise HTTPError("Cannot sound alarm") from err