Your own Raspberry Pi Google Assistant

To solve this, we can setup the consent screen for the application by going to Credentials -> OAuth Consent Screen on the Google Cloud Platform (Again, make sure to select your application!)5. When filling in the authorization code, you will see:Step 5: PortAudio errorsYou may encounter the following PortAudio error:2. Install the dependency:sudo apt-get install libportaudio23. To disable dropouts and delays in the audio signal, comment out the following in /etc/pulse/default.pa :4. Also run PulseAudio system-wide to avoid issues with the Google Assistant daemon:sudo nano /etc/systemd/system/pulseaudio.service5. Add the following lines:[Unit] Description=PulseAudio Sound Server in system-wide mode [Service] Type=forking PIDFile=/var/run/pulse/pid ExecStart=/usr/bin/pulseaudio –system –disallow-exit=1 –disable-shm=1 –fail=1 –daemonize[Install] WantedBy=multi-user.target6. Enable the service and add the pi user to the pulse-access group:sudo systemctl –system enable pulseaudio.servicesudo adduser pi pulse-access7. Disable the following module to avoid audio delays in /etc/pulse/default.pa#load-module module-suspend-on-idlesudo nano /etc/systemd/system/assistant.serviceStep 6: Turn the Assistant into a serviceCreate a file ~/start_assistant.sh, using the device model ID obtained from the Google Action platform:#!/bin/bashsource /home/pi/googleassistant/env/bin/activategooglesamples-assistant-hotword –device-model-id <your_device_model_id> 2. Make the script executable:chmod +x start_assistant.sh3. Create a service file in /etc/systemd/system/assistant.service[Unit]Description=Google AssistantWants=network-online.targetAfter=network-online.target[Service]Type=simpleExecStart=/bin/bash /home/pi/start_assistant.shRestart=on-abortUser=piGroup=pi[Install]WantedBy=multi-user.target4. Enable and start the service:sudo systemctl enable assistant.servicesudo systemctl start assistant.serviceFinalizingNow you can enjoy the Google Assistant on your Raspberry Pi by querying it using the hotwords “Hey Google” or “Ok Google”. You can also register the device in the Google Assistant app on iOS or Android.You can also make your own custom actions using Google Actions, e.g. opening garage doors, controlling your coffee machine, changing the lights. You name it :) — I look forward to hear about what home automation projects you are doing!. More details

Leave a Reply