Commit Graph

1641 Commits

Author SHA1 Message Date
Fabio Manganiello 17b6b02986 Replaced `warnings.warn` with `logging.warnings`.
I couldn't find an easy and reliable way of routing `warnings.warn` to
`logging`.

Closes: #281
2024-06-06 20:28:23 +00:00
Fabio Manganiello 8814859abc
[zwave.mqtt] Fixed typo in documentation. 2024-06-06 03:27:03 +02:00
Fabio Manganiello e52f5e06f4 [calendar.ical] Fixed timezone/datetime parsing issues.
Closes: #405
2024-06-06 00:24:31 +00:00
Fabio Manganiello 7a8f30e5e0 [#384] Added `assistant.openai` and `tts.openai` plugins.
Closes: #384
2024-06-02 15:31:11 +00:00
Fabio Manganiello 3528b3646f [openai] Update documentation to include `assistant` and `tts`. 2024-06-02 15:31:11 +00:00
Fabio Manganiello 9cca928d4b [#348] Added `openai.transcribe` action.
This API is the foundation for the `assistant.openai` plugin.
2024-06-02 15:31:11 +00:00
Fabio Manganiello f356fcd844 Added `tts.stop` method. 2024-06-02 15:31:11 +00:00
Fabio Manganiello fcae7aa3ad Several improvements for `assistant` plugins.
- `stop_conversation_on_speech_match` should default to True.

- `render_response` should also handle conversation follow-ups, set the
  follow-up to True if the response ends with a question mark and the
  value of `with_follow_on_turn` is not set,

- Don't render responses if a `tts_plugin` is not set.
2024-06-02 15:31:11 +00:00
Fabio Manganiello 1cc2aaf5a4 [assistant.picovoice] `_on_response_*` methods should have varargs. 2024-06-02 15:31:11 +00:00
Fabio Manganiello c9a5c29a4a
🐛 A proper cross-version solution for the `utcnow()` issue.
No need to maintain two different pieces of logic - a `utcnow()` for
Python < 3.11 and `now(datetime.UTC)` for Python >= 3.11.

`datetime.timezone.utc` existed long before datetime.UTC and that's what
the `utcnow` facade should use.

This means that all the `utcnow()` will always have `tzinfo=UTC`
regardless of the Python version.

There's still a problem with the `utcnow()`-generated timestamps that
have been generated by previous versions of Python and stored on the db.

Therefore, when the code performs comparisons with timestamps fetched
from the db, it should always explicitly do a `.replace(tzinfo=utc)` to
ensure that we always compare offset-aware datetime representations.

See blog post for technical details:
https://manganiello.blog/wheres-my-time-again
2024-06-01 01:34:47 +02:00
Fabio Manganiello 1067ab04d9
[tts.picovoice] Adapted to the new `orca.synthesize` API.
The new API no longer returns a list of numeric values alone. Instead,
it returns a tuple where the first element is the raw audio, and the
second element contains extra info on the rendered phonemes.
2024-05-31 21:10:48 +02:00
Fabio Manganiello 4e82dd17bb
🐛 Partial revert of c18768e61f
`datetime.utcnow` may be deprecated on Python >= 3.12, but
`datetime.UTC` isn't present on older Python versions.

Added a `platypush.utils.utcnow()` method as a workaround compatible
with both.
2024-05-31 19:52:32 +02:00
Fabio Manganiello fa318882a5
Replaced deprecated usages of `datetime.utcnow()` with `datetime.now(UTC)`. 2024-05-31 02:30:48 +02:00
Fabio Manganiello d6185ddb1e
[assistant] `tts_plugin_args` should include `join=True` by default.
The assistant by default should be configured to wait for response audio
to be fully rendered before proceeding.
2024-05-30 01:33:56 +02:00
Fabio Manganiello 254604e404
py3-vlc has not been merged upstream in Alpine Linux yet. 2024-05-25 10:17:19 +02:00
Fabio Manganiello d0f781919d
[#345] Rewritten `sun` plugin.
continuous-integration/drone/push Build is passing Details
Closes: #345
2024-05-20 02:01:40 +02:00
Fabio Manganiello f06233801b
[#394] Dynamically generate setup extras.
Also, convert all code that relied on `manifest.yaml` to use
`manifest.json` instead.

Closes: #394
2024-05-17 02:21:57 +02:00
Fabio Manganiello 59c693d6a0
[#394] All `manifest.yaml` converted to `manifest.json`.
YAML isn't part of the Python standard library, while JSON is.

If we want `setup.py` to dynamically parse the available integration
manifest files in order to populate the extra dependencies, then it's
better to rely on a JSON format for manifest files - the parser is part
of the standard library and it doesn't require the user to install
`pyyaml` before `platypush`.
2024-05-17 02:21:57 +02:00
Fabio Manganiello c77cf2c98b
[#372] Removed Google Fit plugin.
continuous-integration/drone/push Build is passing Details
The Fit API has (unfortunately) been deprecated by Google with no
alternatives - the new Health Connect API is only available on Android
devices.

Other Google APIs don't seem to be affected by the refresh token issue
either, so this should hopefully close that issue too.

Closes: #372
2024-05-16 02:42:54 +02:00
Fabio Manganiello 98a98ea1dc
[#398] Removed custom `Response` objects from Tensorflow and response docs generation logic.
continuous-integration/drone/push Build is passing Details
Closes: #398
2024-05-15 09:55:58 +02:00
Fabio Manganiello 0e11bbeb05
Fixed schema reference.
continuous-integration/drone/push Build is passing Details
2024-05-15 08:33:49 +02:00
Fabio Manganiello 20f3eaf375
[#398] Refactored `esp` plugin.
continuous-integration/drone/push Build was killed Details
- Converted `Response` objects into `Schema`s.

- Removed the last references to the deprecated `Mapping` object.

- Fixed all errors and warnings in the plugin.
2024-05-15 01:29:45 +02:00
Fabio Manganiello 7ae99b4325
[#398] `cups` plugin refactor.
continuous-integration/drone/push Build is passing Details
1. Renamed plugin: `printer.cups` ➡️  `cups`.
2. Replaced `Response` objects with schemas.
2024-05-13 02:22:04 +02:00
Fabio Manganiello 15b1c1f3c0
[#398] Replaced `GoogleDriveFile` response with `GoogleDriveFileSchema`.
continuous-integration/drone/push Build is passing Details
2024-05-13 01:25:33 +02:00
Fabio Manganiello 6003b205c8
[#398] Removed `TranslateResponse`. 2024-05-13 01:25:33 +02:00
Fabio Manganiello b662e98447
[#398] Removed `ssh` response objects.
continuous-integration/drone/push Build is passing Details
2024-05-10 01:37:17 +02:00
Fabio Manganiello 6f8c2085f2
[#398] Replaced `qrcode` response objects with schemas.
continuous-integration/drone/push Build is passing Details
2024-05-10 01:01:22 +02:00
Fabio Manganiello 3df76a4a9c
[#398] Replaced `pihole` response objects with schemas.
continuous-integration/drone/push Build is passing Details
2024-05-09 14:06:54 +02:00
Fabio Manganiello 13bde4adba
[#398] Replaced `camera` response objects with schemas.
continuous-integration/drone/push Build is passing Details
2024-05-09 01:41:15 +02:00
Fabio Manganiello 7a849379f9
[#399] Added `@when` decorator as an alias for `@hook`.
continuous-integration/drone/push Build is passing Details
Closes: #399
2024-05-08 21:58:58 +02:00
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 72bc697122 [assistant.picovoice] Extended documentation. 2024-05-02 00:51:09 +00:00
Fabio Manganiello d813356d9c [music.mopidy] Handle the case where `add` returns a list. 2024-05-02 00:51:09 +00:00
Fabio Manganiello 1192782729 [tts.picovoice] Convert digits before replacing other substrings. 2024-05-02 00:51:09 +00:00
Fabio Manganiello 237fc58928 [tts.picovoice] A more robust logic for replacing unsupported characteres on the input. 2024-05-02 00:51:09 +00:00
Fabio Manganiello d8e24207c5 Added `openai` plugin. 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 bb9b6cd319 [assistant.picovoice] Various improvements.
- Added `intent_model_path` parameter.

- Always apply `expanduser` to configuration paths.

- Better logic to infer the fallback model path.

- The Picovoice Leonardo object should always be removed after
  `assistant.picovoice.transcribe` is called.
2024-05-02 00:51:09 +00:00
Fabio Manganiello f0a780b759 Added `assistant.picovoice.transcribe` and `assistant.picovoice.say`. 2024-05-02 00:51:09 +00:00
Fabio Manganiello f04f7ce9d7 [tts.picovoice] Better text pre-processing logic. 2024-05-02 00:51:09 +00:00
Fabio Manganiello 37d70d67ac [assistant.picovoice] Implemented `assistant.picovoice.send_text_query`. 2024-05-02 00:51:09 +00:00
Fabio Manganiello fa1d5eb672 [tts.picovoice] Added text pre-processing workaround.
This workaround is required until
https://github.com/Picovoice/orca/issues/10 is fixed.
2024-05-02 00:51:09 +00:00
Fabio Manganiello a345b12244 [assistant.picovoice] Leverage upstream `_on_mute_changed`.
The plugin should leverage `AssistantPlugin._on_mute_changed` to handle
the boilerplate state managent on mute/unmute actions instead of
re-implementing the same logic.
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 9de49c71a1 [assistant.picovoice] Conversation flow improvements.
- The `Responding` state should be modelled as an extra event/binary
  flag, not as an assistant state. The assistant may be listening for
  hotwords even while the `tts` plugin is responding, and we don't want
  the two states to interfere with each either - neither to build a more
  complex state machine that also needs to take concurrent states into
  account.

- Stop any responses being rendered upon the `tts` plugin when a new
  hotword audio is detected. If e.g. I say "Ok Google", I should always
  be able to trigger the assistant and stop any concurrent audio
  process.

- `SpeechRecognizedEvent` should be emitted even if `cheetah`'s latest
  audio frame results weren't marked as final, and the speech detection
  window timed out. Cheetah's `is_final` detection seems to be quite
  buggy sometimes, and it may not properly detect the end of utterances,
  especially with non-native accents. The workaround is to flush out
  whatever text is available (if at least some speech was detected) into
  a `SpeechRecognizedEvent` upon timeout.
2024-05-02 00:51:09 +00:00
Fabio Manganiello aa333db05c [assistant.picovoice] More features.
- Added wiring between `assistant.picovoice` and `tts.picovoice`.

- Added `RESPONDING` status to the assistant.

- Added ability to override the default speech model upon
  `start_conversation`.

- Better handling of conversation timeouts.

- Cache Cheetah objects in a `model -> object` map - at least the
  default model should be pre-loaded, since model loading at runtime
  seems to take a while, and that could impact the ability to detect the
  speech in the first seconds after a hotword is detected.
2024-05-02 00:51:09 +00:00
Fabio Manganiello af875c996e Added `tts.picovoice` plugin. 2024-05-02 00:51:09 +00:00
Fabio Manganiello a4c911a5d7 Added ffmpeg requirement for `assistant.picovoice`. 2024-05-02 00:51:09 +00:00