@@ -55,7 +55,8 @@ class SampleAssistant(object):
55
55
"""Sample Assistant that supports conversations and device actions.
56
56
57
57
Args:
58
- device_id: identifier of the device.
58
+ device_model_id: identifier of the device model.
59
+ device_id: identifier of the registered device instance.
59
60
conversation_stream(ConversationStream): audio stream
60
61
for recording query and playing back assistant answer.
61
62
channel: authorized gRPC channel for connection to the
@@ -64,8 +65,9 @@ class SampleAssistant(object):
64
65
device_handler: callback for device actions.
65
66
"""
66
67
67
- def __init__ (self , device_id , conversation_stream , channel , deadline_sec ,
68
- device_handler ):
68
+ def __init__ (self , device_model_id , device_id , conversation_stream ,
69
+ channel , deadline_sec , device_handler ):
70
+ self .device_model_id = device_model_id
69
71
self .device_id = device_id
70
72
self .conversation_stream = conversation_stream
71
73
@@ -192,6 +194,7 @@ def gen_converse_requests(self):
192
194
),
193
195
converse_state = converse_state ,
194
196
device_config = embedded_assistant_pb2 .DeviceConfig (
197
+ device_model_id = self .device_model_id ,
195
198
device_id = self .device_id ,
196
199
)
197
200
)
@@ -212,9 +215,12 @@ def gen_converse_requests(self):
212
215
default = os .path .join (click .get_app_dir ('google-oauthlib-tool' ),
213
216
'credentials.json' ),
214
217
help = 'Path to read OAuth2 credentials.' )
218
+ @click .option ('--device-model-id' , required = True ,
219
+ metavar = '<device model id>' ,
220
+ help = 'Unique device model identifier.' )
215
221
@click .option ('--device-id' , required = True ,
216
- metavar = '<device id>' , show_default = True ,
217
- help = 'Unique device instance identifier.' )
222
+ metavar = '<device id>' ,
223
+ help = 'Unique registered device instance identifier.' )
218
224
@click .option ('--verbose' , '-v' , is_flag = True , default = False ,
219
225
help = 'Verbose logging.' )
220
226
@click .option ('--input-audio-file' , '-i' ,
@@ -252,7 +258,7 @@ def gen_converse_requests(self):
252
258
help = 'gRPC deadline in seconds' )
253
259
@click .option ('--once' , default = False , is_flag = True ,
254
260
help = 'Force termination after a single conversation.' )
255
- def main (api_endpoint , credentials , device_id , verbose ,
261
+ def main (api_endpoint , credentials , device_model_id , device_id , verbose ,
256
262
input_audio_file , output_audio_file ,
257
263
audio_sample_rate , audio_sample_width ,
258
264
audio_iter_size , audio_block_size , audio_flush_size ,
@@ -342,7 +348,7 @@ def onoff(on):
342
348
else :
343
349
logging .info ('Turning device off' )
344
350
345
- with SampleAssistant (device_id , conversation_stream ,
351
+ with SampleAssistant (device_model_id , device_id , conversation_stream ,
346
352
grpc_channel , grpc_deadline ,
347
353
device_handler ) as assistant :
348
354
# If file arguments are supplied:
0 commit comments