-
Notifications
You must be signed in to change notification settings - Fork 4
/
example_config
316 lines (280 loc) · 13.3 KB
/
example_config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
// -*- mode: javascript -*- //
// This config file won't work as-is but is, instead, intended to be used to
// crib from when building your own file, if you're looking for examples of how
// things are meant to work.
//
// It's not completely exhaustive but it has most of the things which you'll
// likely want in it. And, if it doesn't, you can probably figure out what to do
// for the others :)
//
// The best explanation of the component parameters can be found in their source
// code. Some details are given below for quick reference.
//
// That being said, don't blindly copy & paste from this file. Some of the things
// in it only make sense for different set-ups, and some are just a bad idea if
// you don't know what they do (e.g. SocketInput).
{
// The key phrases are what Dexter listens for in order to be activated
"key_phrases" : [
"Dexter",
"Hey Computer"
],
// The settings for the GUI. If the `gui` label is defined then Dexter will
// attempt to create a user interface, either in a window or at the console.
"gui" : {
// See the `dexter.gui.MainScreen` constructor for the meaning of these
// parameters.
"scale" : 1.0,
"message_scale" : 1.0,
"clock_scale" : 1.0,
"clock_format" : "24h"
},
// How we configure email. The email functionality only works with STARTTLS
// right now and needs to be accessible by basic SMTP. (GMail no longer allows
// this easily but Outlook Mail does.)
//
// Note that this requires you to store the email login details in plaintext
// in the config so it is suggested that you use an email account which you
// don't care about being compromised.
//
// In order to use the email functionality, you just say something like,
// Hey Dexter, email me what's the weather tomorrow
// where the format is
// Hey Dexter, email <alias> <request>
"email" : {
"host" : "smtp.office365.com",
"port" : 587,
"login" : "username@outlook.com",
"password" : "password",
"addresses" : {
// Alias Address
"me" : "your.name.here@gmail.com",
"me at work" : "you@yourwork.com",
"my phone" : "2125551234@tmomail.net",
}
},
// The notifiers are what tells the user whether Dexter's components are
// doing something. Some notifiers might employ hardware add-ons, like a
// small LED display for examople. The format is the same as that of the
// components, explained below.
"notifiers" : [
[ "dexter.notifier.desktop.SysTrayNotifier", {
}],
[ "dexter.notifier.logging.LogNotifier", {
}],
// You will need to ensure that the user can access the USB device if
// this errors out with "open failed" then get the udev file file:
// https://raw.githubusercontent.com/todbot/blink1/main/linux/51-blink1.rules
// and install it per the commands in its comments.
[ "dexter.notifier.thingm.Blink1Notifier", {
}],
[ "dexter.notifier.unicorn_hat.UnicornHatHdNotifier", {
"clock_type" : 12
}]
],
// The components are what perform different actions in the framework.
//
// The format of the component sections is a type of component (input, etc.)
// followed by a list of component definitions. A component definition is a
// list with two entries: the full-qualified name of the class followed by a
// dict of kwargs for it's constructor.
"components" : {
// The inputs are how requests get into Dexter. A simple socket-based
// one can be used for testing, but most of them are speech-to-text
// engines.
//
// Multiple ones are listed below but you will probably only want one of
// them in practice, else the system will get pretty confused. All the
// audio inputs have an optional `wav_dir` parameter which is to save
// out recordings of what is heard, which is mainly just useful for
// debugging.
"inputs" : [
// A simple input which you can telnet and type command into
[ "dexter.input.socket.SocketInput", {
// The port to listen on.
"port" : "8008",
// Always prefix what is received with this. This saves the user
// having to type the prefix themselves.
"prefix" : "Dexter"
}],
// Coqui's speech-to-ltext engine is not bad and will run on a
// Raspberry Pi 4 with reasonable speed.
[ "dexter.input.coqui.CoquiInput", {
"model" : "${HOME}/coqui/model",
"scorer" : "${HOME}/coqui/scorer"
}]
// Open AI's Whisper is the best speech-to-text engine out there
// right now. However, it needs a powerful machine to run on
// (likely with a GPU) so isn't great for the Raspberry Pi.
[ "dexter.input.openai_whisper.WhisperInput", {
"model" : "base"
}],
// If you want to offload the speech-to-text to a remote machine,
// using one of the blah_server.py scripts, then this is how you
// send out the requests.
[ "dexter.input.remote.RemoteInput", {
"host" : "192.168.1.100",
"port" : "8008",
"wav_dir" : "${HOME}/wavs"
}]
],
// The outputs are how Dexter communicates back. These are mostly
// text-to-speech engines, of which you probably only want one (for
// obvious reasons).
"outputs" : [
// Output to the logfile
[ "dexter.output.io.LogOutput", {
"level" : "INFO"
}],
// Output to the Ubuntu desktop via notifications
[ "dexter.output.desktop.NotifierOutput", {
}],
// Output via speech-to-text. Look in the following modules for the
// different STT engines (each of which has its own pros and cons):
// coqui, espeak, festvox, mycroft
[ "dexter.output.festvox.PyFestivalOutput", {
}]
],
// The services are the "interesting" part of the system since it's
// these which actualy respond to the inputs. The can do things for you,
// like telling you the time or what a cat is, or they can control
// aspects of the system, like setting the output volume.
"services" : [
// The Bespoke service has various stock phrases which it knows how
// to respond to.
[ "dexter.service.bespoke.BespokeService", {
}],
// The Parrot service is like the Bespoke one but plays audio files
// instead.
[ "dexter.service.bespoke.ParrotService", {
"sounds" : {
"what am i" : "${HOME}/Music/smeghead.wav"
}
}],
[ "dexter.service.chronos.ClockService", {
// The Easter egg means it will randomly give you a "fun" reply
// instead of saying the actual time.
"easter_egg_prob" : 0.1
}],
[ "dexter.service.chronos.AlarmService", {
"alarm_sound" : "${HOME}/Music/alarm.wav"
}],
[ "dexter.service.chronos.TimerService", {
"timer_sound" : "${HOME}/Music/alarm.wav"
}],
// You can use the Fortune service to give back entries from the
// stock BSD fortune program's install...
[ "dexter.service.fortune.FortuneService", {
}],
// ...or you can have it listen for a special trigger and pull from
// a specific location.
[ "dexter.service.fortune.FortuneService", {
// The trigger phrase
"phrase" : "Tell me a joke",
// There needs to be an associated `.dat` file for the fortune
// file to be recognised. These can be created with `strfile`
// (or, really, just by `touch`).
"fortune_files" : [ "/home/pi/fortunes/jokes" ]
}],
// Standard language services. E.g. "Define cat" or "How do you
// spell cat?"
[ "dexter.service.language.DictionaryService", {
}],
[ "dexter.service.language.SpellingService", {
}],
// A service which just echoes back what you said. Possibly not very
// interesting but, when combined with email, can be used to send
// yourself a note:
// Hey Dexter, email me saying remember to water the plants.
[ "dexter.service.language.EchoService", {
"phrase" : "saying"
}],
// In case you want to buy things. Handy in conjunction with the
// email configuration since you can say,
// Hey Dexter, email me what's on my shopping list
// and it almost sounds natrual.
[ "dexter.service.life.ShoppingListService", {
"filename" : "${HOME}/shopping_list"
}],
// For playing music from disk
[ "dexter.service.music.LocalMusicService", {
"dirname" : "${HOME}/Music"
}],
// Simple mathematics
[ "dexter.service.numeric.CalculatorService", {
}],
// A way to query your PurpleAir sensor, if you know the ID of one.
// You'll need an API key to get this to work (see the code).
[ "dexter.service.purpleair.PurpleAirService", {
"sensor_id" : 12345,
"api_key" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
}],
[ "dexter.service.randomness.RandomService", {
}],
// For playing music from Spotify. See the copious notes in the
// `service/spoify.py` file.
[ "dexter.service.spotify.SpotifyService", {
// These come from the app settings in My Dashboard on the
// Spotify developer site:
// https://developer.spotify.com/dashboard/
"client_id" : "0123456789abcdef01234567890abcde",
"client_secret" : "0123456789abcdef01234567890abcde",
"redirect_uri" : "http://localhost:8765",
// This is the name of the device which you want to have play
// the music etc. If it's something like `spotifyd` then you
// set this in the config file.
"device_name" : "dexter"
}],
[ "dexter.service.tplink_kasa.KasaService", {
// The bulbs, which can be turned on and off, or have their
// colours changed. The IP addresses can be a string, or a list
// of strings if you want to have a group.
"bulbs" : {
// NAME ADDRESSES/HOSTNAMES
"the lamp" : "192.168.1.200",
"my light" : "192.168.1.201",
"all the lights" : [ "192.168.1.200"
"192.168.1.201" ]
},
// Plugs, which can only be turned on and off
"plugs" : {
// NAME ADDRESS/HOSTNAME
"the outside lights" : "192.168.1.202"
}
}],
// For playing music from UPnP servers on your network
[ "dexter.service.upnp.UpnpMusicService", {
// Jellyfin is a pretty decent media server in general. It
// supports UPnP out of the box by default. The server name
// is 'Jellyfin - <machine name>' by default. If you can't
// determine it then the service will tell you the servers
// which it finds.
'server_name' : 'Jellyfin - mediabox',
// We'll call this player 'jelly fin' in case the speech to
// text engines don't render it as one word.
'alias' : 'jelly fin',
// Only index songs matching this "path" on the server, since
// we can find a lot of things presented as "Latest/..." and
// so on. This can be a single string or a list of strings.
'globs' : '*/Songs/*'
}],
// To turn the volume up and down. This one goes up to 11.
[ "dexter.service.volume.VolumeService", {
}],
[ "dexter.service.weather.WeatherService", {
// The region is where the service is running; only 'US' and
// 'UK' are supported right now.
"region" : "US",
// The latitude and longitude coordinates, which can be pulled
// out of things like Google Maps.
"coordinates" : "40.7484445,-73.9878531"
// If the UK then an API key is needed from the Met Office
// website.
"api_key" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
}],
// To query Wikipedia about things
[ "dexter.service.wikiquery.WikipediaService", {
}]
]
}
}