Update links to docs and doc strings (#1994)
This commit is contained in:
parent
4a28be9a94
commit
98bedf1bd6
3 changed files with 14 additions and 19 deletions
|
@ -1,11 +1,9 @@
|
|||
"""
|
||||
Support for monitoring OctoPrint binary sensors.
|
||||
|
||||
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/
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/binary_sensor.octoprint/
|
||||
"""
|
||||
|
||||
import logging
|
||||
import requests
|
||||
|
||||
|
@ -51,7 +49,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
|
||||
# pylint: disable=too-many-instance-attributes
|
||||
class OctoPrintBinarySensor(BinarySensorDevice):
|
||||
"""Represents an OctoPrint binary sensor."""
|
||||
"""Representation an OctoPrint binary sensor."""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(self, api, condition, sensor_type, sensor_name,
|
||||
|
@ -71,7 +69,7 @@ class OctoPrintBinarySensor(BinarySensorDevice):
|
|||
self.api_tool = tool
|
||||
# Set initial state
|
||||
self.update()
|
||||
_LOGGER.debug("created OctoPrint binary sensor %r", self)
|
||||
_LOGGER.debug("Created OctoPrint binary sensor %r", self)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
@ -108,4 +106,4 @@ class OctoPrintBinarySensor(BinarySensorDevice):
|
|||
return
|
||||
|
||||
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)
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
"""
|
||||
Support for monitoring OctoPrint 3D printers.
|
||||
|
||||
Uses OctoPrint REST JSON API to query for monitored variables.
|
||||
http://docs.octoprint.org/en/master/api/
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/octoprint/
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
import time
|
||||
|
@ -52,7 +51,7 @@ def setup(hass, config):
|
|||
|
||||
|
||||
class OctoPrintAPI(object):
|
||||
"""Simple json wrapper for OctoPrint's api."""
|
||||
"""Simple JSON wrapper for OctoPrint's API."""
|
||||
|
||||
def __init__(self, api_url, key):
|
||||
"""Initialize OctoPrint API and set headers needed later."""
|
||||
|
@ -109,7 +108,7 @@ class OctoPrintAPI(object):
|
|||
|
||||
# pylint: disable=unused-variable
|
||||
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 sensor_type in json_dict[group]:
|
||||
if sensor_type == "target" and json_dict[sensor_type] is None:
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
"""
|
||||
Support for monitoring OctoPrint sensors.
|
||||
|
||||
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/
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/sensor.octoprint/
|
||||
"""
|
||||
|
||||
import logging
|
||||
import requests
|
||||
|
||||
|
@ -65,7 +63,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
|
||||
# pylint: disable=too-many-instance-attributes
|
||||
class OctoPrintSensor(Entity):
|
||||
"""Represents an OctoPrint sensor."""
|
||||
"""Representation of an OctoPrint sensor."""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(self, api, condition, sensor_type, sensor_name,
|
||||
|
@ -85,7 +83,7 @@ class OctoPrintSensor(Entity):
|
|||
self.api_tool = tool
|
||||
# Set initial state
|
||||
self.update()
|
||||
_LOGGER.debug("created OctoPrint sensor %r", self)
|
||||
_LOGGER.debug("Created OctoPrint sensor %r", self)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
@ -114,5 +112,5 @@ class OctoPrintSensor(Entity):
|
|||
return
|
||||
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue