Things used in this project

Hardware components:
Google Home
×1
Phpoc blue per 100x1000 euk22wtv9i
PHPoC Blue
×1
Relay board t type jznmyjoo9g
PHPoC 4-Port Relay Expansion Board (T-type)
×1
Light Build
×1
Software apps and online services:
Q8wtlimqnp04fzhtr9v5
IFTTT Maker service

Code

index.phpPHP
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

On uvdqjvxt6b
phpoc_man
3 projects • 84 followers
Contact

Comments