phpoc_man
Published © GPL3+

Google Home - Control DIY Devices

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

EasyFull instructions provided26,893
Google Home - Control DIY Devices

Things used in this project

Hardware components

Google Home
×1
PHPoC Blue
PHPoC Blue
×1
Light Build
×1
PHPoC 4-Port Relay Expansion Board (S-type or T-type)
PHPoC 4-Port Relay Expansion Board (S-type or T-type)
×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

39 projects • 185 followers

Comments