-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable/Disable Motion detection for Foscam Cameras #8582
Conversation
…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.
…od statement for pydocstyle
…lk 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.
@viswa-swami, thanks for your PR! By analyzing the history of the files in this pull request, we identified @ishults, @SEJeff and @fabaff to be potential reviewers. |
|
||
_LOGGER.info("Using the following URL for %s: %s", | ||
self._name, uri_template.format('***', '***')) | ||
self._foscam_session = FoscamCamera(ip_address, port, self._username, self._password) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (93 > 79 characters)
Ok to merge once the lint and requirement builds pass. See Travis details for issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to remove the requests
import and this should be good to go. Since you aren't using it anymore @viswa-swami
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to remove import requests
above for tests to pass.
…t that i have. Generated using the gen_requirements_all.py script
… by gen_requirements_all.py after latest pull from origin/dev
self._name, uri_template.format('***', '***')) | ||
from foscam import FoscamCamera | ||
|
||
self._foscam_session = FoscamCamera(ip_address, port, self._username, self._password) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (93 > 79 characters)
Awesome 🎉 🐬 |
* 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. * Fixed the violation identified by hound-bot * Fixed the comment posted by HoundCI-Bot regarding using imperative mood statement for pydocstyle * Fixed the error that travis-ci bot found. * 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. * Lint * Removed the requests library import which is not used anymore * Updating requirements_all.txt based on the code-base of home assistant that i have. Generated using the gen_requirements_all.py script * Updating requirements_all.txt and requirements_test_all.txt generated by gen_requirements_all.py after latest pull from origin/dev * Updated requirements_all.txt with script * Updated the foscam camera code to fix lint errors * Fixed houndci violation
Description:
Enable_Motion_Detection and Disable_Motion_Detection were services added to the Camera component in 0.48.1.
Support was added for Arlo cameras in one of the earlier releases. Now adding support for Foscam cameras to enable/disable motion detection.
Based on comments from @balloob, I have changed the code to use a foscam 3rd party library instead of implementing the foscam protocol in HASS.
Updated the requirements_all.txt to reflect the pyfoscam dependency/requirement.
This code has been tested with foscam camera in my home.
Related issue (if applicable): fixes #
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>
Example entry for
configuration.yaml
(if applicable):Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
tox
run successfully. Your PR cannot be merged unless tests passREQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices:
tox
run successfully. Your PR cannot be merged unless tests pass