Commit graph

1423 commits

Author SHA1 Message Date
Fabio Manganiello c05d887551
[application] Added application.install action.
All checks were successful
continuous-integration/drone/push Build is passing
It can be used to programmatically install extensions.
2023-10-18 19:33:00 +02:00
Fabio Manganiello 81e99a0e22
[shell] Better buffering for the output sent to websockets. 2023-10-18 03:00:52 +02:00
Fabio Manganiello 66cba233e5
[config] Added config.get_config_file action. 2023-10-18 03:00:51 +02:00
Fabio Manganiello 20a2203e7e
[Shell plugin] Added support for async output over websockets. 2023-10-18 03:00:51 +02:00
Fabio Manganiello 891e05a219
[Execute UI] Added syntax highlight to JSON and shell snippets.
All checks were successful
continuous-integration/drone/push Build is passing
2023-10-13 23:12:04 +02:00
Fabio Manganiello e382ad7650 Invert @ensure_initialized and @action annotations.
Otherwise, we won't be able to access the wrapped function from the
inspection logic.
2023-10-12 00:57:31 +00:00
Fabio Manganiello 1b6e9b4df9
Fixed a broken docstring reference. 2023-10-10 22:18:36 +02:00
Fabio Manganiello 52e353dc14
Expose the wrapped function in @action.
Added a `wrapped` "hidden" parameter to the function returned by the
`@action` decorator.

We need this to access the underlying decorated function when e.g. we
need to access its specs or decorators.
2023-10-09 22:35:08 +02:00
Fabio Manganiello 1e93af86f4
Fixed some broken docstring references.
All checks were successful
continuous-integration/drone/push Build is passing
2023-10-09 01:33:45 +02:00
Fabio Manganiello 53bdcb9604
A major rewrite of the inspect plugin.
- The `inspect` plugin and the Sphinx inspection extensions now use the
  same underlying logic.

- Moved all the common inspection logic under
  `platypush.common.reflection`.

- Faster scanning of the available integrations and components through a
  pool of threads.

- Added `doc_url` parameters.

- Migrated events and responses metadata scanning logic.

- Now expanding some custom Sphinx tag instead of returning errors when
  running outside of the Sphinx context - it includes `:class:`,
  `:meth:` and `.. schema::`.
2023-10-09 01:33:45 +02:00
Fabio Manganiello 4d52fd35b9
Skip None responses in the RSS plugin.
All checks were successful
continuous-integration/drone/push Build is passing
2023-10-04 22:08:11 +02:00
Fabio Manganiello 40d3ad1150
Removed <type> | None type hints.
All checks were successful
continuous-integration/drone/push Build is passing
They break on Python < 3.10.
2023-10-03 01:15:13 +02:00
Fabio Manganiello 3086dd86fc
LINT+Black+stability fixes for some plugins that hadn't been touched in a while.
All checks were successful
continuous-integration/drone/push Build is passing
- media.mplayer
- media.omxplayer
- media.vlc
- music.mpd
- music.snapcast
2023-10-01 22:55:06 +02:00
Fabio Manganiello 2aefc4e5c8
Several improvements for the Google integrations.
1. Improved documentation. Every plugin now reports the exact steps to
   get the integration up and running with the right API scopes.

2. All Google plugins now have a standard process to get (and reuse) the
   client secret. Except for PubSub, Translate and Maps (which have
   their own flows), all the Google plugins now read the client secrets
   from `<WORKDIR>/credentials/google/client_secret.json` by default.

3. Black/LINT for some of those plugins, which hadn't been touched in a
   while.

4. The interface to pass API scopes is now leaner. It's now possible to
   pass a scope directly as e.g. `calendar.readonly` rather than
   `https://www.googleapis.com/auth/calendar.readonly`.

5. Improved the logic to retrieve the right scope tokens file. If e.g.
   an integration requires the role `A`, and a credentials file exists
   for the roles `A` and `B`, then this file will be used rather than
   prompting the user to authenticate again.
2023-10-01 15:37:20 +02:00
Fabio Manganiello 5ca3757834
A more readable configuration for the calendar plugin.
The old type configuration
(`platypush.plugins.calendar.name.CalendarNamePlugin`) is a bit clunky.

