Update docstrings
This commit is contained in:
parent
c9d145cb13
commit
614034d196
4 changed files with 25 additions and 24 deletions
|
@ -18,16 +18,14 @@ BLOOMSKY = None
|
|||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
# the BloomSky only updates every 5-8 minutes as per the API spec so there's
|
||||
# The BloomSky only updates every 5-8 minutes as per the API spec so there's
|
||||
# no point in polling the API more frequently
|
||||
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=300)
|
||||
|
||||
|
||||
# pylint: disable=unused-argument,too-few-public-methods
|
||||
def setup(hass, config):
|
||||
"""
|
||||
Setup BloomSky component.
|
||||
"""
|
||||
""" Setup BloomSky component. """
|
||||
if not validate_config(
|
||||
config,
|
||||
{DOMAIN: [CONF_API_KEY]},
|
||||
|
@ -46,7 +44,7 @@ def setup(hass, config):
|
|||
|
||||
|
||||
class BloomSky(object):
|
||||
"""Handle all communication with the BloomSky API"""
|
||||
""" Handle all communication with the BloomSky API. """
|
||||
|
||||
# API documentation at http://weatherlution.com/bloomsky-api/
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""
|
||||
homeassistant.components.sensor.bloomsky
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Support for BloomSky weather station.
|
||||
homeassistant.components.camera.bloomsky
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Support for a camera of a BloomSky weather station.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/bloomsky/
|
||||
https://home-assistant.io/components/camera.bloomsky/
|
||||
"""
|
||||
import logging
|
||||
import requests
|
||||
|
@ -22,7 +22,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
|||
|
||||
|
||||
class BloomSkyCamera(Camera):
|
||||
""" Represents the images published from the BloomSky's camera """
|
||||
""" Represents the images published from the BloomSky's camera. """
|
||||
|
||||
def __init__(self, bs, device):
|
||||
""" set up for access to the BloomSky camera images """
|
||||
|
@ -39,7 +39,7 @@ class BloomSkyCamera(Camera):
|
|||
self._logger = logging.getLogger(__name__)
|
||||
|
||||
def camera_image(self):
|
||||
""" update the camera's image if it has changed """
|
||||
""" Update the camera's image if it has changed. """
|
||||
try:
|
||||
self._url = self._bloomsky.devices[self._id]["Data"]["ImageURL"]
|
||||
self._bloomsky.refresh_devices()
|
||||
|
@ -56,5 +56,5 @@ class BloomSkyCamera(Camera):
|
|||
|
||||
@property
|
||||
def name(self):
|
||||
""" the name of this BloomSky device """
|
||||
""" The name of this BloomSky device. """
|
||||
return self._name
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""
|
||||
homeassistant.components.sensor.bloomsky
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Support for BloomSky weather station.
|
||||
Support the sensor of a BloomSky weather station.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/bloomsky/
|
||||
https://home-assistant.io/components/sensor.bloomsky/
|
||||
"""
|
||||
import logging
|
||||
import homeassistant.components.bloomsky as bloomsky
|
||||
|
@ -12,7 +12,7 @@ from homeassistant.helpers.entity import Entity
|
|||
|
||||
DEPENDENCIES = ["bloomsky"]
|
||||
|
||||
# these are the available sensors
|
||||
# These are the available sensors
|
||||
SENSOR_TYPES = ["Temperature",
|
||||
"Humidity",
|
||||
"Rain",
|
||||
|
@ -21,19 +21,19 @@ SENSOR_TYPES = ["Temperature",
|
|||
"Night",
|
||||
"UVIndex"]
|
||||
|
||||
# sensor units - these do not currently align with the API documentation
|
||||
# Sensor units - these do not currently align with the API documentation
|
||||
SENSOR_UNITS = {"Temperature": "°F",
|
||||
"Humidity": "%",
|
||||
"Pressure": "inHg",
|
||||
"Luminance": "cd/m²"}
|
||||
|
||||
# which sensors to format numerically
|
||||
# Which sensors to format numerically
|
||||
FORMAT_NUMBERS = ["Temperature", "Pressure"]
|
||||
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
""" Set up the available BloomSky weather sensors """
|
||||
""" Set up the available BloomSky weather sensors. """
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -49,7 +49,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
|
||||
|
||||
class BloomSkySensor(Entity):
|
||||
""" Represents a single sensor in a BloomSky device """
|
||||
""" Represents a single sensor in a BloomSky device. """
|
||||
|
||||
def __init__(self, bs, device, sensor_name):
|
||||
self._bloomsky = bs
|
||||
|
@ -61,21 +61,21 @@ class BloomSkySensor(Entity):
|
|||
|
||||
@property
|
||||
def name(self):
|
||||
""" the name of the BloomSky device and this sensor """
|
||||
""" The name of the BloomSky device and this sensor. """
|
||||
return "{} {}".format(self._client_name, self._sensor_name)
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
""" the current state (i.e. value) of this sensor """
|
||||
""" The current state (i.e. value) of this sensor. """
|
||||
return self._state
|
||||
|
||||
@property
|
||||
def unit_of_measurement(self):
|
||||
""" this sensor's units """
|
||||
""" This sensor's units. """
|
||||
return SENSOR_UNITS.get(self._sensor_name, None)
|
||||
|
||||
def update(self):
|
||||
""" request an update from the BloomSky API """
|
||||
""" Request an update from the BloomSky API. """
|
||||
self._bloomsky.refresh_devices()
|
||||
# TS is a Unix epoch timestamp for the last time the BloomSky servers
|
||||
# heard from this device. If that value hasn't changed, the value has
|
||||
|
@ -86,7 +86,7 @@ class BloomSkySensor(Entity):
|
|||
self._sensor_update = last_ts
|
||||
|
||||
def process_state(self, device):
|
||||
""" handle the response from the BloomSky API for this sensor"""
|
||||
""" Handle the response from the BloomSky API for this sensor. """
|
||||
data = device["Data"][self._sensor_name]
|
||||
if self._sensor_name == "Rain":
|
||||
if data:
|
||||
|
|
|
@ -3,6 +3,9 @@ homeassistant.components.splunk
|
|||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Splunk component which allows you to send data to an Splunk instance
|
||||
utilizing the HTTP Event Collector.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/splunk/
|
||||
"""
|
||||
import json
|
||||
import logging
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue