Starting Off
One of the things that has bothered me quite severely, is that I was not able to get my Google Nest Protect (Smoke alarm) into Homey. This isn’t necessarily Homey’s fault. It’s just Google being Google, and they love refusing to make Local API’s available for their devices.
After a bit of digging, I figured out a way to let me add the smoke detector towards my Homey. Or well… I created a device, thanks to the Advanced Virtual Devices app. This in conjunction with the Google Scripting interface, allows you to trigger a flow in Homey to set the smoke alarm towards true or false, based on the state of the alarm.
Kind Reminder & Warning: Remember that your smoke alarm is a security device. Never trust solely on your home automation to protect your house.
That being said. Let’s get going!
Prerequisites
- You need to make sure that your Nest Protect is connected towards the Google Nest app. You can download this from your favorite App Store. I won’t go into too much detail on how to do this, as there are other tutorials for that.
- You need to have the Device Capabilities app installed on your Homey.
- Your Homey needs to be connected towards Google Assistant.
- The set-up needs to be done via a computer, as it’s absolutely cumbersome (and I don’t think it’s even possible) to set-up this project on a mobile device.
Installation
Homey
Setting up the Advanced Virtual Device
- To setup the AVD, add a new device in Homey and click on Device Capabilities and choose the device Advanced Virtual Device.
- Create an empty AVD, set-up a name for your smoke alarm and choose an icon.
- On your Homey Devices dashboard, right-click on your newly created AVD and press “Repair”.
- The device properties opens. Choose Sensor as a device class.
- Create a new Yes/No field and give it a name for your smoke status. Something like Smoke Detected or in my case Rook.
- Make sure that Show As is set-up as Smoke Alarm, and click on Create real fields and flow cards.
- Save your device.
This finishes your AVD and you’ve created a virtual smoke alarm which won’t do much for now, but that’s what we’ll be creating flows for.
Creating the flows
In this section we’ll be creating a flow that will set the Yes/No field in your AVD to true if smoke is detected or to false if smoke is no longer detected.
- Create a simple flow. This will be the flow to detect smoke.
- Select When this flow is started as the If condition.
- In the Then section, select your newly created AVD and choose the flow card Set Yes/No field to Yes/No and Do Nothing.
- Make sure your Yes/No field is selected and select Yes and Do Nothing as a value. This will give you a flow card like such:
- Test your flow by clicking on Test. Homey will sent a notification to your devices to warn you that the smoke alarm has triggered.
- Click on Save.
- Duplicate the flow and create another flow to disable the smoke alarm. Just place your Yes/No value to No.
- Test the flow again. Homey will send a notification that there’s no longer any smoke detected.
You might wonder that this is very nice and all, but in this sense we really need to manually trigger the flows. However, we can favorite both flows, which in turn will send the flows towards Google Home. They show up in Google Home as a “Scene”, making it possible to “Activate” the scene in Google Home. This in turn runs the Smoke Detected/No Smoke Detected flows, respectively.
The most important part of this last piece of text is that you need to Favorite both Homey Flows. They will show up in your favorite flows, but will also go to Google Home.
Google Home
Setting up Google Home
To make sure that your flows turn up into Google Home you need to take some actions to get them into Google Home. So grab your mobile device and open the Google Home app. Then:
- Go to Settings
- Click on Works With Google under Services
- Click on Homey and press Check for new devices.
Your flows will now be loaded in and you will be able to use them in the script editor from Google.
Creating the scripts
Now for the actual magic. Go back to your computer and follow these steps.
- Go to Google Home On Web
- On the page click on Automations.
- In the bottom right click on Add New
This will bring you in the script editor. Paste the following script and replace the commented fields with your devices.
Script for Smoke Alarm Firing:
metadata:
name: Brandalarm Gaat Af
description: Bandalarm Gaat Af
automations:
- starters:
- type: device.state.SensorState
device: Nachthal - Nachthal # Your Nest Protect Device.
state: currentSensorStateData.SmokeLevel.currentSensorState
is: high
- type: device.state.SensorState
device: Nachthal - Nachthal
state: currentSensorStateData.SmokeLevel.currentSensorState
is: smoke detected
actions:
- type: device.command.ActivateScene
activate: true
devices: Flow Nachthal - Rook Gedetecteerd # Your created flow when smoke is detected.
Script for Smoke Alarm Cleared:
metadata:
name: Brandalarm Gaat Uit
description: Bandalarm Gaat Uit
automations:
- starters:
- type: device.state.SensorState
device: Nachthal - Nachthal # Your Nest Protect Device.
state: currentSensorStateData.SmokeLevel.currentSensorState
is: no smoke detected
actions:
- type: device.command.ActivateScene
activate: true
devices: Flow Nachthal - Rook Trekt Op # Your created flow when smoke has cleared.
Finishing Up
Voila. And now you’ve set-up a virtual smoke alarm that gets its input from Google Home.
Try out the smoke alarm by holding a lighter under it or a candle (don’t drop it, don’t burn yourself).
Hopefully you thought this was useful. It’s my way of finally being able to give something back towards the community.
All the best!
B