Instead, since the type will always be a plugin, we should encourage
the use of `calendar.name` directly to identify the type.
2023-10-01 01:09:15 +02:00
Fabio Manganiello 966a6ce29e
httplib2 should be an explicit dependency for Google integrations.
Plus, some misc LINT/Black chores.
2023-10-01 00:52:59 +02:00
Fabio Manganiello 532f5479b3
Added full YAML example for chat.irc configuration. 2023-09-30 14:34:54 +02:00
Fabio Manganiello 4f5ccda353
Better documentation for the calendar plugin. 2023-09-30 13:31:41 +02:00
Fabio Manganiello 15d06fa5c2
Improved docstring parser logic.
Some checks failed
continuous-integration/drone/push Build is failing
2023-09-30 12:35:31 +02:00
Fabio Manganiello 905d6632e0
Misc documentation improvements. 2023-09-29 18:09:15 +02:00
Fabio Manganiello 0a3ec4b9f1
Merge branch 'master' into 311/auto-generate-deps-docs 2023-09-28 01:25:29 +02:00
Fabio Manganiello b76f141b61
Catch response write errors in the MQTT callback.
All checks were successful
continuous-integration/drone/push Build is passing
If the client that forwarded the request is no longer available (either
because an exception or a timeout was raised) then its I/O buffer and
event loop may be closed.

