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

feat/device_db #22

Merged
merged 37 commits into from Aug 25, 2022
Merged

feat/device_db #22

merged 37 commits into from Aug 25, 2022

Conversation

JarbasAl
Copy link
Member

@JarbasAl JarbasAl commented Aug 23, 2022

closes #21

Databases

Since the local backend is not meant to provision hundreds of devices or manage user accounts it works only with json databases

  • metadata about uploaded wakewords can be found at ~/.local/share/json_database/ovos_wakewords.jsondb
  • metadata about uploaded utterances can be found at ~/.local/share/json_database/ovos_utterances.jsondb
  • database of uploaded metrics can be found at ~/.local/share/json_database/ovos_metrics.jsondb
  • paired devices database can be found at ~/.local/share/json_database/ovos_devices.json <- NEW
  • per device skill settings database can be found at ~/.local/share/json_database/ovos_skill_settings.json <- NEW
  • shared skill settings database can be found at ~/.local/share/json_database/ovos_shared_skill_settings.json <- NEW

metrics, wake words and utterances respect the individual devices opt_in flag, nothing will be saved unless devices opt_in (default True) <- NEW

Admin api <- NEW

Since there is no UI some endpoints are provided to manage your devices

By default admin api is disabled, to enable it add "admin_key": "unique_super_secret_key" to the backend configuration

you need to provide that key in the request headers for admin endpoints

TODO - selene_api support

Device Settings <- NEW

Each paired device has a few settings that control behaviour backend side

  • name - default "Device-{uuid}", friendly device name for display
  • opt_in - default True, flag to control if metrics and speech from this device will be saved
  • device_location - default "unknown", friendly name for indoor location
  • email - default from backend config, email to send notifications to
  • isolated_skills - default False, flag to control if skill settings are shared across devices (ovos only)

In selene this info would be populated during pairing process, in local backend it needs to be updated manually

  • you can change these settings per device via the admin api
  • you can also change these settings per device by manually editing paired devices database

Location

Device location can be updated via the backend, mycroft-core will request this info on it's own from time to time

default values comes from the local backend config file

{
  "geolocate": true,
  "override_location": false,
  "default_location": {
    "city": {"...": "..."},
    "coordinate": {"...": "..."},
    "timezone": {"...": "..."}
  }
}
  • if override location is True, then location will be set to configured default value
  • if geolocate is True then location will be set from your ip address
  • you can set a default location per device via the admin api <- NEW
  • you can also set a default location per device by manually editing paired devices database

Device Preferences <- NEW

Some settings can be updated via the backend, mycroft-core will request this info on it's own from time to time

default values comes from the local backend config file

{
  "lang": "en-us",
  "date_format": "DMY",
  "system_unit": "metric",
  "time_format": "full"
}
  • these settings are also used for wolfram alpha / weather default values <- NEW
  • you can set these values per device via the admin api
  • you can also set these values per device by manually editing paired devices database

Skill settings <- NEW

in selene all device share skill settings, with local backend you can control this per device via isolated_skills flag

"old selene" supported a single endpoint for both skill settings and settings meta, this allowed devices both to download and upload settings

"new selene" split this into two endpoints, settingsMeta (upload only) and settings (download only), this disabled two way sync across devices

  • you can set isolated_skills per device via the admin api
  • you can also set isolated_skills per device by manually editing paired devices database
  • both endpoints are available, but mycroft-core by default will use the new endpoints and does not support two way sync
  • you can edit settings by using the "old selene" endpoint
  • you can also edit settings by manually editing settings database

Email

Mycroft skills can request the backend to send an email to the account used for pairing the device

  • Email will be sent to a pre-defined recipient email since there are no user accounts <- FIXED
  • you can set a recipient email per device via the admin api <- NEW
  • you can set a recipient email per device by manually editing paired devices database

with the local backend you need to configure your own SMTP server and recipient email, add the following section to your .conf

{
  "email": {
    "smtp": {
      "username": "sender@gmail.com",
      "password": "123456",
      "host": "",
      "port": 465
    },
    "recipient": "receiver@gmail.com"
  }
}

track devices per uuid, allow device settings, preparation for skill settings per device
@JarbasAl JarbasAl added the enhancement New feature or request label Aug 23, 2022
@codecov
Copy link

codecov bot commented Aug 23, 2022

Codecov Report

❗ No coverage uploaded for pull request base (dev@1be3b88). Click here to learn what that means.
The diff coverage is n/a.

@@          Coverage Diff          @@
##             dev     #22   +/-   ##
=====================================
  Coverage       ?   0.00%           
=====================================
  Files          ?      20           
  Lines          ?     883           
  Branches       ?       0           
=====================================
  Hits           ?       0           
  Misses         ?     883           
  Partials       ?       0           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@JarbasAl JarbasAl marked this pull request as ready for review August 24, 2022 19:26
@5trongthany
Copy link
Member

All looks fine to me, but also not sure what all to ask or have introspection on.

@JarbasAl JarbasAl merged commit 4517f3e into dev Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

implement skill settings endpoints
2 participants