Update docstring (config file) and attempt to honor PEP0257

This commit is contained in:
Fabian Affolter 2015-09-07 18:38:49 +02:00
parent 1d910f3a84
commit e196c136c1

View File

@ -1,4 +1,6 @@
""" """
homeassistant.components.camera.generic
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for IP Cameras. Support for IP Cameras.
This component provides basic support for IP cameras. For the basic support to This component provides basic support for IP cameras. For the basic support to
@ -11,7 +13,7 @@ As part of the basic support the following features will be provided:
- Saving a snapshot - Saving a snapshot
- Recording(JPEG frame capture) - Recording(JPEG frame capture)
To use this component, add the following to your config/configuration.yaml: To use this component, add the following to your configuration.yaml file.
camera: camera:
platform: generic platform: generic
@ -20,29 +22,24 @@ camera:
password: YOUR_PASSWORD password: YOUR_PASSWORD
still_image_url: http://YOUR_CAMERA_IP_AND_PORT/image.jpg still_image_url: http://YOUR_CAMERA_IP_AND_PORT/image.jpg
Variables:
VARIABLES:
These are the variables for the device_data array:
still_image_url still_image_url
*Required *Required
The URL your camera serves the image on. The URL your camera serves the image on, eg. http://192.168.1.21:2112/
Example: http://192.168.1.21:2112/
name name
*Optional *Optional
This parameter allows you to override the name of your camera in homeassistant This parameter allows you to override the name of your camera in Home
Assistant.
username username
*Optional *Optional
THe username for acessing your camera The username for accessing your camera.
password password
*Optional *Optional
the password for accessing your camera The password for accessing your camera.
""" """
import logging import logging
from requests.auth import HTTPBasicAuth from requests.auth import HTTPBasicAuth
@ -78,7 +75,7 @@ class GenericCamera(Camera):
self._still_image_url = device_info['still_image_url'] self._still_image_url = device_info['still_image_url']
def camera_image(self): def camera_image(self):
""" Return a still image reponse from the camera """ """ Return a still image reponse from the camera. """
if self._username and self._password: if self._username and self._password:
response = requests.get( response = requests.get(
self._still_image_url, self._still_image_url,
@ -90,5 +87,5 @@ class GenericCamera(Camera):
@property @property
def name(self): def name(self):
""" Return the name of this device """ """ Return the name of this device. """
return self._name return self._name