Update links to docs and doc strings (#1994)

This commit is contained in:
Fabian Affolter 2016-05-07 03:03:18 +02:00 committed by Paulus Schoutsen
parent 4a28be9a94
commit 98bedf1bd6
3 changed files with 14 additions and 19 deletions

View File

@ -1,11 +1,9 @@
""" """
Support for monitoring OctoPrint binary sensors. Support for monitoring OctoPrint binary sensors.
Uses OctoPrint REST JSON API to query for monitored variables. For more details about this platform, please refer to the documentation at
For more details about this component, please refer to the documentation at https://home-assistant.io/components/binary_sensor.octoprint/
http://docs.octoprint.org/en/master/api/
""" """
import logging import logging
import requests import requests
@ -51,7 +49,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
# pylint: disable=too-many-instance-attributes # pylint: disable=too-many-instance-attributes
class OctoPrintBinarySensor(BinarySensorDevice): class OctoPrintBinarySensor(BinarySensorDevice):
"""Represents an OctoPrint binary sensor.""" """Representation an OctoPrint binary sensor."""
# pylint: disable=too-many-arguments # pylint: disable=too-many-arguments
def __init__(self, api, condition, sensor_type, sensor_name, def __init__(self, api, condition, sensor_type, sensor_name,
@ -71,7 +69,7 @@ class OctoPrintBinarySensor(BinarySensorDevice):
self.api_tool = tool self.api_tool = tool
# Set initial state # Set initial state
self.update() self.update()
_LOGGER.debug("created OctoPrint binary sensor %r", self) _LOGGER.debug("Created OctoPrint binary sensor %r", self)
@property @property
def name(self): def name(self):
@ -108,4 +106,4 @@ class OctoPrintBinarySensor(BinarySensorDevice):
return return
if self._state is None: if self._state is None:
_LOGGER.warning("unable to locate value for %s", self.sensor_type) _LOGGER.warning("Unable to locate value for %s", self.sensor_type)

View File

@ -1,10 +1,9 @@
""" """
Support for monitoring OctoPrint 3D printers. Support for monitoring OctoPrint 3D printers.
Uses OctoPrint REST JSON API to query for monitored variables. For more details about this component, please refer to the documentation at
http://docs.octoprint.org/en/master/api/ https://home-assistant.io/components/octoprint/
""" """
import logging import logging
import time import time
@ -52,7 +51,7 @@ def setup(hass, config):
class OctoPrintAPI(object): class OctoPrintAPI(object):
"""Simple json wrapper for OctoPrint's api.""" """Simple JSON wrapper for OctoPrint's API."""
def __init__(self, api_url, key): def __init__(self, api_url, key):
"""Initialize OctoPrint API and set headers needed later.""" """Initialize OctoPrint API and set headers needed later."""
@ -109,7 +108,7 @@ class OctoPrintAPI(object):
# pylint: disable=unused-variable # pylint: disable=unused-variable
def get_value_from_json(json_dict, sensor_type, group, tool): def get_value_from_json(json_dict, sensor_type, group, tool):
"""Return the value for sensor_type from the provided json.""" """Return the value for sensor_type from the JSON."""
if group in json_dict: if group in json_dict:
if sensor_type in json_dict[group]: if sensor_type in json_dict[group]:
if sensor_type == "target" and json_dict[sensor_type] is None: if sensor_type == "target" and json_dict[sensor_type] is None:

View File

@ -1,11 +1,9 @@
""" """
Support for monitoring OctoPrint sensors. Support for monitoring OctoPrint sensors.
Uses OctoPrint REST JSON API to query for monitored variables. For more details about this platform, please refer to the documentation at
For more details about this component, please refer to the documentation at https://home-assistant.io/components/sensor.octoprint/
http://docs.octoprint.org/en/master/api/
""" """
import logging import logging
import requests import requests
@ -65,7 +63,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
# pylint: disable=too-many-instance-attributes # pylint: disable=too-many-instance-attributes
class OctoPrintSensor(Entity): class OctoPrintSensor(Entity):
"""Represents an OctoPrint sensor.""" """Representation of an OctoPrint sensor."""
# pylint: disable=too-many-arguments # pylint: disable=too-many-arguments
def __init__(self, api, condition, sensor_type, sensor_name, def __init__(self, api, condition, sensor_type, sensor_name,
@ -85,7 +83,7 @@ class OctoPrintSensor(Entity):
self.api_tool = tool self.api_tool = tool
# Set initial state # Set initial state
self.update() self.update()
_LOGGER.debug("created OctoPrint sensor %r", self) _LOGGER.debug("Created OctoPrint sensor %r", self)
@property @property
def name(self): def name(self):
@ -114,5 +112,5 @@ class OctoPrintSensor(Entity):
return return
if self._state is None: if self._state is None:
_LOGGER.warning("unable to locate value for %s", self.sensor_type) _LOGGER.warning("Unable to locate value for %s", self.sensor_type)
return return