From 85ec31d43825ab1ae067f232224c05cc22371888 Mon Sep 17 00:00:00 2001 From: Viswanathan Swaminathan Date: Thu, 13 Jul 2017 12:03:51 -0400 Subject: [PATCH 01/14] Added support to enable/disable motion detection for foscam cameras. This support was added in 0.48.1 as a generic service for cameras. Motion detection can be enabled/disabled for foscam cameras with this code-set. --- homeassistant/components/camera/foscam.py | 64 +++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/homeassistant/components/camera/foscam.py b/homeassistant/components/camera/foscam.py index 86061aa3d1d7a3..73b95478f1086c 100644 --- a/homeassistant/components/camera/foscam.py +++ b/homeassistant/components/camera/foscam.py @@ -18,6 +18,9 @@ CONF_IP = 'ip' +CAMERA_ARMED = "armed" +CAMERA_DISARMED = "disarmed" + DEFAULT_NAME = 'Foscam Camera' DEFAULT_PORT = 88 @@ -59,6 +62,7 @@ def __init__(self, device_info): self._password ) self._name = device_info.get(CONF_NAME) + self._motion_status = False _LOGGER.info("Using the following URL for %s: %s", self._name, uri_template.format('***', '***')) @@ -78,3 +82,63 @@ def camera_image(self): def name(self): """Return the name of this camera.""" return self._name + + def set_motion_status(self, mode): + """Post to the camera and enable motion detection.""" + if mode == CAMERA_ARMED: + enabled = '1' + else: + enabled = '0' + + # Fill the URI with the command to enable motion detection + # Along with that as per foscam spec we have to set + # sensitivity: how much sensitivity camera should detect + # trigger interval: interval between each motion triggers + # schedule: set schedule for days. default is 24x7 + # area: sort of like zones. default is all areas visible to cam + uri_template = self._base_url \ + + 'cgi-bin/CGIProxy.fcgi?' \ + + 'cmd=setMotionDetectConfig' \ + + '&Enable={}&usr={}&pwd={}' \ + + '&linkage=0&snapInterval=3' \ + + '&sensitivity=2&triggerInterval=0' \ + + '&schedule0=281474976710655' \ + + '&schedule1=281474976710655' \ + + '&schedule2=281474976710655' \ + + '&schedule3=281474976710655' \ + + '&schedule4=281474976710655' \ + + '&schedule5=281474976710655' \ + + '&schedule6=281474976710655' \ + + '&area0=1024&area1=1023' \ + + '&area2=1024&area3=1023' \ + + '&area4=1024&area5=1023' \ + + '&area6=1024&area7=1023' \ + + '&area8=1024&area9=1023' + + self._set_motion_status_url = uri_template.format( + enabled, + self._username, + self._password + ) + + try: + response = requests.get(self._set_motion_status_url, timeout=10) + except requests.exceptions.ConnectionError: + return None + else: + return response.content + + @property + def motion_detection_enabled(self): + """Is motion detection enabled or disabled.""" + return self._motion_status + + def enable_motion_detection(self): + """Enable motion detection in camera.""" + self._motion_status = True + self.set_motion_status(CAMERA_ARMED) + + def disable_motion_detection(self): + """Disable motion detection in camera.""" + self._motion_status = False + self.set_motion_status(CAMERA_DISARMED) From 3e0aa26775d9931de3329c9d2518d2308b6af616 Mon Sep 17 00:00:00 2001 From: Viswanathan Swaminathan Date: Thu, 13 Jul 2017 12:15:43 -0400 Subject: [PATCH 02/14] Fixed the violation identified by hound-bot --- homeassistant/components/camera/foscam.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/camera/foscam.py b/homeassistant/components/camera/foscam.py index 73b95478f1086c..a0da77df06a9aa 100644 --- a/homeassistant/components/camera/foscam.py +++ b/homeassistant/components/camera/foscam.py @@ -114,7 +114,7 @@ def set_motion_status(self, mode): + '&area4=1024&area5=1023' \ + '&area6=1024&area7=1023' \ + '&area8=1024&area9=1023' - + self._set_motion_status_url = uri_template.format( enabled, self._username, From ced2cc23d30624fa4cb4dcd606fb15e9ca22fe68 Mon Sep 17 00:00:00 2001 From: Viswanathan Swaminathan Date: Thu, 13 Jul 2017 13:37:36 -0400 Subject: [PATCH 03/14] Fixed the comment posted by HoundCI-Bot regarding using imperative mood statement for pydocstyle --- homeassistant/components/camera/foscam.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/camera/foscam.py b/homeassistant/components/camera/foscam.py index a0da77df06a9aa..3508e1dba819c9 100644 --- a/homeassistant/components/camera/foscam.py +++ b/homeassistant/components/camera/foscam.py @@ -130,7 +130,7 @@ def set_motion_status(self, mode): @property def motion_detection_enabled(self): - """Is motion detection enabled or disabled.""" + """Camera Motion Detection Status.""" return self._motion_status def enable_motion_detection(self): From 5d03fe1b13345e37567b3f15c1780f9a7c56760a Mon Sep 17 00:00:00 2001 From: Viswanathan Swaminathan Date: Thu, 13 Jul 2017 14:28:30 -0400 Subject: [PATCH 04/14] Fixed the error that travis-ci bot found. --- homeassistant/components/camera/foscam.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/camera/foscam.py b/homeassistant/components/camera/foscam.py index 3508e1dba819c9..13ee80b27cfe85 100644 --- a/homeassistant/components/camera/foscam.py +++ b/homeassistant/components/camera/foscam.py @@ -114,15 +114,15 @@ def set_motion_status(self, mode): + '&area4=1024&area5=1023' \ + '&area6=1024&area7=1023' \ + '&area8=1024&area9=1023' - - self._set_motion_status_url = uri_template.format( + + _set_motion_status_url = uri_template.format( enabled, self._username, self._password ) try: - response = requests.get(self._set_motion_status_url, timeout=10) + response = requests.get(_set_motion_status_url, timeout=10) except requests.exceptions.ConnectionError: return None else: From 32922a542986f5972c0c99be16e689189aab6df4 Mon Sep 17 00:00:00 2001 From: Viswanathan Swaminathan Date: Thu, 20 Jul 2017 12:27:07 -0400 Subject: [PATCH 05/14] As per comment from @balloob, Instead of directly using the URL to talk to foscam, used a 3rd party foscam library to communicate with it. This library already has support to enable/disable motion detection and also APIs to change the motion detection schedule etc. Need to add more support in the pyfoscam 3rd party library for checking if motion was detected or even if sound was detected. Once that is done, we can add that into HASS as well. --- homeassistant/components/camera/foscam.py | 106 ++++++---------------- requirements_all.txt | 3 + 2 files changed, 32 insertions(+), 77 deletions(-) diff --git a/homeassistant/components/camera/foscam.py b/homeassistant/components/camera/foscam.py index 13ee80b27cfe85..fc1e3679e530af 100644 --- a/homeassistant/components/camera/foscam.py +++ b/homeassistant/components/camera/foscam.py @@ -16,14 +16,15 @@ _LOGGER = logging.getLogger(__name__) -CONF_IP = 'ip' +REQUIREMENTS = ['pyfoscam==1.2'] -CAMERA_ARMED = "armed" -CAMERA_DISARMED = "disarmed" +CONF_IP = 'ip' DEFAULT_NAME = 'Foscam Camera' DEFAULT_PORT = 88 +FOSCAM_COMM_ERROR = -8 + PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_IP): cv.string, vol.Required(CONF_PASSWORD): cv.string, @@ -36,97 +37,37 @@ # pylint: disable=unused-argument def setup_platform(hass, config, add_devices, discovery_info=None): """Set up a Foscam IP Camera.""" - add_devices([FoscamCamera(config)]) + add_devices([FoscamCam(config)]) -class FoscamCamera(Camera): +class FoscamCam(Camera): """An implementation of a Foscam IP camera.""" def __init__(self, device_info): """Initialize a Foscam camera.""" - super(FoscamCamera, self).__init__() + super(FoscamCam, self).__init__() ip_address = device_info.get(CONF_IP) port = device_info.get(CONF_PORT) - - self._base_url = 'http://{}:{}/'.format(ip_address, port) - - uri_template = self._base_url \ - + 'cgi-bin/CGIProxy.fcgi?' \ - + 'cmd=snapPicture2&usr={}&pwd={}' - self._username = device_info.get(CONF_USERNAME) self._password = device_info.get(CONF_PASSWORD) - self._snap_picture_url = uri_template.format( - self._username, - self._password - ) self._name = device_info.get(CONF_NAME) self._motion_status = False - _LOGGER.info("Using the following URL for %s: %s", - self._name, uri_template.format('***', '***')) + from foscam import FoscamCamera + + self._foscam_session = FoscamCamera(ip_address, port, self._username, self._password) def camera_image(self): """Return a still image reponse from the camera.""" # Send the request to snap a picture and return raw jpg data # Handle exception if host is not reachable or url failed try: - response = requests.get(self._snap_picture_url, timeout=10) - except requests.exceptions.ConnectionError: + result, response = self._foscam_session.snap_picture_2() + except: return None - else: - return response.content - - @property - def name(self): - """Return the name of this camera.""" - return self._name - def set_motion_status(self, mode): - """Post to the camera and enable motion detection.""" - if mode == CAMERA_ARMED: - enabled = '1' - else: - enabled = '0' - - # Fill the URI with the command to enable motion detection - # Along with that as per foscam spec we have to set - # sensitivity: how much sensitivity camera should detect - # trigger interval: interval between each motion triggers - # schedule: set schedule for days. default is 24x7 - # area: sort of like zones. default is all areas visible to cam - uri_template = self._base_url \ - + 'cgi-bin/CGIProxy.fcgi?' \ - + 'cmd=setMotionDetectConfig' \ - + '&Enable={}&usr={}&pwd={}' \ - + '&linkage=0&snapInterval=3' \ - + '&sensitivity=2&triggerInterval=0' \ - + '&schedule0=281474976710655' \ - + '&schedule1=281474976710655' \ - + '&schedule2=281474976710655' \ - + '&schedule3=281474976710655' \ - + '&schedule4=281474976710655' \ - + '&schedule5=281474976710655' \ - + '&schedule6=281474976710655' \ - + '&area0=1024&area1=1023' \ - + '&area2=1024&area3=1023' \ - + '&area4=1024&area5=1023' \ - + '&area6=1024&area7=1023' \ - + '&area8=1024&area9=1023' - - _set_motion_status_url = uri_template.format( - enabled, - self._username, - self._password - ) - - try: - response = requests.get(_set_motion_status_url, timeout=10) - except requests.exceptions.ConnectionError: - return None - else: - return response.content + return response @property def motion_detection_enabled(self): @@ -135,10 +76,21 @@ def motion_detection_enabled(self): def enable_motion_detection(self): """Enable motion detection in camera.""" - self._motion_status = True - self.set_motion_status(CAMERA_ARMED) + try: + self._foscam_session.enable_motion_detection() + self._motion_status = True + except: + self._motion_status = False def disable_motion_detection(self): - """Disable motion detection in camera.""" - self._motion_status = False - self.set_motion_status(CAMERA_DISARMED) + """Disable motion detection.""" + try: + self._foscam_session.disable_motion_detection() + self._motion_status = False + except: + self._motion_status = True + + @property + def name(self): + """Return the name of this camera.""" + return self._name diff --git a/requirements_all.txt b/requirements_all.txt index 86d3d8d60ac0d8..afd9cd938e43c1 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -978,3 +978,6 @@ zengge==0.2 # homeassistant.components.zeroconf zeroconf==0.19.1 + +# homeassistant.components.camera.foscam +pyfoscam==1.2 From 00ef36bbdda32c0132345f7855ea56f02dba8f67 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 24 Jul 2017 08:55:37 -0700 Subject: [PATCH 06/14] Lint --- homeassistant/components/camera/foscam.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/camera/foscam.py b/homeassistant/components/camera/foscam.py index fc1e3679e530af..99cdfa2498f530 100644 --- a/homeassistant/components/camera/foscam.py +++ b/homeassistant/components/camera/foscam.py @@ -56,8 +56,8 @@ def __init__(self, device_info): from foscam import FoscamCamera - self._foscam_session = FoscamCamera(ip_address, port, self._username, self._password) - + self._foscam_session = FoscamCamera(ip_address, port, self._username, + self._password) def camera_image(self): """Return a still image reponse from the camera.""" # Send the request to snap a picture and return raw jpg data From 06f009384636ea434fccb666caf341d4495cc533 Mon Sep 17 00:00:00 2001 From: Viswanathan Swaminathan Date: Wed, 26 Jul 2017 18:35:27 -0400 Subject: [PATCH 07/14] Removed the requests library import which is not used anymore --- homeassistant/components/camera/foscam.py | 1 - 1 file changed, 1 deletion(-) diff --git a/homeassistant/components/camera/foscam.py b/homeassistant/components/camera/foscam.py index 99cdfa2498f530..6fc261e31a366c 100644 --- a/homeassistant/components/camera/foscam.py +++ b/homeassistant/components/camera/foscam.py @@ -6,7 +6,6 @@ """ import logging -import requests import voluptuous as vol from homeassistant.components.camera import (Camera, PLATFORM_SCHEMA) From 7b973275ac7b526d6afa33acb419449fbc3b9e1b Mon Sep 17 00:00:00 2001 From: Viswanathan Swaminathan Date: Fri, 28 Jul 2017 00:51:04 -0400 Subject: [PATCH 08/14] Updating requirements_all.txt based on the code-base of home assistant that i have. Generated using the gen_requirements_all.py script --- requirements_all.txt | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/requirements_all.txt b/requirements_all.txt index afd9cd938e43c1..901b04f61ac09b 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -36,7 +36,7 @@ PyMata==2.14 SoCo==0.12 # homeassistant.components.notify.twitter -TwitterAPI==2.4.6 +TwitterAPI==2.4.5 # homeassistant.components.device_tracker.automatic aioautomatic==0.4.0 @@ -106,9 +106,6 @@ blinkstick==1.1.8 # homeassistant.components.sensor.bitcoin blockchain==1.3.3 -# homeassistant.components.light.decora -# bluepy==1.1.1 - # homeassistant.components.notify.aws_lambda # homeassistant.components.notify.aws_sns # homeassistant.components.notify.aws_sqs @@ -276,11 +273,8 @@ holidays==0.8.1 # homeassistant.components.camera.onvif http://github.com/tgaugry/suds-passworddigest-py3/archive/86fc50e39b4d2b8997481967d6a7fe1c57118999.zip#suds-passworddigest-py3==0.1.2a -# homeassistant.components.xiaomi -https://github.com/Danielhiversen/PyXiaomiGateway/archive/877faec36e1bfa4177cae2a0d4f49570af083e1d.zip#PyXiaomiGateway==0.1.0 - # homeassistant.components.sensor.dht -# https://github.com/adafruit/Adafruit_Python_DHT/archive/da8cddf7fb629c1ef4f046ca44f42523c9cf2d11.zip#Adafruit_DHT==1.3.2 +# https://github.com/adafruit/Adafruit_Python_DHT/archive/da8cddf7fb629c1ef4f046ca44f42523c9cf2d11.zip#Adafruit_DHT==1.3.0 # homeassistant.components.media_player.braviatv https://github.com/aparraga/braviarc/archive/0.3.7.zip#braviarc==0.3.7 @@ -344,7 +338,7 @@ jsonrpc-websocket==0.5 keyring>=9.3,<10.0 # homeassistant.components.knx -knxip==0.5 +knxip==0.4 # homeassistant.components.device_tracker.owntracks libnacl==1.5.1 @@ -525,7 +519,7 @@ pyasn1-modules==0.0.9 pyasn1==0.2.3 # homeassistant.components.apple_tv -pyatv==0.3.4 +pyatv==0.3.2 # homeassistant.components.device_tracker.bbox # homeassistant.components.sensor.bbox @@ -758,7 +752,7 @@ python-twitch==1.3.0 python-vlc==1.1.2 # homeassistant.components.wink -python-wink==1.3.1 +python-wink==1.2.4 # homeassistant.components.zwave python_openzwave==0.4.0.31 @@ -776,7 +770,7 @@ pyunifi==2.13 # pyuserinput==0.1.11 # homeassistant.components.vera -pyvera==0.2.35 +pyvera==0.2.34 # homeassistant.components.media_player.vizio pyvizio==0.0.2 @@ -978,6 +972,3 @@ zengge==0.2 # homeassistant.components.zeroconf zeroconf==0.19.1 - -# homeassistant.components.camera.foscam -pyfoscam==1.2 From 942fb21811ed1da1c937b873b6f70178c39f3c9c Mon Sep 17 00:00:00 2001 From: Viswanathan Swaminathan Date: Fri, 28 Jul 2017 01:04:03 -0400 Subject: [PATCH 09/14] Updating requirements_all.txt and requirements_test_all.txt generated by gen_requirements_all.py after latest pull from origin/dev --- requirements_all.txt | 40 +++++++++++++++------------------------ requirements_test_all.txt | 8 ++++---- 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/requirements_all.txt b/requirements_all.txt index d4deef18db451a..901b04f61ac09b 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -21,7 +21,7 @@ astral==1.4 PyISY==1.0.7 # homeassistant.components.notify.html5 -PyJWT==1.5.2 +PyJWT==1.5.0 # homeassistant.components.sensor.mvglive PyMVGLive==1.1.4 @@ -49,7 +49,7 @@ aiodns==1.1.1 aiohttp_cors==0.5.3 # homeassistant.components.light.lifx -aiolifx==0.5.4 +aiolifx==0.5.2 # homeassistant.components.light.lifx aiolifx_effects==0.1.1 @@ -61,7 +61,7 @@ aiopvapi==1.4 alarmdecoder==0.12.3 # homeassistant.components.amcrest -amcrest==1.2.1 +amcrest==1.2.0 # homeassistant.components.media_player.anthemav anthemav==1.1.8 @@ -92,7 +92,7 @@ batinfo==0.4.2 beautifulsoup4==4.6.0 # homeassistant.components.zha -bellows==0.3.4 +bellows==0.3.2 # homeassistant.components.blink blinkpy==0.6.0 @@ -112,9 +112,6 @@ blockchain==1.3.3 # homeassistant.components.tts.amazon_polly boto3==1.4.3 -# homeassistant.scripts.credstash -botocore==1.4.93 - # homeassistant.components.sensor.broadlink # homeassistant.components.switch.broadlink broadlink==0.5 @@ -136,9 +133,6 @@ colorlog>2.1,<3 # homeassistant.components.binary_sensor.concord232 concord232==0.14 -# homeassistant.scripts.credstash -credstash==1.13.2 - # homeassistant.components.sensor.crimereports crimereports==1.0.0 @@ -232,7 +226,7 @@ fritzhome==1.0.2 fsapi==0.0.7 # homeassistant.components.conversation -fuzzywuzzy==0.15.1 +fuzzywuzzy==0.15.0 # homeassistant.components.tts.google gTTS-token==1.1.1 @@ -347,7 +341,7 @@ keyring>=9.3,<10.0 knxip==0.4 # homeassistant.components.device_tracker.owntracks -libnacl==1.5.2 +libnacl==1.5.1 # homeassistant.components.dyson libpurecoollink==0.2.0 @@ -404,7 +398,7 @@ myusps==1.1.2 nad_receiver==0.0.6 # homeassistant.components.discovery -netdisco==1.1.0 +netdisco==1.0.1 # homeassistant.components.sensor.neurio_energy neurio==0.3.1 @@ -503,7 +497,6 @@ py-cpuinfo==3.3.0 # homeassistant.components.hdmi_cec pyCEC==0.4.13 -# homeassistant.components.light.tplink # homeassistant.components.switch.tplink pyHS100==0.2.4.2 @@ -536,7 +529,7 @@ pybbox==0.0.5-alpha # pybluez==0.22 # homeassistant.components.media_player.cast -pychromecast==0.8.2 +pychromecast==0.8.1 # homeassistant.components.media_player.cmus pycmus==0.1.0 @@ -584,7 +577,7 @@ pyharmony==1.0.16 pyhik==0.1.3 # homeassistant.components.homematic -pyhomematic==0.1.30 +pyhomematic==0.1.29 # homeassistant.components.sensor.hydroquebec pyhydroquebec==1.2.0 @@ -678,7 +671,7 @@ pysma==0.1.3 # homeassistant.components.device_tracker.snmp # homeassistant.components.sensor.snmp -pysnmp==4.3.9 +pysnmp==4.3.8 # homeassistant.components.sensor.thinkingcleaner # homeassistant.components.switch.thinkingcleaner @@ -719,7 +712,7 @@ python-juicenet==0.0.5 # python-lirc==1.2.3 # homeassistant.components.switch.xiaomi_vacuum -python-mirobo==0.1.2 +python-mirobo==0.1.1 # homeassistant.components.media_player.mpd python-mpd2==0.5.5 @@ -755,9 +748,6 @@ python-telegram-bot==6.1.0 # homeassistant.components.sensor.twitch python-twitch==1.3.0 -# homeassistant.components.velbus -python-velbus==2.0.11 - # homeassistant.components.media_player.vlc python-vlc==1.1.2 @@ -789,7 +779,7 @@ pyvizio==0.0.2 pyvlx==0.1.3 # homeassistant.components.notify.html5 -pywebpush==1.0.6 +pywebpush==1.0.5 # homeassistant.components.wemo pywemo==0.4.19 @@ -847,7 +837,7 @@ sense-hat==2.2.0 sharp_aquos_rc==0.3.2 # homeassistant.components.alarm_control_panel.simplisafe -simplisafe-python==1.0.3 +simplisafe-python==1.0.2 # homeassistant.components.notify.slack slacker==0.9.50 @@ -875,7 +865,7 @@ speedtest-cli==1.0.6 # homeassistant.components.recorder # homeassistant.scripts.db_migrator -sqlalchemy==1.1.12 +sqlalchemy==1.1.11 # homeassistant.components.statsd statsd==3.2.1 @@ -975,7 +965,7 @@ yeelight==0.3.0 yeelightsunflower==0.0.8 # homeassistant.components.media_extractor -youtube_dl==2017.7.23 +youtube_dl==2017.7.9 # homeassistant.components.light.zengge zengge==0.2 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 01f948120311de..882d76ad577b41 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -21,7 +21,7 @@ freezegun>=0.3.8 # homeassistant.components.notify.html5 -PyJWT==1.5.2 +PyJWT==1.5.0 # homeassistant.components.media_player.sonos SoCo==0.12 @@ -43,7 +43,7 @@ dsmr_parser==0.8 evohomeclient==0.2.5 # homeassistant.components.conversation -fuzzywuzzy==0.15.1 +fuzzywuzzy==0.15.0 # homeassistant.components.tts.google gTTS-token==1.1.1 @@ -108,7 +108,7 @@ python-forecastio==1.3.5 pyunifi==2.13 # homeassistant.components.notify.html5 -pywebpush==1.0.6 +pywebpush==1.0.5 # homeassistant.components.python_script restrictedpython==4.0a3 @@ -130,7 +130,7 @@ somecomfort==0.4.1 # homeassistant.components.recorder # homeassistant.scripts.db_migrator -sqlalchemy==1.1.12 +sqlalchemy==1.1.11 # homeassistant.components.statsd statsd==3.2.1 From 411b40659b0eff726ecfc233dc2a85145be4610d Mon Sep 17 00:00:00 2001 From: Viswanathan Swaminathan Date: Fri, 28 Jul 2017 01:31:15 -0400 Subject: [PATCH 10/14] Updated requirements_all.txt with script --- requirements_all.txt | 61 +++++++++++++++++++++++++-------------- requirements_test_all.txt | 8 ++--- 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/requirements_all.txt b/requirements_all.txt index 901b04f61ac09b..7c1082fe5980b9 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -21,7 +21,7 @@ astral==1.4 PyISY==1.0.7 # homeassistant.components.notify.html5 -PyJWT==1.5.0 +PyJWT==1.5.2 # homeassistant.components.sensor.mvglive PyMVGLive==1.1.4 @@ -36,7 +36,7 @@ PyMata==2.14 SoCo==0.12 # homeassistant.components.notify.twitter -TwitterAPI==2.4.5 +TwitterAPI==2.4.6 # homeassistant.components.device_tracker.automatic aioautomatic==0.4.0 @@ -49,7 +49,7 @@ aiodns==1.1.1 aiohttp_cors==0.5.3 # homeassistant.components.light.lifx -aiolifx==0.5.2 +aiolifx==0.5.4 # homeassistant.components.light.lifx aiolifx_effects==0.1.1 @@ -61,7 +61,7 @@ aiopvapi==1.4 alarmdecoder==0.12.3 # homeassistant.components.amcrest -amcrest==1.2.0 +amcrest==1.2.1 # homeassistant.components.media_player.anthemav anthemav==1.1.8 @@ -92,7 +92,7 @@ batinfo==0.4.2 beautifulsoup4==4.6.0 # homeassistant.components.zha -bellows==0.3.2 +bellows==0.3.4 # homeassistant.components.blink blinkpy==0.6.0 @@ -106,12 +106,18 @@ blinkstick==1.1.8 # homeassistant.components.sensor.bitcoin blockchain==1.3.3 +# homeassistant.components.light.decora +# bluepy==1.1.1 + # homeassistant.components.notify.aws_lambda # homeassistant.components.notify.aws_sns # homeassistant.components.notify.aws_sqs # homeassistant.components.tts.amazon_polly boto3==1.4.3 +# homeassistant.scripts.credstash +botocore==1.4.93 + # homeassistant.components.sensor.broadlink # homeassistant.components.switch.broadlink broadlink==0.5 @@ -133,6 +139,9 @@ colorlog>2.1,<3 # homeassistant.components.binary_sensor.concord232 concord232==0.14 +# homeassistant.scripts.credstash +credstash==1.13.2 + # homeassistant.components.sensor.crimereports crimereports==1.0.0 @@ -226,7 +235,7 @@ fritzhome==1.0.2 fsapi==0.0.7 # homeassistant.components.conversation -fuzzywuzzy==0.15.0 +fuzzywuzzy==0.15.1 # homeassistant.components.tts.google gTTS-token==1.1.1 @@ -273,8 +282,11 @@ holidays==0.8.1 # homeassistant.components.camera.onvif http://github.com/tgaugry/suds-passworddigest-py3/archive/86fc50e39b4d2b8997481967d6a7fe1c57118999.zip#suds-passworddigest-py3==0.1.2a +# homeassistant.components.xiaomi +https://github.com/Danielhiversen/PyXiaomiGateway/archive/aa9325fe6fdd62a8ef8c9ca1dce31d3292f484bb.zip#PyXiaomiGateway==0.2.0 + # homeassistant.components.sensor.dht -# https://github.com/adafruit/Adafruit_Python_DHT/archive/da8cddf7fb629c1ef4f046ca44f42523c9cf2d11.zip#Adafruit_DHT==1.3.0 +# https://github.com/adafruit/Adafruit_Python_DHT/archive/da8cddf7fb629c1ef4f046ca44f42523c9cf2d11.zip#Adafruit_DHT==1.3.2 # homeassistant.components.media_player.braviatv https://github.com/aparraga/braviarc/archive/0.3.7.zip#braviarc==0.3.7 @@ -338,10 +350,10 @@ jsonrpc-websocket==0.5 keyring>=9.3,<10.0 # homeassistant.components.knx -knxip==0.4 +knxip==0.5 # homeassistant.components.device_tracker.owntracks -libnacl==1.5.1 +libnacl==1.5.2 # homeassistant.components.dyson libpurecoollink==0.2.0 @@ -398,7 +410,7 @@ myusps==1.1.2 nad_receiver==0.0.6 # homeassistant.components.discovery -netdisco==1.0.1 +netdisco==1.1.0 # homeassistant.components.sensor.neurio_energy neurio==0.3.1 @@ -497,6 +509,7 @@ py-cpuinfo==3.3.0 # homeassistant.components.hdmi_cec pyCEC==0.4.13 +# homeassistant.components.light.tplink # homeassistant.components.switch.tplink pyHS100==0.2.4.2 @@ -519,7 +532,7 @@ pyasn1-modules==0.0.9 pyasn1==0.2.3 # homeassistant.components.apple_tv -pyatv==0.3.2 +pyatv==0.3.4 # homeassistant.components.device_tracker.bbox # homeassistant.components.sensor.bbox @@ -529,7 +542,7 @@ pybbox==0.0.5-alpha # pybluez==0.22 # homeassistant.components.media_player.cast -pychromecast==0.8.1 +pychromecast==0.8.2 # homeassistant.components.media_player.cmus pycmus==0.1.0 @@ -564,6 +577,9 @@ pyfido==1.0.1 # homeassistant.components.climate.flexit pyflexit==0.3 +# homeassistant.components.camera.foscam +pyfoscam==1.2 + # homeassistant.components.ifttt pyfttt==0.3 @@ -577,7 +593,7 @@ pyharmony==1.0.16 pyhik==0.1.3 # homeassistant.components.homematic -pyhomematic==0.1.29 +pyhomematic==0.1.30 # homeassistant.components.sensor.hydroquebec pyhydroquebec==1.2.0 @@ -671,7 +687,7 @@ pysma==0.1.3 # homeassistant.components.device_tracker.snmp # homeassistant.components.sensor.snmp -pysnmp==4.3.8 +pysnmp==4.3.9 # homeassistant.components.sensor.thinkingcleaner # homeassistant.components.switch.thinkingcleaner @@ -712,7 +728,7 @@ python-juicenet==0.0.5 # python-lirc==1.2.3 # homeassistant.components.switch.xiaomi_vacuum -python-mirobo==0.1.1 +python-mirobo==0.1.2 # homeassistant.components.media_player.mpd python-mpd2==0.5.5 @@ -748,11 +764,14 @@ python-telegram-bot==6.1.0 # homeassistant.components.sensor.twitch python-twitch==1.3.0 +# homeassistant.components.velbus +python-velbus==2.0.11 + # homeassistant.components.media_player.vlc python-vlc==1.1.2 # homeassistant.components.wink -python-wink==1.2.4 +python-wink==1.3.1 # homeassistant.components.zwave python_openzwave==0.4.0.31 @@ -770,7 +789,7 @@ pyunifi==2.13 # pyuserinput==0.1.11 # homeassistant.components.vera -pyvera==0.2.34 +pyvera==0.2.35 # homeassistant.components.media_player.vizio pyvizio==0.0.2 @@ -779,7 +798,7 @@ pyvizio==0.0.2 pyvlx==0.1.3 # homeassistant.components.notify.html5 -pywebpush==1.0.5 +pywebpush==1.0.6 # homeassistant.components.wemo pywemo==0.4.19 @@ -837,7 +856,7 @@ sense-hat==2.2.0 sharp_aquos_rc==0.3.2 # homeassistant.components.alarm_control_panel.simplisafe -simplisafe-python==1.0.2 +simplisafe-python==1.0.3 # homeassistant.components.notify.slack slacker==0.9.50 @@ -865,7 +884,7 @@ speedtest-cli==1.0.6 # homeassistant.components.recorder # homeassistant.scripts.db_migrator -sqlalchemy==1.1.11 +sqlalchemy==1.1.12 # homeassistant.components.statsd statsd==3.2.1 @@ -965,7 +984,7 @@ yeelight==0.3.0 yeelightsunflower==0.0.8 # homeassistant.components.media_extractor -youtube_dl==2017.7.9 +youtube_dl==2017.7.23 # homeassistant.components.light.zengge zengge==0.2 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 882d76ad577b41..01f948120311de 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -21,7 +21,7 @@ freezegun>=0.3.8 # homeassistant.components.notify.html5 -PyJWT==1.5.0 +PyJWT==1.5.2 # homeassistant.components.media_player.sonos SoCo==0.12 @@ -43,7 +43,7 @@ dsmr_parser==0.8 evohomeclient==0.2.5 # homeassistant.components.conversation -fuzzywuzzy==0.15.0 +fuzzywuzzy==0.15.1 # homeassistant.components.tts.google gTTS-token==1.1.1 @@ -108,7 +108,7 @@ python-forecastio==1.3.5 pyunifi==2.13 # homeassistant.components.notify.html5 -pywebpush==1.0.5 +pywebpush==1.0.6 # homeassistant.components.python_script restrictedpython==4.0a3 @@ -130,7 +130,7 @@ somecomfort==0.4.1 # homeassistant.components.recorder # homeassistant.scripts.db_migrator -sqlalchemy==1.1.11 +sqlalchemy==1.1.12 # homeassistant.components.statsd statsd==3.2.1 From c4506770d9aa2bba864f49fbad55cfe352bff062 Mon Sep 17 00:00:00 2001 From: Viswanathan Swaminathan Date: Mon, 31 Jul 2017 00:19:15 -0400 Subject: [PATCH 11/14] Updated the foscam camera code to fix lint errors --- homeassistant/components/camera/foscam.py | 25 ++++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/camera/foscam.py b/homeassistant/components/camera/foscam.py index 6fc261e31a366c..9ac80d782250e1 100644 --- a/homeassistant/components/camera/foscam.py +++ b/homeassistant/components/camera/foscam.py @@ -55,15 +55,14 @@ def __init__(self, device_info): from foscam import FoscamCamera - self._foscam_session = FoscamCamera(ip_address, port, self._username, - self._password) + self._foscam_session = FoscamCamera(ip_address, port, self._username, self._password) + def camera_image(self): """Return a still image reponse from the camera.""" # Send the request to snap a picture and return raw jpg data # Handle exception if host is not reachable or url failed - try: - result, response = self._foscam_session.snap_picture_2() - except: + result, response = self._foscam_session.snap_picture_2() + if result == FOSCAM_COMM_ERROR: return None return response @@ -75,19 +74,21 @@ def motion_detection_enabled(self): def enable_motion_detection(self): """Enable motion detection in camera.""" - try: - self._foscam_session.enable_motion_detection() + ret, err = self._foscam_session.enable_motion_detection() + if ret == FOSCAM_COMM_ERROR: + _LOGGER.debug("Unable to communicate with Foscam Camera: %s", err) self._motion_status = True - except: + else: self._motion_status = False def disable_motion_detection(self): """Disable motion detection.""" - try: - self._foscam_session.disable_motion_detection() - self._motion_status = False - except: + ret, err = self._foscam_session.disable_motion_detection() + if ret == FOSCAM_COMM_ERROR: + _LOGGER.debug("Unable to communicate with Foscam Camera: %s", err) self._motion_status = True + else: + self._motion_status = False @property def name(self): From 565a737dadbe4a807234317a8cbd0c897d0aab25 Mon Sep 17 00:00:00 2001 From: Viswanathan Swaminathan Date: Mon, 31 Jul 2017 00:23:40 -0400 Subject: [PATCH 12/14] Fixed houndci violation --- homeassistant/components/camera/foscam.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/camera/foscam.py b/homeassistant/components/camera/foscam.py index 9ac80d782250e1..6e9f036074a160 100644 --- a/homeassistant/components/camera/foscam.py +++ b/homeassistant/components/camera/foscam.py @@ -55,7 +55,8 @@ def __init__(self, device_info): from foscam import FoscamCamera - self._foscam_session = FoscamCamera(ip_address, port, self._username, self._password) + self._foscam_session = FoscamCamera(ip_address, port, self._username, + self._password) def camera_image(self): """Return a still image reponse from the camera.""" From 77f809edf05851234c8d907c2000e78b555be290 Mon Sep 17 00:00:00 2001 From: Viswanathan Swaminathan Date: Mon, 11 Sep 2017 17:39:30 -0400 Subject: [PATCH 13/14] Updating the foscam library dependency/requirements. --- homeassistant/components/camera/foscam.py | 4 ++-- requirements_all.txt | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/camera/foscam.py b/homeassistant/components/camera/foscam.py index 8ea90d5a44e27d..3f2761e332a5c0 100644 --- a/homeassistant/components/camera/foscam.py +++ b/homeassistant/components/camera/foscam.py @@ -15,7 +15,7 @@ _LOGGER = logging.getLogger(__name__) -REQUIREMENTS = ['pyfoscam==1.2'] +REQUIREMENTS = ['libpyfoscam==1.0'] CONF_IP = 'ip' @@ -53,7 +53,7 @@ def __init__(self, device_info): self._name = device_info.get(CONF_NAME) self._motion_status = False - from foscam.foscam import FoscamCamera + from libpyfoscam import FoscamCamera self._foscam_session = FoscamCamera(ip_address, port, self._username, self._password, verbose=False) diff --git a/requirements_all.txt b/requirements_all.txt index fce0300d7fd471..683f3fcc4dd607 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -368,6 +368,9 @@ libnacl==1.5.2 # homeassistant.components.dyson libpurecoollink==0.4.2 +# homeassistant.components.camera.foscam +libpyfoscam==1.0 + # homeassistant.components.device_tracker.mikrotik librouteros==1.0.2 @@ -599,9 +602,6 @@ pyfido==1.0.1 # homeassistant.components.climate.flexit pyflexit==0.3 -# homeassistant.components.camera.foscam -pyfoscam==1.2 - # homeassistant.components.ifttt pyfttt==0.3 @@ -752,6 +752,9 @@ python-juicenet==0.0.5 # homeassistant.components.lirc # python-lirc==1.2.3 +# homeassistant.components.switch.xiaomi_vacuum +python-mirobo==0.1.2 + # homeassistant.components.light.xiaomi_philipslight # homeassistant.components.vacuum.xiaomi python-mirobo==0.1.3 From ea851a46ed6be5599101e7db0d4c2cf389d9fb0e Mon Sep 17 00:00:00 2001 From: Viswanathan Swaminathan Date: Mon, 11 Sep 2017 17:53:51 -0400 Subject: [PATCH 14/14] Fixing the requirements_all file. Somehow when i generated, it generated duplicate entry for the same dependency --- requirements_all.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/requirements_all.txt b/requirements_all.txt index 683f3fcc4dd607..0c57668201b253 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -752,9 +752,6 @@ python-juicenet==0.0.5 # homeassistant.components.lirc # python-lirc==1.2.3 -# homeassistant.components.switch.xiaomi_vacuum -python-mirobo==0.1.2 - # homeassistant.components.light.xiaomi_philipslight # homeassistant.components.vacuum.xiaomi python-mirobo==0.1.3