You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 18, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+1-310Lines changed: 1 addition & 310 deletions
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,8 @@ This repo is an alternative to the backend meant for personal usage, this allows
8
8
9
9
This is NOT meant to provision third party devices, but rather to run on the mycroft devices directly or on a private network
10
10
11
-
For a full backend experience, the official mycroft backend has been open sourced, read the [blog post](https://mycroft.ai/blog/open-sourcing-the-mycroft-backend/)
11
+
Documentation can be found at https://openvoiceos.github.io/community-docs/personal_backend
12
12
13
-
NOTE: There is no pairing, devices will just activate themselves and work
14
13
15
14
## Install
16
15
@@ -69,318 +68,10 @@ see default values [here](./ovos_local_backend/configuration.py)
69
68
- if record_utterances is set, recordings can be found at `DATA_PATH/utterances`
70
69
71
70
72
-
## Databases
73
-
74
-
Since the local backend is not meant to provision hundreds of devices or manage user accounts it works only with [json databases](https://github.com/OpenJarbas/json_database)
75
-
76
-
- metadata about uploaded wakewords can be found at `~/.local/share/json_database/ovos_wakewords.jsondb`
77
-
- metadata about uploaded utterances can be found at `~/.local/share/json_database/ovos_utterances.jsondb`
78
-
- database of uploaded metrics can be found at `~/.local/share/json_database/ovos_metrics.jsondb`
79
-
- paired devices database can be found at `~/.local/share/json_database/ovos_devices.json`
80
-
- per device skill settings database can be found at `~/.local/share/json_database/ovos_skill_settings.json`
81
-
- shared skill settings database can be found at `~/.local/share/json_database/ovos_shared_skill_settings.json`
82
-
83
-
metrics, wake words and utterances respect the individual devices `opt_in` flag, nothing will be saved unless devices opt_in (default True)
84
-
85
-
## Micro Services
86
-
87
-
The local backend provides some 3rd party apis for consumption by skills, these services are only provided for compatibility with selene and to ensure default skills work, **no new apis are planned**
88
-
89
-
[ovos-api-service](https://github.com/OpenVoiceOS/ovos_api_service) is supported and will be used if you do not set your own keys, but we encourage you to set your own, they are free and ensure we do not run into rate limits
90
-
91
-
Consider using one of the ovos alternative skills that skip these endpoints if you are not managing your own keys
92
-
93
-
## Admin api
94
-
95
-
Since there is no UI some endpoints are provided to manage your devices
96
-
97
-
By default admin api is disabled, to enable it add `"admin_key": "unique_super_secret_key"` to the backend configuration
98
-
99
-
you need to provide that key in the request headers for [admin endpoints](./ovos_local_backend/backend/admin.py)
100
-
101
-
```python
102
-
from ovos_backend_client.api import AdminApi
103
-
104
-
admin = AdminApi("secret_admin_key")
105
-
106
-
uuid ="..."# check identity2.json in the device you want to manage
107
-
108
-
# manually pair a device
109
-
identity_json = admin.pair(uuid)
110
-
111
-
# set device info
112
-
info = {"opt_in": True,
113
-
"name": "my_device",
114
-
"device_location": "kitchen",
115
-
"email": "notifications@me.com",
116
-
"isolated_skills": False,
117
-
"lang": "en-us"}
118
-
admin.set_device_info(uuid, info)
119
-
120
-
# set device preferences
121
-
prefs = {"time_format": "full",
122
-
"date_format": "DMY",
123
-
"system_unit": "metric",
124
-
"lang": "en-us"}
125
-
admin.set_device_prefs(uuid, prefs)
126
-
127
-
# set location data
128
-
loc = {
129
-
"city": {
130
-
"code": "Lawrence",
131
-
"name": "Lawrence",
132
-
"state": {
133
-
"code": "KS",
134
-
"name": "Kansas",
135
-
"country": {
136
-
"code": "US",
137
-
"name": "United States"
138
-
}
139
-
}
140
-
},
141
-
"coordinate": {
142
-
"latitude": 38.971669,
143
-
"longitude": -95.23525
144
-
},
145
-
"timezone": {
146
-
"code": "America/Chicago",
147
-
"name": "Central Standard Time",
148
-
"dstOffset": 3600000,
149
-
"offset": -21600000
150
-
}
151
-
}
152
-
admin.set_device_location(uuid, loc)
153
-
```
154
-
155
-
156
-
## Device Settings
157
-
158
-
Each paired device has a few settings that control behaviour backend side
159
-
160
-
-`name` - default `"Device-{uuid}"`, friendly device name for display
161
-
-`opt_in` - default `True`, flag to control if metrics and speech from this device will be saved
162
-
-`device_location` - default `"unknown"`, friendly name for indoor location
163
-
-`email` - default from backend config, email to send notifications to
164
-
-`isolated_skills` - default `False`, flag to control if skill settings are shared across devices (ovos only)
165
-
166
-
In selene this info would be populated during pairing process, in local backend it needs to be updated manually
167
-
168
-
- you can change these settings per device via the [admin api](./ovos_local_backend/backend/admin.py)
169
-
- you can also change these settings per device by manually editing paired devices database
170
-
171
-
## Location
172
-
173
-
Device location can be updated via the backend, mycroft-core will request this info on it's own from time to time
174
-
175
-
default values comes from the local backend config file
176
-
```json
177
-
{
178
-
"geolocate": true,
179
-
"override_location": false,
180
-
"default_location": {
181
-
"city": {"...": "..."},
182
-
"coordinate": {"...": "..."},
183
-
"timezone": {"...": "..."}
184
-
}
185
-
}
186
-
```
187
-
188
-
- if override location is True, then location will be set to configured default value
189
-
- if geolocate is True then location will be set from your ip address
190
-
- you can set a default location per device via the [admin api](./ovos_local_backend/backend/admin.py)
191
-
- you can also set a default location per device by manually editing paired devices database
192
-
193
-
## Device Preferences
194
-
195
-
Some settings can be updated via the backend, mycroft-core will request this info on it's own from time to time
196
-
197
-
default values comes from the local backend config file
198
-
```json
199
-
{
200
-
"lang": "en-us",
201
-
"date_format": "DMY",
202
-
"system_unit": "metric",
203
-
"time_format": "full"
204
-
}
205
-
```
206
-
207
-
- these settings are also used for wolfram alpha / weather default values
208
-
- you can set these values per device via the [admin api](./ovos_local_backend/backend/admin.py)
209
-
- you can also set these values per device by manually editing paired devices database
210
-
211
-
## Skill settings
212
-
213
-
in selene all device share skill settings, with local backend you can control this per device via `isolated_skills` flag
214
-
215
-
"old selene" supported a single endpoint for both skill settings and settings meta, this allowed devices both to download and upload settings
216
-
217
-
"new selene" split this into two endpoints, settingsMeta (upload only) and settings (download only), this disabled two way sync across devices
218
-
219
-
- you can set `isolated_skills` per device via the [admin api](./ovos_local_backend/backend/admin.py)
220
-
- you can also set `isolated_skills` per device by manually editing paired devices database
221
-
- both endpoints are available, but mycroft-core by default will use the new endpoints and does not support two way sync
222
-
- you can edit settings by using the "old selene" endpoint
223
-
- you can also edit settings by manually editing settings database
224
-
225
-
## Email
226
-
227
-
Mycroft skills can request the backend to send an email to the account used for pairing the device
228
-
229
-
- Email will be sent to a pre-defined recipient email since there are no user accounts
230
-
- you can set a recipient email per device via the [admin api](./ovos_local_backend/backend/admin.py)
231
-
- you can set a recipient email per device by manually editing paired devices database
232
-
233
-
with the local backend you need to configure your own SMTP server and recipient email, add the following section to your .conf
234
-
235
-
```json
236
-
{
237
-
"email": {
238
-
"smtp": {
239
-
"username": "sender@gmail.com",
240
-
"password": "123456",
241
-
"host": "",
242
-
"port": 465
243
-
},
244
-
"recipient": "receiver@gmail.com"
245
-
}
246
-
}
247
-
```
248
-
249
-
If using gmail you will need to [enable less secure apps](https://hotter.io/docs/email-accounts/secure-app-gmail/)
250
-
251
-
252
-
## Selene Proxy
253
-
254
-
You can integrate local backend with selene, the backend will show up as a device you can manage in mycroft.home
255
-
256
-
wait... what? isn't the point of local backend to disable selene?
257
-
258
-
- Open Dataset, You do not want to use selene, but you want to opt_in to the open dataset (share recordings with mycroft)
259
-
- Privacy, you want to use selene, but you do not want to give away your personal data (email, location, ip address...)
260
-
- Control, you want to use only a subset of selene features
261
-
- Convenience, pair once, manage all your devices
262
-
- Functionality, extra features such as isolated skill settings and forced 2 way sync
263
-
- Esoteric Setups, isolated mycroft services that can not share a identity file, such as [ovos-qubes](https://github.com/OpenVoiceOS/ovos-qubes)
264
-
265
-
### Pairing
266
-
267
-
To pair the local backend with selene you have 2 options
268
-
269
-
1 - pair a mycroft-core instance, then copy the identity file
270
-
271
-
2 - enable proxy_pairing, whenever a device pairs with local backend the code it speaks is also valid for selene, use that code to pair local backend with selene
272
-
273
-
If a device tries to use a selene enabled endpoint without the backend being paired a 401 authentication error will be returned, if the endpoint does not use selene (eg. disabled in config) this check is skipped
274
-
### Selene Config
275
-
276
-
In your backend config add the following section
277
-
278
-
```python
279
-
"selene": {
280
-
"enabled": False, # needs to be explicitly enabled by user
281
-
"url": "https://api.mycroft.ai", # change if you are self hosting selene
282
-
"version": "v1",
283
-
# pairing settings
284
-
#NOTE: the file should be used exclusively by backend, do not share with a mycroft-core instance
285
-
"identity_file": BACKEND_IDENTITY, # path to identity2.json file
286
-
# send the pairing from selene to any device that attempts to pair with local backend
287
-
# this will provide voice/gui prompts to the user and avoid the need to copy a identity file
288
-
# only happens if backend is not paired with selene (hopefully exactly once)
289
-
# if False you need to pair an existing mycroft-core as usual and move the file for backend usage
290
-
"proxy_pairing": False,
291
-
292
-
# micro service settings
293
-
#NOTE: STT is handled at plugin level, configure ovos-stt-plugin-selene
294
-
"proxy_weather": True, # use selene for weather api calls
295
-
"proxy_wolfram": True, # use selene for wolfram alpha api calls
296
-
"proxy_geolocation": True, # use selene for geolocation api calls
297
-
"proxy_email": False, # use selene for sending email (only for email registered in selene)
298
-
299
-
# device settings - if you want to spoof data in selene set these to False
300
-
"download_location": True, # set default location from selene
301
-
"download_prefs": True, # set default device preferences from selene
302
-
"download_settings": True, # download shared skill settings from selene
303
-
"upload_settings": True, # upload shared skill settings to selene
304
-
"force2way": False, # this forcefully re-enables 2way settings sync with selene
305
-
# this functionality was removed from core, we hijack the settingsmeta endpoint to upload settings
306
-
# upload will happen when mycroft-core boots and overwrite any values in selene (no checks for settings changed)
307
-
# the assumption is that selene changes are downloaded instantaneously
308
-
# if a device is offline when selene changes those changes will be discarded on next device boot
309
-
310
-
# opt-in settings - what data to share with selene
311
-
#NOTE: these also depend on opt_in being set in selene
312
-
"opt_in": False, # share data from all devices with selene (as if from a single device)
313
-
"opt_in_blacklist": [], # list of uuids that should ignore opt_in flag (never share data)
314
-
"upload_metrics": True, # upload device metrics to selene
315
-
"upload_wakewords": True, # upload wake word samples to selene
316
-
"upload_utterances": True# upload utterance samples to selene
317
-
}
318
-
```
319
-
320
-
321
-
## Mycroft Setup
322
-
323
-
There are 2 main intended ways to run local backend with mycroft
324
-
325
-
- on same device as mycroft-core, tricking it to run without mycroft servers
326
-
- on a private network, to manage all your devices locally
327
-
328
-
329
-
NOTE: you can not fully run mycroft-core offline, it refuses to launch without internet connection, you can only replace the calls to use this backend instead of mycroft.home
330
-
331
-
We recommend you use [ovos-core](https://github.com/OpenVoiceOS/ovos-core) instead
332
-
333
-
update your mycroft config to use this backend, delete `identity2.json` and restart mycroft
docker run -p 8086:6712 -d --restart always --name local_backend ghcr.io/openvoiceos/local-backend:dev
374
77
```
375
-
376
-
## Project Timeline
377
-
378
-
- Jan 2018 - [initial release](https://github.com/OpenVoiceOS/OVOS-mock-backend/tree/014389065d3e5c66b6cb85e6e77359b6705406fe) of reverse engineered mycroft backend - by JarbasAI
379
-
- July 2018 - Personal backend [added to Mycroft Roadmap](https://mycroft.ai/blog/many-roads-one-destination/)
380
-
- October 2018 - Community [involved in discussion](https://mycroft.ai/blog/mycroft-personal-server-conversation/)
381
-
- Jan 2019 - JarbasAI implementation [adopted by Mycroft](https://github.com/MycroftAI/personal-backend/tree/31ee96a8189d96f8102276bf4b9073811ee9a9b2)
382
-
- NOTE: this should have been a fork or repository transferred, but was a bare clone
383
-
- Original repository was archived
384
-
- October 2019 - Official mycroft backend [open sourced under a viral license](https://mycroft.ai/blog/open-sourcing-the-mycroft-backend/)
385
-
- Jun 2020 - original project [repurposed to be a mock backend](https://github.com/OpenJarbas/ZZZ-mock-backend) instead of a full alternative, [skill-mock-backend](https://github.com/JarbasSkills/skill-mock-backend) released
386
-
- Jan 2021 - mock-backend adopted by OpenVoiceOS, original repo unarchived and ownership transferred
0 commit comments