Skip to content

Commit 0458a74

Browse files
committed
added update_settings method
1 parent baf6ff9 commit 0458a74

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

anki_vector/behavior.py

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,33 @@ async def app_intent(self, intent: str, param: str = None) -> protocol.AppIntent
221221
app_intent_request = protocol.AppIntentRequest(intent=intent, param=param)
222222
return await self.conn.grpc_interface.AppIntent(app_intent_request)
223223

224+
# TODO Make this cancellable with is_cancellable_behavior
225+
@connection.on_connection_thread()
226+
async def update_settings(self, settings) -> protocol.UpdateSettingsResponse:
227+
"""Send Vector an intention to do something.
228+
229+
.. testcode::
230+
231+
import anki_vector
232+
with anki_vector.Robot() as robot:
233+
robot.behavior.update_settings(settings={'locale':'en_US'})
234+
235+
:param settings: A list object with the following keys
236+
clock_24_hour: bool
237+
eye_color: EyeColor
238+
default_location: string,
239+
dist_is_metric: bool
240+
locale: string
241+
master_volume: Volume
242+
temp_is_fahrenheit: bool
243+
time_zone: string
244+
button_wakeword: ButtonWakeWord
245+
246+
:return: object that provides the status
247+
"""
248+
updatet_settings_request = protocol.UpdateSettingsRequest(settings=settings)
249+
return await self.conn.grpc_interface.UpdateSettings(updatet_settings_request)
250+
224251
# TODO Make this cancellable with is_cancellable_behavior?
225252
@connection.on_connection_thread()
226253
async def set_eye_color(self, hue: float, saturation: float) -> protocol.SetEyeColorResponse:
@@ -954,9 +981,10 @@ def __init__(self,
954981
self._port = config["port"]
955982

956983
if self._name is None or self._ip is None or self._cert_file is None or self._guid is None:
957-
raise ValueError("The Robot object requires a serial and for Vector to be logged in (using the app then running the anki_vector.configure executable submodule).\n"
958-
"You may also provide the values necessary for connection through the config parameter. ex: "
959-
'{"name":"Vector-XXXX", "ip":"XX.XX.XX.XX", "cert":"/path/to/cert_file", "guid":"<secret_key>"}')
984+
raise ValueError(
985+
"The Robot object requires a serial and for Vector to be logged in (using the app then running the anki_vector.configure executable submodule).\n"
986+
"You may also provide the values necessary for connection through the config parameter. ex: "
987+
'{"name":"Vector-XXXX", "ip":"XX.XX.XX.XX", "cert":"/path/to/cert_file", "guid":"<secret_key>"}')
960988

961989
self._conn = connection.Connection(self._name, ':'.join([self._ip, self._port]), self._cert_file, self._guid,
962990
behavior_control_level=connection.CONTROL_PRIORITY_LEVEL.RESERVE_CONTROL)

0 commit comments

Comments
 (0)