Skip to content

Instantly share code, notes, and snippets.

@wgroenewold
Last active September 29, 2015 22:23
Show Gist options
  • Save wgroenewold/12a05d035acfe64d5f41 to your computer and use it in GitHub Desktop.
Save wgroenewold/12a05d035acfe64d5f41 to your computer and use it in GitHub Desktop.
Maakplek Deurbel
<?php
/*
* Initial doorbell.
*
* @todo: Twitter connection
* @todo: Storage with timestamp to generate heatmaps
* @todo: Spaceapi.net eraan knopen.
*/
function maakplekDeurbel($devid){
$ch = curl_init('http://api.pushingbox.com/pushingbox?devid=' . $devid);
curl_exec ($ch);
curl_close ($ch);
$state = $_GET["state"];
return $state;
}
@wgroenewold
Copy link
Author

<?php

/*
 * Doorbell 0.1
 *
 * @todo: Twitter connection
 * @todo: Storage with timestamp to generate heatmaps
 * @todo: Spaceapi.net eraan knopen.
 */

echo '<style>
        .deurbel{
            width:150px;
            height:50px;
            background-image:url(img/sprite.png);
        }

';


function maakplekDeurbel($devid){
    $ch = curl_init('http://api.pushingbox.com/pushingbox?devid=' . $devid);
    curl_exec ($ch);
    curl_close ($ch);

    $state = $_GET["state"];

    return $state;
}

if(maakplekDeurbel('keykeykey') == 'open'){
    //open
    echo '<style>
        .deurbel{background-position:0 0;}
    </style>';
}elseif(maakplekDeurbel('keykeykey') == 'gesloten'){
    //gesloten
    echo '<style>
        .deurbel{background-position:0 50px;}
    </style>';
}

echo '<div class="deurbel"></div>';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment