With a bit of spare time over the Christmas break, I have been working around with my google home and PiHome. I was ready to buy a boost console from PiHome but decided to try my own attempts first. Rather than using a physical button, I decided to try voice commands instead. Below is the description of how I got there – I’m sure you can think of a number of improvements/ a much simply way of coding this, but you might find it useful.

The Goal

  • Link Google assistant to PiHome in order to:
  • Issue voice command to activate each boost zone
  • Issue voice command to stop all current boost/schedules

The Method

Rather than risk over loading my PiHome Raspberry pi 3B – I decided to run all voice related tasks via a separate Raspberry Pi. After much research into MQTT, I decided I was way outside my knowledge base and decided to use a much simpler interface – node-red – to handle all coding. I’m sure it is possible to do this via MQTT which would easily run via a Broker on the PiHome Raspberry pi for someone with more knowledgeable in these subjects.

This is the information route I will be using to accomplish the goal.

PiHome IFTTT Google Assistance and Node-RED

PiHome IFTTT Google Assistance and Node-RED

In Essence

Talk to google assistant
The trigger phrase is picked up by IFTTT
IFTTT then issues a webhook (with a comfortable amount of security)
Node-Red then picks up this webhook and converts the response into a string
Dependant on the phrase – node-red sorts the command into a update statement for SQL for the Boost database

Steps to Accomplish The Task

  1. Set up Raspberry pi with Buster (I choose to run with Raspbian Buster Lite)
  2. Set up Node-Red
  3. Setup Apache, MySQL Server and PhpMyadmin (LAMP), I followed these instructions to the letter –
  4. Assuming you already have a google home device and an IFTTT account…then you simply follow these steps 
  5. To set up my Google Assistant trigger phrases I decided to run with the following: Trigger Phrase = Boost Downstairs – this sends the following message body via webhooks as a JSON post { "action": "boost_downstairs_on" } (all set out in the link in step 4)
  6. This is my node red setup.

Note. I have ‘node-red-contrib-webhookrelay’ & ‘node-red-node-mysql’ installed as extra node inputs/outputs.

Node-RED Contrib Webhook Relay

Node-RED Contrib Webhook Relay

As you can see once the phrase triggers a webhookrelay. I then extract the body, convert to JSON and then determine which boost zone to activate via an SQL update to the database.

Note. If you’re wondering why I have multiple update statements, I have 2 zones per floor, so I have to trigger 2 boosts before the boiler and zone value kick-in.

The ifttt trigger allows you to set an automated response. In my case, when I say “hey google, boost downstairs heating” – google responses “okay, heating turned on downstairs for 1 hour”.

Note. This is a dumb statement. For now google cannot determine the status of the boost (acknowledge/confirmation), it can only blindly issue a command and hope the SQL table gets updated.

This has worked flawlessly for the last few days. It’s complicated only because of my lack of Php/Python coding. Also as I have decided to run this on a separate raspberry pi (for now). I have created an additional user within MariaDB and granted privileges for this user to query/update via a set IP address.

But I am working in the next phase, where I can query zone temperatures and schedules/boost/boiler status and have google speak them back to me. A number of people have accomplished this via the google-notify (TTS) node.

I will forward details as soon as I have it working.

This is an export of my node-red palette, you can import this node directly as a template, but it will need to be populated with your own webhookrelay security info and database login details.

Thank you Paul Geoghegan the author of this post sharing this with me and with PiHome community.