Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modularize plugins #45

Open
wants to merge 27 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9be7e50
Migrates pull.simple to new plugin layout
HazardDede Feb 22, 2021
fe501fc
Migrates pull.monitor.Stats to new plugin layout
HazardDede Feb 22, 2021
de96e49
Migrates pull.tracking.FritzBoxTracker to new plugin layout
HazardDede Feb 23, 2021
9acf2d6
Make pylint happy
HazardDede Feb 23, 2021
1e97f35
Migrates pull.net package into the new plugin layout
HazardDede Feb 24, 2021
927fd56
Migrates pull.ftp.Server to new layout: pull.net.FTPServer
HazardDede Mar 2, 2021
f6de20b
Migrates GPIOWatcher to new plugin layout
HazardDede Mar 8, 2021
0e9b870
Migrates pull.io.FSSize to new plugin layout
HazardDede Mar 8, 2021
c9645b5
Migrates pull.io.FSWatcher to new plugin layout
HazardDede Mar 8, 2021
79b8c66
Migrates pull.mqtt.Subscribe to new plugin layout
HazardDede Mar 8, 2021
2d88654
Adds more waiting time to io.fswatcher tests
HazardDede Mar 9, 2021
575ebb3
Migrates pull.http.Server to new plugin layout
HazardDede Mar 15, 2021
ff76891
Migrates pull.http.ZwayFetch to new plugin layout
HazardDede Mar 15, 2021
0978c51
Migrates pull.sensor to new plugin layout
HazardDede Mar 15, 2021
40dba82
Migrates pull.fitbit to new plugin layout
HazardDede Mar 15, 2021
19b5384
Migrates pull.hass.State to new plugin layout
HazardDede Mar 15, 2021
293f39d
Enables mypy on whole plugins.pull
HazardDede Mar 15, 2021
499f0ce
Migrates push.fs.* to new plugin layout
HazardDede Mar 27, 2021
0508a0c
Migrates push.notify.Slack to new plugin layout
HazardDede Mar 27, 2021
bb6eea0
Fixes mypy issue with asyncio all_tasks / current_task
HazardDede Mar 27, 2021
989178c
Migrates push.http.Call to new plugin layout
HazardDede Mar 28, 2021
ba5f82b
Migrates push.simple.* to new plugin layout
HazardDede Mar 28, 2021
b9f5eb9
Migrates push.storage.Dropbox to new plugin layout
HazardDede Mar 28, 2021
4812b26
Merge branch 'develop' into feature/plugin_restructuring
HazardDede Apr 25, 2021
acb0ae9
Migrates push.hass.Service to new plugin layout
HazardDede May 26, 2021
ab4562d
Migrates push.storage.Influx to new plugin layout
HazardDede May 26, 2021
0c1fdc4
Migrates the remaining plugins to the new structure
HazardDede Aug 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/code-samples/advanced/dictmentor/repeat.pull
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Contents of repeat.pull
plugin: pnp.plugins.pull.simple.Repeat
args:
wait: 1
interval: 1
repeat: "{{env::MESSAGE}}"
2 changes: 1 addition & 1 deletion docs/source/code-samples/advanced/selector/basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ tasks:
pull:
plugin: pnp.plugins.pull.simple.Repeat
args:
wait: 1
interval: 1
repeat: "Hello World Moon Mars"
push:
- plugin: pnp.plugins.push.simple.Echo
Expand Down
2 changes: 1 addition & 1 deletion docs/source/code-samples/examples/backup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tasks:
expressions:
- "0 1 * * SUN /tmp"
push:
plugin: pnp.plugins.push.fs.Zipper
plugin: pnp.plugins.push.io.Zipper
deps:
- plugin: pnp.plugins.push.storage.Dropbox
args:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/code-samples/examples/face_recognition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
deps:
- plugin: pnp.plugins.push.simple.Echo
selector: (payload['known_faces'], payload['no_of_faces'])
- plugin: pnp.plugins.push.fs.FileDump
- plugin: pnp.plugins.push.io.FileDump
selector: payload['tagged_image']
args:
directory: '.'
Expand Down
2 changes: 1 addition & 1 deletion docs/source/code-samples/examples/monitoring_server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
tasks:
- name: stats_mqtt_pull
pull:
plugin: pnp.plugins.pull.mqtt.MQTTPull
plugin: pnp.plugins.pull.mqtt.Subscribe
args:
host: !env MQTT_HOST
topic: devices/+/stats/#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

- name: dropbox_sync_notify
pull:
plugin: pnp.plugins.pull.fs.FileSystemWatcher
plugin: pnp.plugins.pull.io.FSWatcher
args:
path: "/tmp"
ignore_directories: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
tasks:
- name: zway
pull:
plugin: pnp.plugins.pull.zway.ZwayPoll
plugin: pnp.plugins.pull.http.ZwayFetch
args:
url: "http://smarthome:8083/ZWaveAPI/Run/devices"
interval: 5s
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tasks:
- name: file_size
pull:
plugin: pnp.plugins.pull.fs.Size
plugin: pnp.plugins.pull.io.FSSize
args:
instant_run: true
interval: 5s
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tasks:
- name: file_watcher
pull:
plugin: pnp.plugins.pull.fs.FileSystemWatcher
plugin: pnp.plugins.pull.io.FSWatcher
args:
path: "/tmp"
ignore_directories: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tasks:
- name: gpio
pull:
plugin: pnp.plugins.pull.gpio.Watcher
plugin: pnp.plugins.pull.io.GPIOWatcher
args:
default: rising
pins:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tasks:
- name: ftp_server
pull:
plugin: pnp.plugins.pull.ftp.Server
plugin: pnp.plugins.pull.net.FTPServer
args:
directory: !env FTP_DIR
user_pwd: [admin, root] # user: admin, pw: root
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tasks:
- name: fritzbox_tracker
pull:
plugin: pnp.plugins.pull.presence.FritzBoxTracker
plugin: pnp.plugins.pull.tracking.FritzBoxTracker
args:
host: 169.254.1.1 # IP of your Fritz!Box. Default is 169.254.1.1
user: admin # User name. Default is admin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
tasks:
- name: fritzbox_tracker_whitelist
pull:
plugin: pnp.plugins.pull.presence.FritzBoxTracker
plugin: pnp.plugins.pull.tracking.FritzBoxTracker
args:
host: 169.254.1.1 # IP of your Fritz!Box. Default is 169.254.1.1
host: 192.168.178.1 # IP of your Fritz!Box. Default is 169.254.1.1
user: admin # User name. Default is admin
password: '' # Password. Default is an empty string
offline_delay: 0 # How many intervals to wait before marking a device as not connected after the fritzbox reported so
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ tasks:
args:
repeat: "Hello World"
push:
plugin: pnp.plugins.push.fs.FileDump
plugin: pnp.plugins.push.io.FileDump
args:
directory: !env WATCH_DIR
file_name: null # Auto-generated file (timestamp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ tasks:
args:
repeat: "Hello World"
push:
plugin: pnp.plugins.push.fs.FileDump
plugin: pnp.plugins.push.io.FileDump
# Override `file_name` and `extension` via envelope.
# Instead of an auto generated file, the file '/tmp/hello-world.hello' will be dumped.
selector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tasks:
expressions:
- "*/1 * * * * /path/to/backup"
push:
plugin: pnp.plugins.push.fs.Zipper
plugin: pnp.plugins.push.io.Zipper
args:
out_path: !env BACKUP_DIR
deps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tasks:
expressions:
- "*/1 * * * * /tmp/backup_folder"
push:
plugin: pnp.plugins.push.fs.Zipper
plugin: pnp.plugins.push.io.Zipper
args:
out_path: !env BACKUP_DIR
selector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ tasks:
pull:
plugin: pnp.plugins.pull.simple.Count # Let's count
args:
wait: 10
interval: 10
push:
- plugin: pnp.plugins.push.notify.Slack
selector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tasks:
host: mqtt
topic: home/#
push:
plugin: pnp.plugins.push.timedb.InfluxPush
plugin: pnp.plugins.push.storage.Influx
selector:
data: "lambda data: data"
args:
Expand Down
28 changes: 14 additions & 14 deletions docs/source/plugins/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,30 @@ arguments to control their polling behavior.

.. include:: pull/fitbit.Goal.rst

.. include:: pull/fs.FileSystemWatcher.rst
.. include:: pull/hass.State.rst

.. include:: pull/fs.Size.rst
.. include:: pull/http.Server.rst

.. include:: pull/ftp.Server.rst
.. include:: pull/http.ZwayFetch.rst

.. include:: pull/gpio.Watcher.rst
.. include:: pull/io.FSSize.rst

.. include:: pull/hass.State.rst
.. include:: pull/io.FSWatcher.rst

.. include:: pull/http.Server.rst
.. include:: pull/io.GPIOWatcher.rst

.. include:: pull/monitor.Stats.rst

.. include:: pull/mqtt.Subscribe.rst

.. include:: pull/net.FTPServer.rst

.. include:: pull/net.PortProbe.rst

.. include:: pull/net.Speedtest.rst

.. include:: pull/net.SSLVerify.rst

.. include:: pull/presence.FritzBoxTracker.rst

.. include:: pull/sensor.DHT.rst

.. include:: pull/sensor.MiFlora.rst
Expand All @@ -64,7 +64,7 @@ arguments to control their polling behavior.

.. include:: pull/simple.RunOnce.rst

.. include:: pull/zway.ZwayPoll.rst
.. include:: pull/tracking.FritzBoxTracker.rst


Pushes
Expand All @@ -79,14 +79,14 @@ and set the ``unwrap`` option to invoke a ``push`` for each element of an ``iter
Some ``pushes`` do support the ``envelope`` feature to alter the arguments for a ``push`` during
runtime: :ref:`Envelope <blocks_envelope>`

.. include:: push/fs.FileDump.rst

.. include:: push/fs.Zipper.rst

.. include:: push/hass.Service.rst

.. include:: push/http.Call.rst

.. include:: push/io.FileDump.rst

.. include:: push/io.Zipper.rst

.. include:: push/ml.FaceR.rst

.. include:: push/mqtt.Discovery.rst
Expand All @@ -105,7 +105,7 @@ and set the ``unwrap`` option to invoke a ``push`` for each element of an ``iter

.. include:: push/storage.Dropbox.rst

.. include:: push/timedb.InfluxPush.rst
.. include:: push/storage.Influx.rst

UDFs
----
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
zway.ZwayPoll
^^^^^^^^^^^^^
http.ZwayFetch
^^^^^^^^^^^^^^

================================ ====== ============ ========
plugin type extra version
================================ ====== ============ ========
pnp.plugins.pull.zway.ZwayPoll poll none < 0.10.0
pnp.plugins.pull.http.ZwayFetch poll none < 0.10.0
================================ ====== ============ ========

**Description**
Expand Down Expand Up @@ -62,5 +62,5 @@ Emits the content of the fetched url as it is.

**Example**

.. literalinclude:: ../code-samples/plugins/pull/zway.ZwayPoll/example.yaml
.. literalinclude:: ../code-samples/plugins/pull/http.ZwayFetch/example.yaml
:language: YAML
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
fs.Size
^^^^^^^
io.FSSize
^^^^^^^^^

================================ ====== ============ ========
plugin type extra version
================================ ====== ============ ========
pnp.plugins.pull.fs.Size poll none 0.17.0
pnp.plugins.pull.io.FSSize poll none 0.17.0
================================ ====== ============ ========

