This repository contains Python script for your Google AIY Voice Kit that will plug and play pair it with AKHomeAUtomation solution present on my other github. However with some changes I am sure it can be used also with other home automation solutions. Take a look below and maybe it will suit you.
Script itself is basically copy of assistant_library_with_local_commands_demo.py which is provided in Google AIY Voice Kit and is present by default in /home/pi/AIY-projects-python/src/examples/voice directory.
This script contains the following changes that make it work with AKHomeAutomation (and perhaps other) home automation solution.
- it introduces getDevicesData method which is called at the beginnning of script operation. This method contacts home automation server service to receive list of devices (in json format) that would be used by Google Voice Kit. What is crutial is "hotword" property per items that we want to be recognizable by Google Voice Kit.
- it introduces checkItem method which is called when Voice Kit analyzes what user said. If command ends with "on" or "off" this method tries to map rest of the sentence with one of items "hotword". If it succeeds, the script would send url to home automation system with proper values to enable/disable proper device. "on" or "off" endings can be customized by changing initRecognitionStatuses config item from settings.json config.
- If you wish to use this script with AKHomeAUtomation all you need to do is change remoteUrl configuration item from settings.json with proper server address.
- If you wish to integrate it with other systrems you probably need to change the way how you obtain json list of devices and how you send on/off signal to your automation solution.
Take care! Wanna touch base? office@webproject.waw.pl