In this case, the response callback should handle and report the
exception, and still set the event, so that any other threads waiting
for the response can move on.
2023-09-27 11:23:55 +02:00
Fabio Manganiello ca7f042ccc
We shouldn't call dateutil.parser if t has already been deserialized to a datetime. 2023-09-27 11:20:10 +02:00
Fabio Manganiello c311987741
Removed typing.Final from some of the most commonly used modules.
All checks were successful
continuous-integration/drone/push Build is passing
`typing.Final` is not defined on Python < 3.8.
2023-09-26 23:50:10 +02:00
Fabio Manganiello 9298f52443
Moved BluetoothPlugin to __init__.py.
All checks were successful
continuous-integration/drone/push Build is passing
This is for consistency with other plugins, that all have their main
plugin class definition inside of `__init__.py`.
2023-09-24 19:21:53 +02:00
Fabio Manganiello c3337ccc6c
[#311] Docs deps autogen sphinx plugin.
All checks were successful
continuous-integration/drone/push Build is passing
Added an `add_dependencies` plugin to the Sphinx build process that
parses the manifest files of the scanned backends and plugins and
automatically generates the documentation for the required dependencies
and triggered events.

This means that those dependencies are no longer required to be listed
in the docstring of the class itself.

Also in this commit:

- Black/LINT for some integrations that hadn't been touched in a long
  time.

- Deleted some leftovers from previous refactors (deprecated
  `backend.mqtt`, `backend.zwave.mqtt`, `backend.http.request.rss`).

- Deleted deprecated `inotify` backend - replaced by `file.monitor` (see
  #289).
2023-09-24 17:00:08 +02:00
Fabio Manganiello 059f7a4b11 Merge branch 'master' into 316/rpm-support
All checks were successful
continuous-integration/drone/push Build is passing
2023-09-23 16:21:48 +02:00
Fabio Manganiello b797add90d
Modify shebang header for Mercury JS script.
The RPM build process wants an absolute path.
2023-09-23 16:16:13 +02:00
Fabio Manganiello 79e24461cb
Coalesce to empty list if zigbee.mqtt.devices returns null.
All checks were successful
continuous-integration/drone/push Build is passing
2023-09-22 17:00:53 +02:00
Fabio Manganiello 55965e962c
Store the Philips Hue bridge configuration under our workdir.
By default, the `phue` library will store the file containing the token
and the bridge configuration under `~/.python_hue`.

That's outside of our application folder, and it can't easily be copied
around or added to Docker volumes.

We should instead have it under `<WORKDIR>/light.hue/config.json`, in
line with what the other plugins do, and if `~/.python_hue` is available
but `<WORKDIR>/light.hue/config.json` isn't then we should copy the
legacy file to the new one.
2023-09-22 16:58:44 +02:00
Fabio Manganiello 761f2768cb
[#316] Added RPM dependencies.
All checks were successful
continuous-integration/drone/push Build is passing
2023-09-21 23:20:06 +02:00
Fabio Manganiello a6efaad26d
[#306] Removed Travis CI integration.
All checks were successful
continuous-integration/drone/push Build is passing
I've tried my best to keep it around, but the endpoints seem to be
broken, they no longer have a link to their API v3 documentation, and
the API Explorer that was supposed to be in the dashboard is gone.
2023-09-20 23:31:58 +02:00
Fabio Manganiello 3e8d6bb01e Removed typing-extensions dependency.
Some checks failed
continuous-integration/drone/push Build is failing
The package isn't present on older versions of Debian.
2023-09-18 14:05:39 +02:00
Fabio Manganiello 07c88c9530
Added logic to prevent socket leakage from paho-mqtt upon client stop.
All checks were successful
continuous-integration/drone/push Build is passing
2023-09-17 23:43:56 +02:00
Fabio Manganiello 3f4168eb69
Support for new Quality enumeration constants on tidalapi.
All checks were successful
continuous-integration/drone/push Build is passing
2023-09-17 22:40:26 +02:00
Fabio Manganiello c6cda86b1c
LINT/regex fix for ESP plugin. 2023-09-17 17:10:40 +02:00
Fabio Manganiello 2e004c1a1e
get_all_plugins should use Message.Encoder for encoding the response.
All checks were successful
continuous-integration/drone/push Build is passing
Some plugin information may include enums, tuples and other types that
aren't serializable by the default JSON serializer.
2023-09-17 02:11:52 +02:00
Fabio Manganiello 2fcd623c51
Migrated zwave.mqtt integration.
All checks were successful
continuous-integration/drone/push Build is passing
Merged the zwave.mqtt plugin with the listener and removed the
leftovers of the legacy zwave plugin.
2023-09-16 03:58:19 +02:00
Fabio Manganiello 2c93049ee5
Catch all the exceptions in a plugin action wrapper.
The @action decorator should capture all the exceptions,
log them and return them on `Response.errors`.

This ensures that uncaught exceptions from plugin
actions won't unwind out of control, and also that they
are logged and treated consistently across all the
integrations.
2023-09-14 23:08:23 +02:00
Fabio Manganiello ac72b2f7a8
Fixed management of state on zigbee.mqtt.
Before the merge of the plugin and the listener those components
used to have their own separate state, which led to inconsistencies.
2023-09-14 23:05:27 +02:00
Fabio Manganiello 5a514fdcce
Only support the run_topic logic on the MQTT plugin.
Plugins that extend `MqttPlugin` shouldn't run messages as
requests, even if the parent MQTT plugin is configured to
do so.
2023-09-14 01:09:03 +02:00
Fabio Manganiello 4cb5aa7acb
Prepend the class name to the string used to generate the MQTT client_id hash.
If we include the class name by default then we won't have to
explicitly modify the client_id in the implementation classes
in order to prevent clashes.
2023-09-14 01:06:53 +02:00
Fabio Manganiello ddd8f1afdc
base_topic param in zigbee.mqtt renamed to topic_prefix.
This is for sake of consistency with other integrations (like
`zwave.mqtt`) that also use the same parameter name for the MQTT topic
prefix.
2023-09-07 21:32:56 +02:00
Fabio Manganiello 3de510da68
Migrated zigbee.mqtt integration.
All checks were successful
continuous-integration/drone/push Build is passing
The plugin has been migrated to the new `mqtt` API and the legacy
listener that extended `MqttBackend` has been removed and merged into
the plugin.
2023-09-06 02:44:56 +02:00
Fabio Manganiello 33a1ef39e4
Refactored and merged backend.mqtt logic into mqtt plugin. 2023-09-06 02:43:45 +02:00
Fabio Manganiello b6c0ff799b
Rewritten the http.webpage plugin. 2023-09-03 17:33:25 +02:00
Fabio Manganiello 669f2eb2d2
LINT/black for tts.mimic3 plugin. 2023-09-02 12:40:34 +02:00
Fabio Manganiello 35416f3ee3
Some LINT on the old http.request.rss plugin. 2023-09-02 01:01:16 +02:00
Fabio Manganiello 2c46b6fe14
Added git a required manifest dependency when needed.
It is needed for packages that install pip packages via git.
2023-08-20 21:19:15 +02:00
Fabio Manganiello a99ffea37c
Fixed apt dependencies for mpd plugin. 2023-08-19 21:46:08 +02:00