**Description**
Expand All @@ -13,13 +13,13 @@ Periodically determines the size of the specified files or directories in bytes.

**Arguments**

+---------------+-----------+------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| name | type | opt. | default | description |
+===============+===========+======+=========+=======================================================================================================================================================================================================+
| paths | List[str] | no | n/a | List of files and/or directories to monitor their sizes in bytes. |
+---------------+-----------+------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| fail_on_error | bool | yes | True | If set to true, the plugin will raise an error when a file/directory does not exists or any other file system related error occurs. Otherwise the plugin will proceed and simply report None as size. |
+---------------+-----------+------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+---------------+-----------------+------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| name | type | opt. | default | description |
+===============+=================+======+=========+=======================================================================================================================================================================================================+
| paths | Dict[str, path] | no | n/a | Mapping of files and/or directories (values) to monitor their sizes in bytes using an alias (keys). Alternative use a list of files/directories. The alias will be the basename of the file/directory.|
+---------------+-----------------+------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| fail_on_error | bool | yes | True | If set to true, the plugin will raise an error when a file/directory does not exists or any other file system related error occurs. Otherwise the plugin will proceed and simply report None as size. |
+---------------+-----------------+------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

.. NOTE::

Expand All @@ -39,5 +39,5 @@ Example of an emitted message. Size is in bytes.

**Example**

.. literalinclude:: ../code-samples/plugins/pull/fs.Size/example.yaml
.. literalinclude:: ../code-samples/plugins/pull/io.FSSize/example.yaml
:language: YAML
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
fs.FileSystemWatcher
io.FSWatcher
^^^^^^^^^^^^^^^^^^^^

====================================== ====== ============ ========
plugin type extra version
====================================== ====== ============ ========
pnp.plugins.pull.fs.FileSystemWatcher pull fswatcher < 0.10.0
pnp.plugins.pull.io.FSWatcher pull fswatcher < 0.10.0
====================================== ====== ============ ========

**Description**
Expand Down Expand Up @@ -64,5 +64,5 @@ Example of an emitted message:

**Example**

.. literalinclude:: ../code-samples/plugins/pull/fs.FileSystemWatcher/example.yaml
.. literalinclude:: ../code-samples/plugins/pull/io.FSWatcher/example.yaml
:language: YAML
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
gpio.Watcher
^^^^^^^^^^^^
io.GPIOWatcher
^^^^^^^^^^^^^^

================================ ====== ============ ========
plugin type extra version
================================ ====== ============ ========
pnp.plugins.pull.gpio.Watcher poll gpio 0.12.0
pnp.plugins.pull.io.GPIOWatcher poll gpio 0.12.0
================================ ====== ============ ========

**Description**
Expand Down Expand Up @@ -32,8 +32,6 @@ In more detail the plugin can raise events when one of the following situations

**Result**

Emits a dictionary that contains an entry for every sensor of the plant sensor device:


.. code-block:: python

Expand All @@ -44,5 +42,5 @@ Emits a dictionary that contains an entry for every sensor of the plant sensor d

**Example**

.. literalinclude:: ../code-samples/plugins/pull/gpio.Watcher/example.yaml
.. literalinclude:: ../code-samples/plugins/pull/io.GPIOWatcher/example.yaml
:language: YAML
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
ftp.Server
net.FTPServer
^^^^^^^^^^^^^^

================================ ====== ============ ========
plugin type extra version
================================ ====== ============ ========
pnp.plugins.pull.ftp.Server pull ftp 0.17.0
pnp.plugins.pull.net.FTPServer pull ftp 0.17.0
================================ ====== ============ ========

**Description**
Expand Down Expand Up @@ -49,5 +49,5 @@ The data field will contain the user for login/logout events and the file_path f

**Example**

.. literalinclude:: ../code-samples/plugins/pull/ftp.Server/example.yaml
.. literalinclude:: ../code-samples/plugins/pull/net.FTPServer/example.yaml
:language: YAML
Loading