siansoft
Posts: 1
Joined: Mon Aug 10, 2015 10:18 pm

Running AIY Google Assistant On Boot-up on Raspberry pi3

Thu Dec 21, 2017 10:47 am

Hi All :)

How can I run AIY Google Assistant on the boot-up on raspberry pi 3 without the need of monitor? I try to make a .sh file and i put the code below but it's not working? I try to make a .sh file and i put the code below but it's not working

Code: Select all

#!/bin/sh
cd /
cd /home/pi
cd AIY-voice-kit-python/src
sudo python assistant_library_demo.py
cd /

jrtapiajr
Posts: 3
Joined: Fri Dec 15, 2017 5:12 pm

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Thu Dec 21, 2017 10:22 pm

goto misperry youtube website and search for "google assistant auto startup" video. He does a good job showing how to write a script for auto start up. I had to change the part where he said to type "google-assistant-demo& ....to get in running in the background." I had to add the "registration information" project id and device Id name. This information can be taken from the registration setup on the google SDK developer website. the guide shows you how to register your device so the google assistant can work right. This additional step is due to the recent update of the SDK as of yesterday.

avzdkdk
Posts: 5
Joined: Mon Dec 04, 2017 4:23 pm

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Sun Dec 31, 2017 8:38 am

I have added one line to the crontab.

Code: Select all

@reboot sleep 120 && cd /home/pi/AIY-voice-kit-python && /home/pi/AIY-voice-kit-python/env/bin/python3 /home/pi/AIY-voice-kit-python/src/assistant_library_demo.py > /home/pi/error.txt 2>&1
Maybe that will help

mpember
Posts: 18
Joined: Tue Aug 15, 2017 12:39 am

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Sun Dec 31, 2017 12:39 pm

The official method is to create a file called main.py (by copying one of the examples or creating a new file) and execute the install-services.sh script (in the scripts folder).

Once you have done this,

Code: Select all

sudo systemctl enable voice-recognizer.service
will turn on the service and have it run at boot.

User avatar
RichardBronosky
Posts: 81
Joined: Thu Feb 14, 2013 5:38 pm
Location: Atlanta, GA, USA

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Tue Jan 02, 2018 7:29 am

Yes, mpember is correct. Please do not use (or spread) methods involving `crontab`, `rc.local`, etc. Raspbian (like all modern distrobutions) uses systemd, and that is the way we do this.

For reference I will add a few links.
HACKING.md explains how to enable the included services. Those instructions assume you have follow the prior instructions on that same page to install the service scripts. If you have done so, then you can make a copy of assistant_library_with_local_commands_demo.py called `main.py` (in that same location).

Since you will certainly be hacking your assistant for a while, be aware of these commands:

Code: Select all

sudo systemctl stop voice-recognizer.service
sudo systemctl start voice-recognizer.service
sudo systemctl restart voice-recognizer.service
-- Bruno Bronosky
1x RPi 1 (B)
1x RPi 1+ (B)
2x RPi 2
11x RPi 3
4x RPi Zero W
2x RPi camera module
3x AIY Voice kits
https://github.com/RichardBronosky/pi-gen-extender
https://github.com/RichardBronosky/raspbian-boot-setup

1car69
Posts: 3
Joined: Thu Mar 01, 2018 10:53 am

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Thu Mar 01, 2018 11:00 am

:D
Thank you RichardBronosky & mpember. You have saved the day. Worked like a charm at my end!

joostvb
Posts: 1
Joined: Fri Mar 02, 2018 6:02 pm

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Fri Mar 02, 2018 6:07 pm

Hi Guys,

i just can't get it to work :(

