mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Update docstrings
This commit is contained in:
parent
0016ff6acc
commit
7d503e3f8b
@ -1,8 +1,10 @@
|
|||||||
"""
|
"""
|
||||||
homeassistant.components.motor
|
homeassistant.components.motor
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Motor component.
|
Motor component.
|
||||||
|
|
||||||
|
For more details about this platform, please refer to the documentation at
|
||||||
|
https://home-assistant.io/components/motor/
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
@ -100,12 +102,15 @@ class MotorDevice(Entity):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def current_position(self):
|
def current_position(self):
|
||||||
""" Return current position of motor.
|
"""
|
||||||
None is unknown, 0 is closed, 100 is fully open. """
|
Return current position of motor.
|
||||||
|
None is unknown, 0 is closed, 100 is fully open.
|
||||||
|
"""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
|
""" Returns the state of the motor. """
|
||||||
current = self.current_position
|
current = self.current_position
|
||||||
|
|
||||||
if current is None:
|
if current is None:
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
"""
|
"""
|
||||||
homeassistant.components.motor.mqtt
|
homeassistant.components.motor.mqtt
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Allows to configure a MQTT motor.
|
Allows to configure a MQTT motor.
|
||||||
|
|
||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/motor.mqtt/
|
https://home-assistant.io/components/motor.mqtt/
|
||||||
"""
|
"""
|
||||||
@ -40,7 +41,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
|||||||
|
|
||||||
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
||||||
class MqttMotor(MotorDevice):
|
class MqttMotor(MotorDevice):
|
||||||
""" Represents a motor that can be controlled using MQTT """
|
""" Represents a motor that can be controlled using MQTT. """
|
||||||
def __init__(self, hass, name, state_topic, command_topic, qos,
|
def __init__(self, hass, name, state_topic, command_topic, qos,
|
||||||
payload_open, payload_close, payload_stop, state_format):
|
payload_open, payload_close, payload_stop, state_format):
|
||||||
self._state = None
|
self._state = None
|
||||||
@ -76,13 +77,15 @@ class MqttMotor(MotorDevice):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
""" The name of the motor """
|
""" The name of the motor. """
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_position(self):
|
def current_position(self):
|
||||||
""" Return current position of motor.
|
"""
|
||||||
None is unknown, 0 is closed, 100 is fully open. """
|
Return current position of motor.
|
||||||
|
None is unknown, 0 is closed, 100 is fully open.
|
||||||
|
"""
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
def open(self, **kwargs):
|
def open(self, **kwargs):
|
||||||
|
@ -138,7 +138,7 @@ def setup(hass, config):
|
|||||||
|
|
||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
class _JsonFmtParser(object):
|
class _JsonFmtParser(object):
|
||||||
""" Implements a json parser on xpath. """
|
""" Implements a JSON parser on xpath. """
|
||||||
def __init__(self, jsonpath):
|
def __init__(self, jsonpath):
|
||||||
import jsonpath_rw
|
import jsonpath_rw
|
||||||
self._expr = jsonpath_rw.parse(jsonpath)
|
self._expr = jsonpath_rw.parse(jsonpath)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user