mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Update docstrings
This commit is contained in:
parent
c9d145cb13
commit
614034d196
@ -18,16 +18,14 @@ BLOOMSKY = None
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_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
|
# no point in polling the API more frequently
|
||||||
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=300)
|
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=300)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-argument,too-few-public-methods
|
# pylint: disable=unused-argument,too-few-public-methods
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
"""
|
""" Setup BloomSky component. """
|
||||||
Setup BloomSky component.
|
|
||||||
"""
|
|
||||||
if not validate_config(
|
if not validate_config(
|
||||||
config,
|
config,
|
||||||
{DOMAIN: [CONF_API_KEY]},
|
{DOMAIN: [CONF_API_KEY]},
|
||||||
@ -46,7 +44,7 @@ def setup(hass, config):
|
|||||||
|
|
||||||
|
|
||||||
class BloomSky(object):
|
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/
|
# API documentation at http://weatherlution.com/bloomsky-api/
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
"""
|
"""
|
||||||
homeassistant.components.sensor.bloomsky
|
homeassistant.components.camera.bloomsky
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Support for BloomSky weather station.
|
Support for a camera of a BloomSky weather station.
|
||||||
|
|
||||||
For more details about this component, please refer to the documentation at
|
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 logging
|
||||||
import requests
|
import requests
|
||||||
@ -22,7 +22,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
|||||||
|
|
||||||
|
|
||||||
class BloomSkyCamera(Camera):
|
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):
|
def __init__(self, bs, device):
|
||||||
""" set up for access to the BloomSky camera images """
|
""" set up for access to the BloomSky camera images """
|
||||||
@ -39,7 +39,7 @@ class BloomSkyCamera(Camera):
|
|||||||
self._logger = logging.getLogger(__name__)
|
self._logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
def camera_image(self):
|
def camera_image(self):
|
||||||
""" update the camera's image if it has changed """
|
""" Update the camera's image if it has changed. """
|
||||||
try:
|
try:
|
||||||
self._url = self._bloomsky.devices[self._id]["Data"]["ImageURL"]
|
self._url = self._bloomsky.devices[self._id]["Data"]["ImageURL"]
|
||||||
self._bloomsky.refresh_devices()
|
self._bloomsky.refresh_devices()
|
||||||
@ -56,5 +56,5 @@ class BloomSkyCamera(Camera):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
""" the name of this BloomSky device """
|
""" The name of this BloomSky device. """
|
||||||
return self._name
|
return self._name
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
"""
|
"""
|
||||||
homeassistant.components.sensor.bloomsky
|
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
|
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 logging
|
||||||
import homeassistant.components.bloomsky as bloomsky
|
import homeassistant.components.bloomsky as bloomsky
|
||||||
@ -12,7 +12,7 @@ from homeassistant.helpers.entity import Entity
|
|||||||
|
|
||||||
DEPENDENCIES = ["bloomsky"]
|
DEPENDENCIES = ["bloomsky"]
|
||||||
|
|
||||||
# these are the available sensors
|
# These are the available sensors
|
||||||
SENSOR_TYPES = ["Temperature",
|
SENSOR_TYPES = ["Temperature",
|
||||||
"Humidity",
|
"Humidity",
|
||||||
"Rain",
|
"Rain",
|
||||||
@ -21,19 +21,19 @@ SENSOR_TYPES = ["Temperature",
|
|||||||
"Night",
|
"Night",
|
||||||
"UVIndex"]
|
"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",
|
SENSOR_UNITS = {"Temperature": "°F",
|
||||||
"Humidity": "%",
|
"Humidity": "%",
|
||||||
"Pressure": "inHg",
|
"Pressure": "inHg",
|
||||||
"Luminance": "cd/m²"}
|
"Luminance": "cd/m²"}
|
||||||
|
|
||||||
# which sensors to format numerically
|
# Which sensors to format numerically
|
||||||
FORMAT_NUMBERS = ["Temperature", "Pressure"]
|
FORMAT_NUMBERS = ["Temperature", "Pressure"]
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
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__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
|
|
||||||
|
|
||||||
class BloomSkySensor(Entity):
|
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):
|
def __init__(self, bs, device, sensor_name):
|
||||||
self._bloomsky = bs
|
self._bloomsky = bs
|
||||||
@ -61,21 +61,21 @@ class BloomSkySensor(Entity):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
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)
|
return "{} {}".format(self._client_name, self._sensor_name)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
""" the current state (i.e. value) of this sensor """
|
""" The current state (i.e. value) of this sensor. """
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unit_of_measurement(self):
|
def unit_of_measurement(self):
|
||||||
""" this sensor's units """
|
""" This sensor's units. """
|
||||||
return SENSOR_UNITS.get(self._sensor_name, None)
|
return SENSOR_UNITS.get(self._sensor_name, None)
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
""" request an update from the BloomSky API """
|
""" Request an update from the BloomSky API. """
|
||||||
self._bloomsky.refresh_devices()
|
self._bloomsky.refresh_devices()
|
||||||
# TS is a Unix epoch timestamp for the last time the BloomSky servers
|
# 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
|
# 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
|
self._sensor_update = last_ts
|
||||||
|
|
||||||
def process_state(self, device):
|
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]
|
data = device["Data"][self._sensor_name]
|
||||||
if self._sensor_name == "Rain":
|
if self._sensor_name == "Rain":
|
||||||
if data:
|
if data:
|
||||||
|
@ -3,6 +3,9 @@ homeassistant.components.splunk
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Splunk component which allows you to send data to an Splunk instance
|
Splunk component which allows you to send data to an Splunk instance
|
||||||
utilizing the HTTP Event Collector.
|
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 json
|
||||||
import logging
|
import logging
|
||||||
|
Loading…
x
Reference in New Issue
Block a user