Service installs, w/o errors, i have a "main.pi" in the source dir, BUT service status says:
● voice-recognizer.service - voice recognizer
Loaded: loaded (/lib/systemd/system/voice-recognizer.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2018-03-02 17:52:50 UTC; 9min ago
Main PID: 1456 (code=exited, status=203/EXEC)

Mar 02 17:52:50 raspberrypi systemd[1]: voice-recognizer.service: Service hold-off time over, scheduling restart.
Mar 02 17:52:50 raspberrypi systemd[1]: Stopped voice recognizer.
Mar 02 17:52:50 raspberrypi systemd[1]: voice-recognizer.service: Start request repeated too quickly.
Mar 02 17:52:50 raspberrypi systemd[1]: Failed to start voice recognizer.
Mar 02 17:52:50 raspberrypi systemd[1]: voice-recognizer.service: Unit entered failed state.
Mar 02 17:52:50 raspberrypi systemd[1]: voice-recognizer.service: Failed with result 'exit-code'.

1car69
Posts: 3
Joined: Thu Mar 01, 2018 10:53 am

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Sun Mar 04, 2018 5:42 pm

Try "main.py" saved in the examples directory... in the same directory where the demo example that you copied and renamed "main.py" resides.

Jagman53
Posts: 2
Joined: Fri Mar 09, 2018 11:22 pm

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Fri Mar 09, 2018 11:26 pm

Hi. I am a noob, so please bear with me. I got the same error message as joostvb after checking the status of the .service file I made. What should I do?

513Kernal
Posts: 1
Joined: Fri Mar 16, 2018 2:24 pm

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Fri Mar 16, 2018 2:31 pm

jrtapiajr wrote:
Thu Dec 21, 2017 10:22 pm
goto misperry youtube website and search for "google assistant auto startup" video. He does a good job showing how to write a script for auto start up. I had to change the part where he said to type "google-assistant-demo& ....to get in running in the background." I had to add the "registration information" project id and device Id name. This information can be taken from the registration setup on the google SDK developer website. the guide shows you how to register your device so the google assistant can work right. This additional step is due to the recent update of the SDK as of yesterday.
Can you go a little more in depth with this?? I also received this same error, and I'm REALLY new to all of this

Image

User avatar
DougieLawson
Posts: 33051
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Fri Mar 16, 2018 5:30 pm

Simplest way (no YT video watching needed)

Create a file with sudo nano /etc/systemd/system/assist.service

Code: Select all

[Unit]
Description=Assist @ reboot

[Service]
ExecStart=/home/pi/assist.py
User=pi
Group=pi
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=assist

[Install]
WantedBy=multi-user.target
Enable it (for next boot) with sudo systemctl enable assist.service
Start it with sudo systemctl start assist.service

That's got Miss Google listening on my RPi3B+ at every boot.
You can change her into Mister Google with, "OK Google, change your voice" ... <wait for response> ... then say, "Yes".
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

themaire
Posts: 14
Joined: Tue Mar 08, 2016 8:56 am

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Fri Mar 16, 2018 8:03 pm

DougieLawson wrote:
Fri Mar 16, 2018 5:30 pm
That's got Miss Google listening on my RPi3B+ at every boot.
Hi Dougie, did you install the Voice hat manualy? I never do it myself but i wait to use my new 3 B+ very soon.

Thanks
All my Raspberry Pi stuffs on my Twitter : @nico_themaire
:D

User avatar
DougieLawson
Posts: 33051
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Fri Mar 16, 2018 9:09 pm

I installed it by git clone https://github.com/google/aiyprojects-raspbian; ln -s aiyprojects-raspbian AIY-projects-python.

That's so I got the latest stuff from Dr. Google including ten month's worth of software fixes and enhancements.

I'm running it on my "early support" RPi3B+, which I've had since the start of February.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

themaire
Posts: 14
Joined: Tue Mar 08, 2016 8:56 am

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Sat Mar 17, 2018 10:02 am

Nice thanks you!

Ho, it is simple like a git clone? Cool. Because i am french, i use the cloud speech api only. I will send a feedback when it’s ok. :)
All my Raspberry Pi stuffs on my Twitter : @nico_themaire
:D

thecoconutdream
Posts: 1
Joined: Sat Mar 17, 2018 11:31 am

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Sat Mar 17, 2018 11:35 am

I have the same problem....I did everything exactly like this: https://aiyprojects.withgoogle.com/voic ... omatically
But my auto start always fails.... I got the feeling that env/bin/.... does not work correctly with the current image... Can you help me?
Attachments
WhatsApp Image 2018-03-17 at 12.29.56.jpeg
WhatsApp Image 2018-03-17 at 12.29.56.jpeg (178.53 KiB) Viewed 5465 times

User avatar
DougieLawson
Posts: 33051
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Sat Mar 17, 2018 11:47 am

themaire wrote:
Sat Mar 17, 2018 10:02 am
Nice thanks you!
Ça ne fait rien.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

garyst1981
Posts: 4
Joined: Tue May 03, 2016 2:31 am
Location: Pennsylvania
Contact: Website

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Mon Mar 19, 2018 1:05 pm

what worked for me is combined 2 of the solutions here

Code: Select all

cd ~/AIY-projects-python/src/examples/voice
then copied one of the examples and renamed it

Code: Select all

cp assistant_library_demo.py main.py
then create the service file

Code: Select all

sudo nano /etc/systemd/system/assist.service
with a little mod from the original poster, instead of using

Code: Select all

/home/pi/assist.py 
used

Code: Select all

/home/pi/AIY-projects-python/src/examples/voice/main.py
to have it like this

Code: Select all

[Unit]
Description=Assist @ reboot

[Service]
ExecStart=/home/pi/AIY-projects-python/src/examples/voice/main.py
User=pi
Group=pi
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=assist
cmd + x, y, enter

then in the terminal

Code: Select all

sudo systemctl enable assist.service
to enable it

then started it

Code: Select all

sudo systemctl start assist.service
turned rpi off

Code: Select all

sudo shutdown -h now
then back ON, and that's it!

JohnOCFII
Posts: 3
Joined: Wed Mar 07, 2018 10:42 pm
Location: Minnesota, USA

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Sat Mar 31, 2018 1:59 am

Anyone else running into the DBUS X11 display issue when attempting this setup?

From var/log/messages:

Code: Select all

Mar 30 22:05:43 raspberrypi pulseaudio[849]: [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Mar 30 22:05:43 raspberrypi pulseaudio[849]: [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
It appears it expects to run under a live graphics terminal session.

I found this explanation -- and it implies it isn't really a "bug." They suggest that apps that use pulseaudio, for example, should ignore the error and continue to run, but it appears this demo app from Google does not.

https://bugs.debian.org/cgi-bin/bugrepo ... bug=690530

I can try to implement their suggested workaround in the launch script, but was curious if others had found a better solution.

Thanks,

John

MrCreightonD
Posts: 1
Joined: Thu Apr 05, 2018 2:54 am

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Thu Apr 05, 2018 3:03 am

Thank you so much garyst1981! I looked and I looked for a solution to no avail. That is until I cam across your post. However, I did have to mod your solution slightly to get past the enabling step.

I added

Code: Select all

[Install]
WantedBy=multi-user.target
onto the bottom of your assist.service file. So it should look like this:

Code: Select all

[Unit]
Description=Assist @ reboot

[Service]
ExecStart=/home/pi/AIY-projects-python/src/examples/voice/main.py
User=pi
Group=pi
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=assist

[Install]
WantedBy=multi-user.target
garyst1981 wrote:
Mon Mar 19, 2018 1:05 pm
what worked for me is combined 2 of the solutions here

Code: Select all

cd ~/AIY-projects-python/src/examples/voice
then copied one of the examples and renamed it

Code: Select all

cp assistant_library_demo.py main.py
then create the service file

Code: Select all

sudo nano /etc/systemd/system/assist.service
with a little mod from the original poster, instead of using

Code: Select all

/home/pi/assist.py 
used

Code: Select all

/home/pi/AIY-projects-python/src/examples/voice/main.py
to have it like this

Code: Select all

[Unit]
Description=Assist @ reboot

[Service]
ExecStart=/home/pi/AIY-projects-python/src/examples/voice/main.py
User=pi
Group=pi
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=assist
cmd + x, y, enter

then in the terminal

Code: Select all

sudo systemctl enable assist.service
to enable it

then started it

Code: Select all

sudo systemctl start assist.service
turned rpi off

Code: Select all

sudo shutdown -h now
then back ON, and that's it!

kevinzhou92
Posts: 1
Joined: Mon Jun 11, 2018 1:24 am

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Mon Jun 11, 2018 1:26 am

JohnOCFII wrote:
Sat Mar 31, 2018 1:59 am
Anyone else running into the DBUS X11 display issue when attempting this setup?

From var/log/messages:

Code: Select all

Mar 30 22:05:43 raspberrypi pulseaudio[849]: [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Mar 30 22:05:43 raspberrypi pulseaudio[849]: [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
It appears it expects to run under a live graphics terminal session.

I found this explanation -- and it implies it isn't really a "bug." They suggest that apps that use pulseaudio, for example, should ignore the error and continue to run, but it appears this demo app from Google does not.

https://bugs.debian.org/cgi-bin/bugrepo ... bug=690530

I can try to implement their suggested workaround in the launch script, but was curious if others had found a better solution.

Thanks,

John
Hey John, i met exactly the same problem like yours, did you figure out how to deal with it?

User avatar
DougieLawson
Posts: 33051
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Running AIY Google Assistant On Boot-up on Raspberry pi3

Mon Jun 11, 2018 9:05 am

I fixed it by running the assistant from the LXDE autostart.

Code: Select all

[email protected]:~/.config/lxsession/LXDE-pi $ cat autostart
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi
@/usr/bin/python3 /home/pi/assist.py
[email protected]:~/.config/lxsession/LXDE-pi $
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

Return to “AIY Projects”

Who is online

Users browsing this forum: No registered users and 0 guests