From f275535292964537b735b6be61dccbf2d6d971e1 Mon Sep 17 00:00:00 2001 From: Sasha MOREL Date: Sat, 26 Sep 2020 07:51:52 +0200 Subject: [PATCH] =?UTF-8?q?R=C3=A9cup=C3=A9ration=20des=20param=C3=A8tres?= =?UTF-8?q?=20de=20la=20cam=C3=A9ra?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit J'ai aussi enlevé la classe Camera pour intégrer les méthodes dans la classe Sensor. --- homesfr.py | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/homesfr.py b/homesfr.py index 8e828ee..e041ee3 100644 --- a/homesfr.py +++ b/homesfr.py @@ -89,14 +89,15 @@ class Common (): self.camera_get_config_mac = 'mac' self.camera_get_config_flip = 'FLIP' self.camera_get_config_leds = 'LEDMODE' # set to 0 to turn the leds on - self.camera_get_config_detectionsensibility = 'DP' # from 1 to 4 - self.camera_get_config_recording = 'REC24' + self.camera_get_config_petmode = 'pet_mode' + self.camera_get_config_recording = 'rec24' + self.camera_get_config_privacy = 'privacy' self.camera_get_config_name = 'NAME' self.camera_set_config_path = '/homescope/camsettings' self.camera_set_config_mac = 'mac' self.camera_set_config_flip = 'flip' self.camera_set_config_leds = 'led_mode' # set to 0 to turn the leds on - self.camera_set_config_detectionsensibility = 'dp' # from 1 to 4 + self.camera_set_config_petmode = 'pet_mode' self.camera_set_config_recording = 'rec24' self.camera_set_config_name = 'name' @@ -481,23 +482,31 @@ class Sensor (Common): Returns True is the sensor is OK, False either ''' return (self.sensor_dict [self.sensors_status_field] == self.sensors_status_value_ok) - - -class Camera (Sensor): - ''' - Class used to manipulate easily cameras - ''' - def __init__ (self, sensor_dict, opener): - ''' - Initialize the class with the dict producted by HomeSFR.get_camera () - ''' - Sensor.__init__ (self, sensor_dict, opener) - def get_snapshot (self): + def get_camera_snapshot (self): ''' Get a snapshot from the camera Return a PIL.Image object ''' r = self.base_url + self.camera_snapshot + '?' + self.camera_snapshot_mac + '=' + self.get_mac () a = self.bytes2image (self.opener.open (r).read ()) - return (a) \ No newline at end of file + return (a) + + def get_camera_petmode (self): + ''' + Gets the pet mode value + Pet mode is a setting on movement sensibility, to avoid trigger on pet movements + ''' + return (self.sensor_dict [self.camera_get_config_petmode] == '1') + + def get_camera_recording (self): + ''' + Gets if the camera records or not + ''' + return (self.sensor_dict [self.camera_get_config_recording] == '1') + + def get_camera_privacy (self): + ''' + Gets if the camera records or not + ''' + return (self.sensor_dict [self.camera_get_config_privacy] == '1') \ No newline at end of file