Code: Select all
$infoDedans = $telldus_api->getSensor(178530);
// Get sensor and humidity info in infoDedans Array
$d2 = date('H:i:s', $infoDedans->lastUpdated);
//print_r($infoSensor); --> if tou wanna check
$test=$infoDedans->data[0]->value;
// Getting temp value (in Hash $infoDedans, 2 infos [0] is temp, and value its label and the same goes for [1] (humidity),
// which label is 'value'.
$humidity = $infoDedans->data[1]->value;
// At this point, you can compare value and switchon a device with turnOndevice function of Manticus classes.
// Or implement a json_decode($this->consumer->sendRequest(constant('REQUEST_URI').'/device/turnOn',id,'GET'));
if ($test < 19) {$telldus_api->turnOnDevice(141286)->status;} else {$telldus_api->turnOffDevice(141286)->status;}
Code: Select all
header("Refresh: 10;");