-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathexample.php
More file actions
29 lines (24 loc) · 763 Bytes
/
example.php
File metadata and controls
29 lines (24 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
include "ring.php";
$username = 'YOUR EMAIL ADDRESS HERE';
$password = 'YOUR RING.COM PASSWORD HERE';
$bell = new Ring();
print "Authenticating...\n";
$bell->authenticate($username, $password);
print "My devices:\n";
var_dump($bell->devices());
print "Start polling for motion or dings...\n";
while(1) {
$states = $bell->poll();
if ($states) {
foreach($states as $state) {
if ($state['is_ding']) {
print "Somebody pushed the button!\n";
}
if ($state['is_motion']) {
print "There's motion in the ocean!\n";
}
}
}
sleep(5);
}