Amcrest switch platform#7876
Conversation
|
Hi @dparker18, It seems you haven't yet signed a CLA. Please do so here. Once you do that we will be able to review and accept this pull request. Thanks! |
|
@dparker18, thanks for your PR! By analyzing the history of the files in this pull request, we identified @balloob, @fabaff and @robbiet480 to be potential reviewers. |
| _LOGGER.debug("Pulling Motion Detection data from %s sensor.", self._name) | ||
| detection = self._camera.is_motion_detector_on() | ||
| self._state = STATE_ON if detection else STATE_OFF | ||
| #self._attrs['Motion Detection Config'] = self._camera.motion_detection |
There was a problem hiding this comment.
block comment should start with '# '
|
|
||
| def update(self): | ||
| """Update Motion Detection state.""" | ||
| _LOGGER.debug("Pulling Motion Detection data from %s sensor.", self._name) |
| self._camera.motion_detection = 'false' | ||
|
|
||
|
|
||
| def update(self): |
| self._camera.motion_detection = 'true' | ||
|
|
||
|
|
||
| def turn_off(self, **kwargs): |
| return self._state == STATE_ON | ||
|
|
||
|
|
||
| def turn_on(self, **kwargs): |
| self._state = STATE_UNKNOWN | ||
|
|
||
|
|
||
| @property |
| #self._attrs = {} | ||
| self._camera = camera | ||
| self._name = device_info.get(CONF_NAME) | ||
| #self._icon = 'mdi:{}'.format(SENSOR_TYPES.get(self._sensor_type)[2]) |
There was a problem hiding this comment.
block comment should start with '# '
|
|
||
| def __init__(self, device_info, camera): | ||
| """Initialize the switch.""" | ||
| #self._attrs = {} |
There was a problem hiding this comment.
block comment should start with '# '
| """Representation of a switch to toggle on/off motion detection.""" | ||
|
|
||
|
|
||
| def __init__(self, device_info, camera): |
|
|
||
| import homeassistant.helpers.config_validation as cv | ||
| from homeassistant.components.sensor import PLATFORM_SCHEMA | ||
| from homeassistant.const import (CONF_HOST, CONF_NAME, CONF_USERNAME, CONF_PASSWORD, CONF_PORT, STATE_UNKNOWN, STATE_OFF, STATE_ON) |
There was a problem hiding this comment.
line too long (131 > 79 characters)
| def update(self): | ||
| """Update Motion Detection state.""" | ||
| _LOGGER.debug("Pulling Motion Detection data from %s sensor.", | ||
| self._name) |
There was a problem hiding this comment.
continuation line under-indented for visual indent
| config.get(CONF_HOST), config.get(CONF_PORT), | ||
| config.get(CONF_USERNAME), config.get(CONF_PASSWORD)).camera | ||
|
|
||
| try: |
There was a problem hiding this comment.
@dparker18 could you add the persistent_notification feature as https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/sensor/amcrest.py#L59-L70
|
I don't want to add any more amcrest platforms until the amcrest auth is generalized into a component instead of requiring each platform get the auth set in it's config. amcrest:
username: XX
password: YY
sensor:
platform: amcrest
camera:
platform: amcrest |
|
I can take a stab at it. Is there another component with similar structure you'd recommend looking at? |
|
@balloob yes that makes sense. @dparker18 you can take a look at the https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/android_ip_webcam.py or https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/arlo.py @dparker18 let me know if you need any help |
|
I have been looking forward to this for a while. Thank you for your work! |
|
@dparker18 I've been working on a new sensor for Amcrest platform too. If you already started it, I'll wait for your PR and then I'll add the new sensor later. Thank you! |
|
Awesome, I have not started yet. Was hoping to this weekend, sounds like you may beat me to it!
…Sent from my phone
On Jun 12, 2017, at 4:44 PM, Marcelo Moreira de Mello ***@***.***> wrote:
@dparker18 I've been working on a new sensor for Amcrest platform too.
I just want to know if you already started to migrate the platform for your PR as requested by @balloob. If not, I'll create a PR with the changes here and then you can adapt your PR to the new format.
If you already started it, I'll wait for your PR and then I'll add the new sensor later.
Thank you!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
@dparker18 |
|
@dparker18 the PR by @tchellomello has been merged. Do you have any plans to finish this PR ? |
|
Definitely! Will look at it this weekend
|
|
@dparker18 are you planning to try to include this on |
|
This PR seems to have gone stale. Closing it. You can reopen it when you're ready to finish it. |
Description:
Added new amcrest switch platform to control your camera's motion detection setting. For example, disable it based on device presence.
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#2745
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:
toxrun successfully. Your PR cannot be merged unless tests passREQUIREMENTSvariable ([example][ex-requir]).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.