Advertisement
Guest User

Untitled

a guest
May 10th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. <?php
  2. include "ring.php";
  3.  
  4. $username = 'YOUR EMAIL ADDRESS HERE';
  5. $password = 'YOUR RING.COM PASSWORD HERE';
  6.  
  7. $bell = new Ring();
  8. print "Authenticating...\n";
  9. $bell->authenticate($username, $password);
  10.  
  11. print "My devices:\n";
  12. var_dump($bell->devices());
  13.  
  14. print "Start polling for motion or dings...\n";
  15. while(1) {
  16. $states = $bell->poll();
  17. if ($states) {
  18. foreach($states as $state) {
  19. if ($state['is_ding']) {
  20. print "Somebody pushed the button!\n";
  21. }
  22.  
  23. if ($state['is_motion']) {
  24. print "There's motion in the ocean!\n";
  25. }
  26. }
  27. }
  28. sleep(5);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement