def _add_device(self, device: NewDeviceRequest): """Creates a device and associate it to a pairing session""" device_dict = device.to_native() geography_id = self._ensure_geography_exists(self.db, device_dict) device_dict.update(geography_id=geography_id) device_repository = DeviceRepository(self.db) device_id = device_repository.add(self.account.id, device_dict) return device_id
def _add_device(self, device: NewDeviceRequest) -> str: """Creates a device and associate it to a pairing session. :param device: Schematic containing the request data :return: the database identifier of the new device """ device_dict = device.to_native() geography_id = self._ensure_geography_exists(device_dict) device_dict.update(geography_id=geography_id) device_repository = DeviceRepository(self.db) device_id = device_repository.add(self.account.id, device_dict) return device_id
def add_device(db, account_id, geography_id): device = dict(name='Selene Test Device', pairing_code='ABC123', placement='kitchen', geography_id=geography_id, country='United States', region='Missouri', city='Kansas City', timezone='America/Chicago', wake_word='Selene Test Wake Word', voice='Selene Test Voice') device_repository = DeviceRepository(db) device_id = device_repository.add(account_id, device) return device_id
def add_device(db, account_id, geography_id): device = dict( name="Selene Test Device", pairing_code="ABC123", placement="kitchen", geography_id=geography_id, country="United States", region="Missouri", city="Kansas City", timezone="America/Chicago", wake_word="hey selene", voice="Selene Test Voice", ) device_repository = DeviceRepository(db) device_id = device_repository.add(account_id, device) return device_id