Ejemplo n.º 1
0
 async def async_is_record_on_motion_detection(self,
                                               *,
                                               channel: int = 0) -> bool:
     ret = await self.async_motion_detection
     status = [pretty(s) for s in ret.split()
               if ".RecordEnable=" in s][channel]
     return str2bool(status)
Ejemplo n.º 2
0
 def _set_name(self):
     """Set device name."""
     try:
         self._name = pretty(self.machine_name)
         self._serial = self.serial_number
     except AttributeError:
         self._name = None
         self._serial = None
Ejemplo n.º 3
0
 def _set_name(self):
     """Set device name."""
     try:
         self._name = pretty(self.machine_name)
         self._serial = self.serial_number
     except AttributeError:
         self._name = None
         self._serial = None
Ejemplo n.º 4
0
    def _process_record_mode(self, record_mode: str, channel: int) -> str:
        status_code = {0: "Automatic", 1: "Manual", 2: "Stop"}

        statuses = [
            pretty(s) for s in record_mode.split() if f"[{channel}].Mode=" in s
        ]
        if len(statuses) != 1:
            return "Unknown"

        status = int(statuses[0])
        if status not in status_code:
            return "Unknown"

        return status_code[status]
Ejemplo n.º 5
0
 def is_motion_detector_on(self, *, channel: int = 0) -> bool:
     ret = self.motion_detection
     status = [pretty(s) for s in ret.split() if ".Enable=" in s][channel]
     return str2bool(status)