Commit Graph

375 Commits

Author SHA1 Message Date
Fabio Manganiello 3c88593e9a
[#293] Merged `midi` plugin and backend.
continuous-integration/drone/push Build is passing Details
Closes: #293
2024-05-06 02:26:27 +02:00
Fabio Manganiello b2c07a31f2 Fixed tests 2024-05-02 00:51:09 +00:00
Fabio Manganiello 4734909912 🐛 The `EventMatchResult` object shouldn't be initialized with `args` from the event.
If there's a good use-case for overriding `Event._matches_condition`
with a logic that also parses the event arguments, then those arguments
should be accessed directly from the event object, not from the match
result.

Initializing `EventMatchResult` with the arguments from the event means
that, if `EventMatchResult.parsed_args` are populated with custom
extracted arguments, then the upstream event arguments will also be
modified.

If the event is matched against multiple conditions, this will result in
the extracted tokens getting modified by each `matches_condition`
iteration.
2024-05-02 00:51:09 +00:00
Fabio Manganiello bd4b1d3e0f [assistant.picovoice] Sync between the speech and intent engines. 2024-05-02 00:51:09 +00:00
Fabio Manganiello 632d98703b New architecture for the assistant speech detection logic.
The assistant object now runs in its own thread and leverages an
external `SpeechProcessor` that uses two threads to scan for both
intents and speech in parallel on audio frames.
2024-05-02 00:51:09 +00:00
Fabio Manganiello af1392b5b9 [assistant] Added `ResponseEndEvent` and `IntentMatchedEvent` 2024-05-02 00:51:09 +00:00
Fabio Manganiello 2c197c275e [assistant.picovoice] Implemented mic mute/unmute handling. 2024-05-02 00:51:09 +00:00
Fabio Manganiello 8378bee7c6 Refactored `AssistantEvent`.
`AssistantEvent.assistant` is now modelled as an opaque object that
behaves the following way:

- The underlying plugin name is saved under `event.args['_assistant']`.

- `event.assistant` is a property that returns the assistant instance
  via `get_plugin`.

- `event.assistant` is reported as a string (plugin qualified name) upon
  event dump.

This allows event hooks to easily use `event.assistant` to interact with
the underlying assistant and easily modify the conversation flow, while
event hook conditions can still be easily modelled as equality
operations between strings.
2024-05-02 00:51:09 +00:00
Fabio Manganiello 6bdc9e77ee
[#349] Refactored/rewritten `telegram` plugin.
continuous-integration/drone/push Build is passing Details
1. `chat.telegram` -> `telegram` plugin.

2. Merged `backend.chat.telegram` logic into `telegram` plugin.

3. Rewritten the architecture of the integration to adapt to the new
   asyncio API introduced in the latest versions of telegram-bot-api.

Closes: #349
2024-03-03 15:39:47 +01:00
Fabio Manganiello 66e19d608a
Fixed flic events module name and path
continuous-integration/drone/push Build is passing Details
2024-02-29 23:48:10 +01:00
Fabio Manganiello c7b0440562
[#357] Migrated `backend.button.flic` to `flic` plugin.
continuous-integration/drone/push Build is passing Details
Closes: #357
2024-02-29 00:27:32 +01:00
Fabio Manganiello f8e0b5e17e
[#366] Context variables should be dynamically assigned through `locals()` instead of `exec()`.
continuous-integration/drone/push Build is passing Details
Closes: #366
2024-02-26 21:29:35 +01:00
Fabio Manganiello 2b595623b3
[#348] Converted `gps` backend into a plugin.
continuous-integration/drone/push Build is passing Details
Closes: #348
2024-02-05 02:16:02 +01:00
Fabio Manganiello c8944feca4 [#348] Merge + refactor for the `mail` backend/plugin (#362)
continuous-integration/drone/push Build is passing Details
Closes: #348

Reviewed-on: #362
2024-02-03 22:09:40 +01:00
Fabio Manganiello 746423a113 [#356] Merged `adafruit.io` plugin and backend. 2024-01-19 20:58:35 +00:00
Fabio Manganiello 95c15f3f5f [#347] Merge `kafka` backend and plugin.
Closes: #347
2024-01-18 01:28:56 +00:00
Fabio Manganiello 85db77bb7b
[#298] Merged `nextcloud` backend and plugin.
Closes: #298
2024-01-18 00:26:22 +01:00
Fabio Manganiello 9fa5989e21 [#302] Merged `pushbullet` backend and plugin.
Also, added support for more granular Pushbullet events.

Closes: #302
2024-01-09 23:46:07 +00:00
Fabio Manganiello 9c3da7a2a9
Several improvements for request/procedure execution.
continuous-integration/drone/push Build is passing Details
- Fixed regression introduced by incorrect format string in `exec`.

- LINT for the `procedure` module.

- Apply `Message.Encoder` when dumping values from the context.
2024-01-04 13:13:16 +01:00
Fabio Manganiello 0de322fb95
[assistant.google] Propagate plugin name as a string to events.
continuous-integration/drone/push Build is passing Details
This also makes it easier to programmatically stop conversations on
`SpeechRecognizedEvent` with a matched phrase.
2023-12-21 00:28:27 +01:00
Fabio Manganiello f27e7bb7e2
[#340] Better state management for alarms.
- Added `AlarmEnabledEvent` and `AlarmDisabledEvent`.
- Added `snooze_interval` configurable both at plugin level and alarm
  level.
2023-12-09 17:12:20 +01:00
Fabio Manganiello a6d6fd4067
`Message` objects enhancements.
- Support smart JSON serialization of `Message` objects.
- Added `Message.to_dict` method.
2023-12-09 01:20:20 +01:00
Fabio Manganiello 3bb7c02572
[#301] Merged `ping` backend and plugin.
Also, removed `ping` response types.
2023-11-24 02:06:53 +01:00
Fabio Manganiello b969afb1cf
Added support for weather forecast events and entities. 2023-11-23 01:35:58 +01:00
Fabio Manganiello a0d8c522a2
[#308] Finalized `weather` integrations migration.
continuous-integration/drone/push Build was killed Details
- Migrated `weather.buienradar` integration.
- Removed last leftovers of the previous weather backends and responses.

Closes: #308
2023-11-20 03:10:00 +01:00
Fabio Manganiello b8a4b9e4c5
Implemented support for weather entities. 2023-11-20 01:46:01 +01:00
Fabio Manganiello b800899859
[#308] Refactored `weather.openweathermap` plugin. 2023-11-19 00:10:10 +01:00
Fabio Manganiello 1a777c6276
Removed Todoist backend and migrated responses to schemas.
continuous-integration/drone/push Build is passing Details
The Todoist Websocket interface is no longer working properly, and I'm
sick of reverse engineering it.

Closes: #305
2023-11-18 10:16:48 +01:00
Fabio Manganiello c919cf0cd8
[trello] (Almost) complete plugin rewrite.
continuous-integration/drone/push Build is passing Details
- Merged `trello` plugin and backend into a single plugin.

- Removed legacy `Response` objects, replaced with data classes and
  schemas.

- Fixed the Websocket connection flow to reflect the new authentication
  protocol.

Closes: #307
2023-11-17 02:07:04 +01:00
Fabio Manganiello 7bb08bca07
[joystick] Rewritten `joystick` integration as a plugin.
continuous-integration/drone/push Build is passing Details
And removed legacy `joystick*` backends and `inputs` plugin.

Closes: #290
2023-11-16 21:43:56 +01:00
Fabio Manganiello 1f321c32dc
[`media.chromecast`] Full plugin rewrite.
continuous-integration/drone/push Build is failing Details
2023-11-12 03:08:54 +01:00
Fabio Manganiello cce6c4c5ad
[#284] Merged `assistant.google` plugin and backend.
This removes the deprecated `assistant.google` backend and also adds a
new `conversation_start_sound` parameter.
2023-10-22 19:55:11 +02:00
Fabio Manganiello 4883f49b19
Removed unused `travisci` events. 2023-10-21 19:15:34 +02:00
Fabio Manganiello 8b9ac59167
`parse_numpy` should also catch `AttributeError`.
continuous-integration/drone/push Build is passing Details
2023-10-12 03:24:03 +02:00
Fabio Manganiello 9acd71944c
Skip numpy types serialization errors on Message.Encoder. 2023-10-09 01:33:45 +02:00
Fabio Manganiello 40d3ad1150
Removed `<type> | None` type hints.
continuous-integration/drone/push Build is passing Details
They break on Python < 3.10.
2023-10-03 01:15:13 +02:00
Fabio Manganiello 761f2768cb
[#316] Added RPM dependencies.
continuous-integration/drone/push Build is passing Details
2023-09-21 23:20:06 +02:00
Fabio Manganiello 3e8d6bb01e Removed `typing-extensions` dependency.
continuous-integration/drone/push Build is failing Details
The package isn't present on older versions of Debian.
2023-09-18 14:05:39 +02:00
Fabio Manganiello 0dc380fa94
Removed dependency from prctl.
Also, black'd and LINT-fixed some files that hadn't been touched in a
while.
2023-07-23 19:17:30 +02:00
Fabio Manganiello 3eda0c6f17
[#268] Implemented XMPP integration. 2023-07-22 22:36:36 +02:00
Fabio Manganiello 63afd90701
Serialize exceptions in the default JSON serializers.
This allows us to easily pass errors in internal JSON payloads, and
ensure that these are serialized consistently across all the
integrations.
2023-07-22 15:14:05 +02:00
Fabio Manganiello cef9d0e007
Always serialize exception names when logging/returning request exceptions. 2023-07-22 15:13:17 +02:00
Fabio Manganiello c846c61493
Refactored `Config.__init__`.
The constructor of the `Config` class had grown too big. It's much more
manageable if split into multiple sub-constructor helpers.
2023-07-15 13:38:07 +02:00
Fabio Manganiello fa1364d854
Improved logging for requests, responses and events.
- The following logging namespaces are now used, to make it easier to
  filter only log lines related to the logged application message:

  - `platypush:events`
  - `platypush:requests`
  - `platypush:responses`

- Those messages are always logged as JSON, with no prefixes nor
  suffixes.

- Requests are always logged when executed - no more delegation to the
  upstream backend.

- Responses are always logged when fully populated (including `id`,
  `origin`, `target` etc.), instead of being logged when still partially
  populated. This makes it particularly easy to link request/response
  IDs directly from the logs.
2023-07-15 01:11:45 +02:00
Fabio Manganiello f2540437b7
Sound plugin rewritten almost from scratch. 2023-06-27 13:31:38 +02:00
Fabio Manganiello cfedcd701e
Performance improvements when loading the Tensorflow plugin.
The Tensorflow module may take a few seconds to load the first time and
slow down the first scan of the plugins.

All the Tensorflow imports should therefore be placed close to where
they are used instead of being defined at the top of the module.
2023-05-11 19:48:22 +02:00
Fabio Manganiello c690230930
An `AssistantEvent` should not fail initialization if the assistant integration isn't found. 2023-05-04 00:28:50 +02:00
Fabio Manganiello ff9b76477d
Fixed arguments naming. 2023-04-28 11:04:33 +02:00
Fabio Manganiello 162904f281
[#253] Added support for relational filters on event hooks. 2023-04-27 22:07:02 +02:00
Fabio Manganiello 245472a4c5
Better event hooks filters.
- Support for nested attributes on event hook conditions. Things like
  these are now possible:

```
from platypush.event.hook import hook
from platypush.message.event.entities import EntityUpdateEvent

@hook(EntityUpdateEvent, entity={"external_id": "system:cpu"})
def on_cpu_update_event(event: EntityUpdateEvent, **_):
    print(event.args["entity"]["percent"])
```

- The scoring/regex extraction/partial string match logic in
  `_matches_argument` is actually only needed for
  `SpeechRecognizedEvent`. Other events don't need these features, and
  event hooks may be actually triggered unexpectedly in case of partial
  matches. Therefore, the "complex" `_matches_argument` has been moved
  as an override only for `SpeechRecognizedEvent`, and all the other
  events will perform simple key-value matching.
2023-04-26 01:45:58 +02:00