Advertisement
Guest User

weathercat to ISY

a guest
Mar 2nd, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1. <?php
  2. // This script replaces the $50 that Universal Devices charges for the ISY weather module
  3.  
  4. $r = mysql_connect('127.0.0.1','MySQLUSERNAME','MySQLPASSWORD') or die("couldnt connect");
  5. mysql_select_db('weathercat') or die("couldnt select db");
  6.  
  7. $q = "SELECT ROUND(((`temperature_c` * 9) / 5) + 32) as outside_temp FROM `WeatherData` ORDER BY `WeatherData`.`Time` DESC LIMIT 1";
  8. $r = mysql_query($q) or die(mysql_error());
  9. $result = mysql_fetch_object($r);
  10.  
  11.  
  12. file_get_contents('http://ISYUSERNAME:ISYPASSWORD@10.0.1.201/rest/vars/set/1/1/'.$result->outside_temp);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement