Fixed docs

This commit is contained in:
Fabio Manganiello 2020-01-09 23:40:59 +01:00
parent f2de1015a8
commit 4c3140c9b5
18 changed files with 80 additions and 95 deletions

View file

@ -45,6 +45,7 @@ Backends
platypush/backend/sensor.distance.vl53l1x.rst
platypush/backend/sensor.envirophat.rst
platypush/backend/sensor.ir.zeroborg.rst
platypush/backend/sensor.leap.rst
platypush/backend/sensor.ltr559.rst
platypush/backend/sensor.mcp3008.rst
platypush/backend/sensor.motion.pwm3901.rst

View file

@ -23,8 +23,8 @@ import sys
# -- Project information -----------------------------------------------------
project = 'platypush'
copyright = '2018, BlackLight'
author = 'BlackLight'
copyright = '2017-2019, Fabio Manganiello'
author = 'Fabio Manganiello'
# The short X.Y version
version = ''
@ -49,6 +49,7 @@ extensions = [
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinx_rtd_theme',
]
# Add any paths that contain templates here, relative to this directory.
@ -84,8 +85,8 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# html_theme = 'alabaster'
html_theme = 'nature'
# html_theme = 'haiku'
html_theme = 'sphinx_rtd_theme'
html_domain_indices = True

View file

@ -1,6 +0,0 @@
``platypush.backend``
=====================
.. automodule:: platypush.backend
:members:

View file

@ -1,6 +0,0 @@
``platypush.backend.camera``
============================
.. automodule:: platypush.backend.camera
:members:

View file

@ -1,6 +0,0 @@
``platypush.backend.http.request.rss``
======================================
.. automodule:: platypush.backend.http.request.rss
:members:

View file

@ -1,6 +0,0 @@
``platypush.backend.weather.forecast``
======================================
.. automodule:: platypush.backend.weather.forecast
:members:

View file

@ -1,6 +0,0 @@
``platypush.plugins.weather.forecast``
======================================
.. automodule:: platypush.plugins.weather.forecast
:members:

View file

@ -18,15 +18,15 @@ class LocalBackend(Backend):
You can use this backend either to send local commands to push through
Pusher (or any other script), or debug. You can even send command on the
command line and read the responses in this way:
command line and read the responses in this way::
# Send the request. Remember: the JSON must be all on one line.
$ cat <<EOF > /tmp/platypush-requests.fifo
{"type": "request", "target": "node_name", "action": "shell.exec", "args": {"cmd":"echo ping"}, "origin": "node_name", "id": "put_an_id_here"}
EOF
$ cat /tmp/platypush-responses.fifo
ping
$
# Send the request. Remember: the JSON must be all on one line.
$ cat <<EOF > /tmp/platypush-requests.fifo
{"type": "request", "target": "node_name", "action": "shell.exec", "args": {"cmd":"echo ping"}, "origin": "node_name", "id": "put_an_id_here"}
EOF
$ cat /tmp/platypush-responses.fifo
ping
$
"""
def __init__(self, request_fifo, response_fifo, **kwargs):

View file

@ -69,8 +69,7 @@ class Event(Message):
def matches_condition(self, condition):
"""
If the event matches an event condition, it will return an EventMatchResult
Params:
-- condition -- The platypush.event.hook.EventCondition object
:param condition: The platypush.event.hook.EventCondition object
"""
result = EventMatchResult(is_match=False, parsed_args=self.args)
@ -207,12 +206,11 @@ class StopEvent(Event):
def __init__(self, target, origin, thread_id, id=None, **kwargs):
""" Constructor.
Params:
target -- Target node
origin -- Origin node
thread_id -- thread_iden() to be terminated if listening on the bus
id -- Event ID (default: auto-generated)
kwargs -- Extra key-value arguments
:param target: Target node
:param origin: Origin node
:param thread_id: thread_iden() to be terminated if listening on the bus
:param id: Event ID (default: auto-generated)
:param kwargs: Extra key-value arguments
"""
super().__init__(target=target, origin=origin, id=id,

View file

@ -139,7 +139,7 @@ class GoogleDrivePlugin(GooglePlugin):
:param path: Path of the file to upload.
:param mime_type: MIME type of the source file (e.g. "``image/jpeg``").
:param name: Name of the target file. Default: same name as the source file.
:param description; File description.
:param description: File description.
:param parents: List of folder IDs that will contain the file (default: drive root).
:param starred: If True, then the uploaded file will be marked as starred by the user.
:param target_mime_type: Target MIME type. Useful if you want to e.g. import a CSV file as a Google Sheet

View file

@ -38,14 +38,16 @@ class GpioSensorBme280Plugin(GpioSensorPlugin):
@action
def get_measurement(self):
"""
:returns: dict. Example::
:returns: dict. Example:
output = {
"temperature": 21.0, # Celsius
"pressure": 101555.08, # Pascals
"humidity": 23.543, # percentage
"altitude": 15.703 # meters
}
.. code-block:: python
output = {
"temperature": 21.0, # Celsius
"pressure": 101555.08, # Pascals
"humidity": 23.543, # percentage
"altitude": 15.703 # meters
}
"""

View file

@ -45,7 +45,9 @@ class GpioSensorDistanceVl53L1XPlugin(GpioSensorPlugin):
:param medium: Enable medium range measurement (default: False)
:param long: Enable long range measurement (default: False)
:returns: dict. Example::
:returns: dict. Example:
.. code-block:: python
output = {
"short": 83, # Short range measurement in mm

View file

@ -19,28 +19,30 @@ class GpioSensorEnvirophatPlugin(GpioSensorPlugin):
:param: qnh: Local value for atmospheric pressure adjusted to sea level (default: 1020)
:type qnh: float
:returns: dict. Example::
:returns: dict. Example:
output = {
"temperature": 21.0, # Celsius
"pressure": 101555.08, # pascals
"altitude": 10, # meters
"luminosity": 426, # lumens
.. code-block:: python
# Measurements from the custom analog channels
"analog": [0.513, 0.519, 0.531, 0.528],
output = {
"temperature": 21.0, # Celsius
"pressure": 101555.08, # pascals
"altitude": 10, # meters
"luminosity": 426, # lumens
"accelerometer": {
"x": -0.000915,
"y": 0.0760,
"z": 1.026733
},
"magnetometer": {
"x": -2297,
"y": 1226,
"z": -7023
},
}
# Measurements from the custom analog channels
"analog": [0.513, 0.519, 0.531, 0.528],
"accelerometer": {
"x": -0.000915,
"y": 0.0760,
"z": 1.026733
},
"magnetometer": {
"x": -2297,
"y": 1226,
"z": -7023
},
}
"""

View file

@ -19,12 +19,14 @@ class GpioSensorLtr559Plugin(GpioSensorPlugin):
@action
def get_measurement(self):
"""
:returns: dict. Example::
:returns: dict. Example:
output = {
"light": 109.3543, # Lux
"proximity": 103 # The higher the value, the nearest the object, within a ~5cm range
}
.. code-block:: python
:
output = {
"light": 109.3543, # Lux
"proximity": 103 # The higher the value, the nearest the object, within a ~5cm range
}
"""

View file

@ -82,14 +82,16 @@ class GpioSensorMotionPwm3901Plugin(GpioSensorPlugin):
@action
def get_measurement(self):
"""
:returns: dict. Example::
:returns: dict. Example:
output = {
"motion_x": 3, # Detected motion vector X-coord
"motion_y": 4, # Detected motion vector Y-coord
"motion_mod": 5 # Detected motion vector module
"motion_events_per_sec": 7 # Number of motion events detected in the last second
}
.. code-block:: python
output = {
"motion_x": 3, # Detected motion vector X-coord
"motion_y": 4, # Detected motion vector Y-coord
"motion_mod": 5 # Detected motion vector module
"motion_events_per_sec": 7 # Number of motion events detected in the last second
}
"""

View file

@ -384,7 +384,9 @@ class MediaPlugin(Plugin):
the streaming link instead of streaming it
:type download: bool
:returns: dict containing the streaming URL.Example::
:return: dict containing the streaming URL.Example:
.. code-block:: json
{
"id": "0123456abcdef.mp4",
@ -392,6 +394,7 @@ class MediaPlugin(Plugin):
"mime_type": "video/mp4",
"url": "http://192.168.1.2:8008/media/0123456abcdef.mp4"
}
"""
import requests

View file

@ -10,10 +10,12 @@ class MediaCtrlPlugin(Plugin):
"""
Wrapper plugin to control audio and video media.
Examples of supported URL types:
- file:///media/movies/Movie.mp4 [requires media plugin enabled]
- youtube:video:poAk9XgK7Cs [requires media plugin+youtube-dl]
- magnet:?torrent_magnet [requires torrentcast]
- spotify:track:track_id [leverages plugins.music.mpd]
"""
_supported_plugins = {

View file

@ -358,9 +358,9 @@ class MobileJoinPlugin(Plugin):
displayed lower in the notification list. Values from -2 (lowest priority) to 2 (highest priority).
Default is 2.
:param vibration_pattern: If the notification is received on an Android device, the vibration pattern in this
field will change the way the device vibrates with it. You can easily create a pattern by going
`here <http://autoremotejoaomgcd.appspot.com/AutoRemoteNotification.html>`_ and generating the pattern in
the Vibration Pattern field
field will change the way the device vibrates with it. You can easily create a pattern by going to the
`AutoRemote notification page <http://autoremotejoaomgcd.appspot.com/AutoRemoteNotification.html>`_
and generate the pattern in the Vibration Pattern field
:type vibration_pattern: str (comma-separated float values) or list[float]
:param dismiss_on_touch: If set the notification will be dismissed when touched (default: False)
:param image: Publicly available URL for an image to show up in the notification
@ -368,7 +368,7 @@ class MobileJoinPlugin(Plugin):
:param sound: Publicly available URL for a sound to play with the notification
:param actions: Set notification buttons with customized behaviour. This parameter is a list of Join actions
configured on the target device that will be mapped to notification input elements.
More info `here <https://joaoapps.com/join/actions/#notifications>`_
More info `on the Joaoapps notifications page <https://joaoapps.com/join/actions/#notifications>`_
"""
params = {'dismissOnTouch': dismiss_on_touch}