From 905d6632e01c700695e20807d2cadc4f87226662 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Fri, 29 Sep 2023 18:08:16 +0200 Subject: [PATCH] Misc documentation improvements. --- docs/source/conf.py | 7 ++----- platypush/plugins/bluetooth/__init__.py | 4 ++-- platypush/plugins/camera/pi/__init__.py | 5 +++-- platypush/plugins/light/hue/__init__.py | 2 +- platypush/plugins/serial/__init__.py | 8 ++------ platypush/plugins/zigbee/mqtt/__init__.py | 23 ++++++++++++----------- 6 files changed, 22 insertions(+), 27 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index f44f1488b..4b159dc63 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -15,17 +15,14 @@ import sys # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) sys.path.insert(0, os.path.abspath("./_ext")) # -- Project information ----------------------------------------------------- project = 'Platypush' -copyright = '2017-2021, Fabio Manganiello' -author = 'Fabio Manganiello' +copyright = '2017-2023, Fabio Manganiello' +author = 'Fabio Manganiello ' # The short X.Y version version = '' diff --git a/platypush/plugins/bluetooth/__init__.py b/platypush/plugins/bluetooth/__init__.py index e730c7d52..ae8be5de9 100644 --- a/platypush/plugins/bluetooth/__init__.py +++ b/platypush/plugins/bluetooth/__init__.py @@ -41,8 +41,8 @@ class BluetoothPlugin(RunnablePlugin, EnumSwitchEntityManager): """ Plugin to interact with Bluetooth devices. - This plugin uses `_Bleak_ `_ to interact - with the Bluetooth stack and `_Theengs_ `_ + This plugin uses `Bleak `_ to interact + with the Bluetooth stack and `Theengs `_ to map the services exposed by the devices into native entities. The full list of devices natively supported can be found diff --git a/platypush/plugins/camera/pi/__init__.py b/platypush/plugins/camera/pi/__init__.py index 74e67a424..cd5582211 100644 --- a/platypush/plugins/camera/pi/__init__.py +++ b/platypush/plugins/camera/pi/__init__.py @@ -13,8 +13,9 @@ class CameraPiPlugin(CameraPlugin): Plugin to control a Pi camera. .. warning:: - This plugin is **DEPRECATED*, as it relies on the old ``picamera`` module. - On recent systems, it should be possible to access the Pi Camera through the FFmpeg or GStreamer integrations. + This plugin is **DEPRECATED**, as it relies on the old ``picamera`` module. + On recent systems, it should be possible to access the Pi Camera through + the ffmpeg or gstreamer integrations. """ diff --git a/platypush/plugins/light/hue/__init__.py b/platypush/plugins/light/hue/__init__.py index edb42a6d6..1bc8769f1 100644 --- a/platypush/plugins/light/hue/__init__.py +++ b/platypush/plugins/light/hue/__init__.py @@ -76,7 +76,7 @@ class LightHuePlugin(RunnablePlugin, LightEntityManager): """ :param bridge: Bridge address or hostname :param lights: Default lights to be controlled (default: all) - :param groups Default groups to be controlled (default: all) + :param groups: Default groups to be controlled (default: all) :param poll_interval: How often the plugin should check the bridge for light updates (default: 20 seconds). :param config_file: Path to the phue configuration file containing the diff --git a/platypush/plugins/serial/__init__.py b/platypush/plugins/serial/__init__.py index ee07cdaf9..e9cfc0ca2 100644 --- a/platypush/plugins/serial/__init__.py +++ b/platypush/plugins/serial/__init__.py @@ -58,7 +58,7 @@ class SerialPlugin(SensorPlugin): def __init__( self, - device: Optional[str] = None, + device: str, baud_rate: int = 9600, max_size: int = 1 << 19, timeout: float = _default_lock_timeout, @@ -67,7 +67,7 @@ class SerialPlugin(SensorPlugin): **kwargs, ): """ - :param device: Device path (e.g. ``/dev/ttyUSB0`` or ``/dev/ttyACM0``) + :param device: Device path (e.g. ``/dev/ttyUSB0`` or ``/dev/ttyACM0``). :param baud_rate: Serial baud rate (default: 9600) :param max_size: Maximum size of a JSON payload (default: 512 KB). The plugin will keep reading bytes from the wire until it can form a @@ -195,9 +195,6 @@ class SerialPlugin(SensorPlugin): :param device: Default device path override. :param baud_rate: Default baud rate override. - :param reset: By default, if a connection to the device is already open - then the current object will be returned. If ``reset=True``, the - connection will be reset and a new one will be created instead. """ try: return self.__get_serial(device, baud_rate) @@ -262,7 +259,6 @@ class SerialPlugin(SensorPlugin): """ device, baud_rate = self._get_device_and_baud_rate(device, baud_rate) - data = None with get_lock(self.serial_lock, timeout=self._timeout) as serial_available: if serial_available: diff --git a/platypush/plugins/zigbee/mqtt/__init__.py b/platypush/plugins/zigbee/mqtt/__init__.py index c725d918e..75bf47d70 100644 --- a/platypush/plugins/zigbee/mqtt/__init__.py +++ b/platypush/plugins/zigbee/mqtt/__init__.py @@ -112,8 +112,10 @@ class ZigbeeMqttPlugin( .. code-block:: shell - wget https://github.com/Koenkk/Z-Stack-firmware/raw/master\ - /coordinator/Z-Stack_Home_1.2/bin/default/CC2531_DEFAULT_20201127.zip + # Check out the latest version of the coordinator firmware at + # https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator + + wget https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator//bin/default/.zip unzip CC2531_DEFAULT_20201127.zip [sudo] cc-tool -e -w CC2531ZNP-Prod.hex @@ -129,19 +131,18 @@ class ZigbeeMqttPlugin( .. code-block:: shell # Clone zigbee2mqtt repository - [sudo] git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt - [sudo] chown -R pi:pi /opt/zigbee2mqtt # Or whichever is your user - - # Install dependencies (as user "pi") - cd /opt/zigbee2mqtt + export ZIGBEE2MQTT_DIR="$HOME/zigbee2mqtt" + git clone https://github.com/Koenkk/zigbee2mqtt.git "$ZIGBEE2MQTT_DIR" + cd "$ZIGBEE2MQTT_DIR" + # Install dependencies npm install - You need to have an MQTT broker running somewhere. If not, you can install `Mosquitto `_ through your package manager on any device in your network. - - Edit the ``/opt/zigbee2mqtt/data/configuration.yaml`` file to match - the configuration of your MQTT broker: + - Edit ``$ZIGBEE2MQTT_DIR/data/configuration.yaml`` file to match the configuration of + your MQTT broker: .. code-block:: yaml @@ -169,7 +170,7 @@ class ZigbeeMqttPlugin( .. code-block:: shell - cd /opt/zigbee2mqtt + cd "$ZIGBEE2MQTT_DIR" npm start - If you have Zigbee devices that are paired to other bridges, unlink @@ -205,7 +206,7 @@ class ZigbeeMqttPlugin( :param host: Default MQTT broker where ``zigbee2mqtt`` publishes its messages. :param port: Broker listen port (default: 1883). :param topic_prefix: Prefix for the published topics, as specified in - ``/opt/zigbee2mqtt/data/configuration.yaml`` (default: '``zigbee2mqtt``'). + ``ZIGBEE2MQTT_DIR/data/configuration.yaml`` (default: '``zigbee2mqtt``'). :param base_topic: Legacy alias for ``topic_prefix`` (default: '``zigbee2mqtt``'). :param timeout: If the command expects from a response, then this