Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
phpoc_man
Published © GPL3+

Google Home - Control DIY Devices

This project show how to control multiple IoT devices using Google Home.

BeginnerFull instructions provided46,586
Google Home - Control DIY Devices

Things used in this project

Hardware components

Google Home
×1
PHPoC Blue
PHPoC Blue
×1
PHPoC 4-Port Relay Expansion Board (S-type or T-type)
PHPoC 4-Port Relay Expansion Board (S-type or T-type)
×1
Light Bulb
×1
Jumper Wires
DIYables Jumper Wires
×1
Starter Kit
DIYables Starter Kit
×1

Software apps and online services

Maker service
IFTTT Maker service

Story

Read more

Code

index.php

PHP
This code handles HTTP request from IFTTT applet and turns on/off the light
<?php
	include_once "/lib/sd_spc.php";
	
	$text_ingredient  = _GET("state");
	$is_on = strpos($text_ingredient, "on");
	$is_off = strpos($text_ingredient, "off");
	
	if($is_on !== false || $is_off !== false)
	{
		spc_reset();
		spc_sync_baud(115200);
		if($is_on !== false)
	    		spc_request(14, 4, "set 0 output high");
	    	else
	    		spc_request(14, 4, "set 0 output low");
	}
?>

Credits

phpoc_man

phpoc_man

62 projects • 408 followers

Comments