Skip to content

IP Webcam#5614

Closed
robbiet480 wants to merge 23 commits into
home-assistant:devfrom
robbiet480:android-ip-camera
Closed

IP Webcam#5614
robbiet480 wants to merge 23 commits into
home-assistant:devfrom
robbiet480:android-ip-camera

Conversation

@robbiet480
Copy link
Copy Markdown
Contributor

@robbiet480 robbiet480 commented Jan 28, 2017

Description: This adds support for IP Webcam, a recently discovered Android app with many of the same features you would find in a very high end IP camera.

Enabling this component will expose:

  • A Motion Binary Sensor
  • A MJPEG Camera
  • These Sensors:
    • Audio Connections
    • Battery Level
    • Battery Temperature
    • Battery Voltage
    • Light Level
    • Motion
    • Pressure
    • Proximity
    • Sound
    • Video Connections
  • These Switches:
    • Audio Only
    • Exposure Lock
    • Focus
    • Focus Homing
    • Front-facing Camera
    • GPS Active
    • Idle
    • Ivideon Streaming
    • Motion Detection
    • Night Vision
    • Overlay
    • Torch
    • White Balance Lock

The default configuration looks like this when IP Webcam is running from my Nexus 5:

Default layout

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):

android_ip_webcam:
  host: <IP Address>

Checklist:

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't copy paste this. Instead move the other implementation to the camera component.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was only necessary for the camera_image function. Removing this because of removal of camera_image.

Copy link
Copy Markdown
Member

@balloob balloob Jan 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand why you implement this method and use extract_image_from_mjpeg if you have a method above that does exactly the same but async

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI This is a carryover from camera/mjpeg.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh it's necessary in mjpeg.py in case users have Digest authentication or don't have a still image URL set.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Camera's don't get updated.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't use requests. Use aiohttp instead.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you extract it into a third party lib, have it take an aiohttp session in the constructor. That way you don't need to do any closing work because you can use the one managed by hass.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the kind of thing that is perfect to be extracted into a third party lib.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the constructor here to take in a websession and the config as parameters. You don't need the hass object.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'requests.auth.HTTPBasicAuth' imported but unused

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'requests' imported but unused

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'contextlib.closing' imported but unused

@balloob
Copy link
Copy Markdown
Member

balloob commented Feb 1, 2017

Ok to merge when linting fixed 👍

@DavidSpivey
Copy link
Copy Markdown

I would like to mention that the sensor platform is not available on the free app. You would need the (currently $3.99) paid app to enable sensors. I have not reviewed any of the code, but in order to prevent confusion, it may be a good idea to only expose those options available in the free version by default. Then, if a person uses the paid version, have an option in the yaml to specify the full sensors are available.

@robbiet480
Copy link
Copy Markdown
Contributor Author

@DavidSpivey I don't have the paid app but I have access to all the sensors...

@robbiet480
Copy link
Copy Markdown
Contributor Author

@balloob Did you not want me to finish converting this to async then?

@DavidSpivey
Copy link
Copy Markdown

@robbiet480 I'm terribly sorry about that. Totally missed the option in the free version. You're right.

@balloob
Copy link
Copy Markdown
Member

balloob commented Feb 2, 2017

Good point @robbiet480, yes to async 👍

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead pylint: disable=unused-argument use for device in devices.values()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (89 > 79 characters)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work in a constructor when you're async'ing. So remove this.

@pvizeli
Copy link
Copy Markdown
Member

pvizeli commented Feb 18, 2017

You can only use yield from inside coroutine. I look over you code and see some wrong point about that.

@robbiet480 robbiet480 closed this Mar 8, 2017
@pvizeli pvizeli mentioned this pull request Mar 8, 2017
1 task
@home-assistant home-assistant locked and limited conversation to collaborators Jul 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants