Using Google Assistant to control and read from my LAN devices
More notes for backup and
a bad memory - -
These notes will be upgraded at random times
This first hack is WORKING but not yet tidy, , , ,
Objective - Say "OK Google"
then a verbal command to control IFTTT linked to the Maker
Channel to send GET http requests
to CGI scripts running on
linux devices on my home and garden LAN
Then use the Raspberry Pi to perform actions on other LAN
devices, Arduinos etc.
NEW!!
I can now run local bash scripts etc by speaking a command
and using Google AIY code as in the cardboard
kit.
That code is much easier than the full Google
Assistant code for a novice like me to use !
So there is now no need for IFTTT to gain
verbal control of you LAN devices - SEE
BELOW!
Google
Assistant with wake word "OK Google" or "Hey Google"
runs on a raspberry Pi with USB microphone and TV
speaker or on-board headphone socket to amplifier and
speaker.
It is much the same as an Echo Dot but much easier to
hack!
The
cardboard Google AIY kit given away with the MagPi
magazine can only respond to a wake word with a hack (it
is designed to use a button).
I find that the hack has a random delay after responding
to the wake word and becoming live for a verbal command.
The Google Assistant with built in wake word responds
without delay.
I have yet to test the camera.
the key line is -
actor.add_keyword( _('read the data'), SpeakShellCommandOutput( say, "/home/pi/test/bashread.sh", _('there is no data')))
/home/pi/test/bashread.sh is -
#!/bin/bash
read VAR1 < data.txt
echo $VAR1
and data.txt in the same folder contains -
44
I say "OK Google, read the data"
She says "44"
I think that the speech is created locally - it sounds a bit "robot"
So now we can use bash etc to do anything following a verbal command.
Please email me if you want to swap notes