Compare commits
No commits in common. "8fb1eac749341839ebd49b2746274bca2827481d" and "f5e8e4bdf09a7b4d6b00633675c0f3891eb9ba9c" have entirely different histories.
8fb1eac749
...
f5e8e4bdf0
43
homesfr.py
43
homesfr.py
|
@ -51,7 +51,7 @@ class Common ():
|
||||||
|
|
||||||
# path to login test
|
# path to login test
|
||||||
self.auth_path = '/mysensors'
|
self.auth_path = '/mysensors'
|
||||||
self.auth_ok_url = 'https://home.sfr.fr/logged' # if logged
|
self.auth_ok_url = 'https://home.sfr.fr/logged' # if logged
|
||||||
self.auth_post_url = 'https://boutique.home.sfr.fr/authentification'
|
self.auth_post_url = 'https://boutique.home.sfr.fr/authentification'
|
||||||
self.auth_referer = 'https://boutique.home.sfr.fr/authentification?back=service'
|
self.auth_referer = 'https://boutique.home.sfr.fr/authentification?back=service'
|
||||||
self.auth_user_field = 'email'
|
self.auth_user_field = 'email'
|
||||||
|
@ -89,15 +89,14 @@ class Common ():
|
||||||
self.camera_get_config_mac = 'mac'
|
self.camera_get_config_mac = 'mac'
|
||||||
self.camera_get_config_flip = 'FLIP'
|
self.camera_get_config_flip = 'FLIP'
|
||||||
self.camera_get_config_leds = 'LEDMODE' # set to 0 to turn the leds on
|
self.camera_get_config_leds = 'LEDMODE' # set to 0 to turn the leds on
|
||||||
self.camera_get_config_petmode = 'pet_mode'
|
self.camera_get_config_detectionsensibility = 'DP' # from 1 to 4
|
||||||
self.camera_get_config_recording = 'rec24'
|
self.camera_get_config_recording = 'REC24'
|
||||||
self.camera_get_config_privacy = 'privacy'
|
|
||||||
self.camera_get_config_name = 'NAME'
|
self.camera_get_config_name = 'NAME'
|
||||||
self.camera_set_config_path = '/homescope/camsettings'
|
self.camera_set_config_path = '/homescope/camsettings'
|
||||||
self.camera_set_config_mac = 'mac'
|
self.camera_set_config_mac = 'mac'
|
||||||
self.camera_set_config_flip = 'flip'
|
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_leds = 'led_mode' # set to 0 to turn the leds on
|
||||||
self.camera_set_config_petmode = 'pet_mode'
|
self.camera_set_config_detectionsensibility = 'dp' # from 1 to 4
|
||||||
self.camera_set_config_recording = 'rec24'
|
self.camera_set_config_recording = 'rec24'
|
||||||
self.camera_set_config_name = 'name'
|
self.camera_set_config_name = 'name'
|
||||||
|
|
||||||
|
@ -482,31 +481,23 @@ class Sensor (Common):
|
||||||
Returns True is the sensor is OK, False either
|
Returns True is the sensor is OK, False either
|
||||||
'''
|
'''
|
||||||
return (self.sensor_dict [self.sensors_status_field] == self.sensors_status_value_ok)
|
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_camera_snapshot (self):
|
def get_snapshot (self):
|
||||||
'''
|
'''
|
||||||
Get a snapshot from the camera
|
Get a snapshot from the camera
|
||||||
Return a PIL.Image object
|
Return a PIL.Image object
|
||||||
'''
|
'''
|
||||||
r = self.base_url + self.camera_snapshot + '?' + self.camera_snapshot_mac + '=' + self.get_mac ()
|
r = self.base_url + self.camera_snapshot + '?' + self.camera_snapshot_mac + '=' + self.get_mac ()
|
||||||
a = self.bytes2image (self.opener.open (r).read ())
|
a = self.bytes2image (self.opener.open (r).read ())
|
||||||
return (a)
|
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')
|
|
Loading…
Reference in New Issue