Last active
August 29, 2015 14:08
-
-
Save cdrum/1f81302c701af78b2b51 to your computer and use it in GitHub Desktop.
Simple script to check status of lifx bulbs using ruby http api, and display count and last check time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
?php | |
$now = date("r"); | |
// Change these settings to match your environment | |
const RESTAPI_URL = "http://192.168.1.221:56780"; | |
$result = json_decode(file_get_contents(RESTAPI_URL . "/lights.json")); | |
if ($result) { | |
$number_bulbs = count($result); | |
} else { | |
$number_bulbs = "ERROR"; | |
} | |
?> | |
<html> | |
<head> | |
<style> | |
.container { | |
background-color: #000000; | |
text-align: center; | |
} | |
.lifx-bulb-count { | |
color: crimson; | |
font-size: 80px; | |
} | |
.update-time { | |
color: white; | |
} | |
.title { | |
color: white; | |
font-size: 30px; | |
} | |
</style> | |
</head> | |
<body class="container"> | |
<div class="title">LIFX Bulbs Status</div> | |
<div class="lifx-bulb-count"><?=$number_bulbs?></div> | |
<div class="update-time">Last Checked:<br /><?=$now?></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment