- lots of debugging
- beginning to add graphical stats - beginning to add device by type - added a dashboard "etage" - begining to add notification to multiple recipients in freemobile hook
This commit is contained in:
@ -11,33 +11,31 @@ class radiateurs extends hook
|
||||
public $delay = 3; // amount of time in $timeunit
|
||||
public $delayManual = 15; // amount of time in $timeunit for manual mode
|
||||
public $timeUnit = "minute"; // unit of time for delay, second, minute, day, week, month, year
|
||||
// list of devices we are listening to
|
||||
|
||||
// devicelist[$ieeAddress][0] => property to watch
|
||||
// devicelist[$ieeAddress][1] => initialized = true
|
||||
// list of devices we are listening to: ieeeAddress => property to watch
|
||||
protected $devicelist = array(
|
||||
RDC_CHAMBRE_BAIE => "contact",
|
||||
RDC_SALON_BAIE => "contact",
|
||||
RDC_ENTREE_PORTE => "contact",
|
||||
ETAGE_ENTREE_PORTE => "contact",
|
||||
// RDC_SALON_BAIE => "contact",
|
||||
// RDC_ENTREE_PORTE => "contact",
|
||||
ETAGE_PORTE_ENTREE => "contact",
|
||||
ETAGE_CUISINE_FENETRE => "contact",
|
||||
ETAGE_SALON_FENETRE => "contact",
|
||||
ETAGE_SALON_PORTE_FENETRE => "contact",
|
||||
ETAGE_CHAMBRE_FENETRE => "contact",
|
||||
ETAGE_BUREAU_FENETRE => "contact"
|
||||
ETAGE_PORTE_FENETRE => "contact",
|
||||
// ETAGE_CHAMBRE_FENETRE => "contact",
|
||||
// ETAGE_BUREAU_FENETRE => "contact"
|
||||
);
|
||||
|
||||
PROTECTED $hvac = array(
|
||||
protected $hvac = array(
|
||||
RDC_CHAMBRE_BAIE => RDC_CHAMBRE_RADIATEUR,
|
||||
RDC_SALON_BAIE => RDC_SALON_RADIATEUR,
|
||||
RDC_ENTREE_PORTE => RDC_SALON_RADIATEUR,
|
||||
RDC_GARAGE_PORTE => RDC_SDB_RADIATEUR,
|
||||
ETAGE_ENTREE_PORTE => ETAGE_SALON_RADIATEUR,
|
||||
GARAGE_PORTE => RDC_SDB_RADIATEUR,
|
||||
ETAGE_PORTE_ENTREE => ETAGE_SALON_RADIATEUR,
|
||||
ETAGE_CUISINE_FENETRE => ETAGE_SALON_RADIATEUR,
|
||||
ETAGE_SALON_FENETRE => ETAGE_SALON_RADIATEUR,
|
||||
ETAGE_SALON_PORTE_FENETRE => ETAGE_SALON_RADIATEUR,
|
||||
ETAGE_PORTE_FENETRE => ETAGE_SALON_RADIATEUR,
|
||||
// ETAGE_CHAMBRE_FENETRE => ETAGE_CHAMBRE_RADIATEUR,
|
||||
ETAGE_BUREAU_FENETRE => ETAGE_BUREAU_RADIATEUR,
|
||||
// ETAGE_BUREAU_FENETRE => ETAGE_BUREAU_RADIATEUR,
|
||||
// ETAGE_SDB_FENETRE => ETAGE_SDB_RADIATEUR
|
||||
);
|
||||
|
||||
@ -55,38 +53,42 @@ class radiateurs extends hook
|
||||
public function callBack(&$device, $property, $value)
|
||||
{
|
||||
global $indexDevices;
|
||||
$now = date("MM");
|
||||
if ($now <= 5 or $now >= 11)
|
||||
logger(DEBUG, "Callback : " . $this->hookName, __FILE__ . ":" . __LINE__);
|
||||
if ($this->active === true)
|
||||
{
|
||||
if ($value === false)
|
||||
$now = date("MM");
|
||||
if ($now <= 5 or $now >= 11)
|
||||
{
|
||||
send($indexDevices[$hvac[$device->ieeeAddress]], true);
|
||||
/* switch ($device->$ieeeAdress)
|
||||
if ($value === false)
|
||||
{
|
||||
send($indexDevices[$hvac[$device->ieeeAddress]], false);
|
||||
case RDC_CHAMBRE_BAIE:
|
||||
break;
|
||||
case RDC_SALON_BAIE:
|
||||
case RDC_ENTREE_PORTE:
|
||||
break;
|
||||
case RDC_GARAGE_PORTE:
|
||||
break;
|
||||
case ETAGE_CUISINE_FENETRE:
|
||||
case ETAGE_SALON_FENETRE:
|
||||
case ETAGE_SALON_PORTE_FENETRE:
|
||||
case ETAGE_ENTREE_PORTE:
|
||||
$this->send($indexDevices[$this->hvac[$device->ieeeAddress]], true);
|
||||
/* switch ($device->$ieeeAddress)
|
||||
{
|
||||
send($indexDevices[$hvac[$device->ieeeAddress]], false);
|
||||
case RDC_CHAMBRE_BAIE:
|
||||
break;
|
||||
case RDC_SALON_BAIE:
|
||||
case RDC_ENTREE_PORTE:
|
||||
break;
|
||||
case RDC_GARAGE_PORTE:
|
||||
break;
|
||||
case ETAGE_CUISINE_FENETRE:
|
||||
case ETAGE_SALON_FENETRE:
|
||||
case ETAGE_SALON_PORTE_FENETRE:
|
||||
case ETAGE_ENTREE_PORTE:
|
||||
|
||||
break;
|
||||
case ETAGE_CHAMBRE_FENETRE:
|
||||
break;
|
||||
case ETAGE_CHAMBRE_FENETRE:
|
||||
|
||||
break;
|
||||
case ETAGE_BUREAU_FENETRE:
|
||||
break;
|
||||
case ETAGE_BUREAU_FENETRE:
|
||||
|
||||
break;
|
||||
}*/
|
||||
}else
|
||||
{
|
||||
send($indexDevices[$hvac[$device->ieeeAddress]], false);
|
||||
break;
|
||||
}*/
|
||||
}else
|
||||
{
|
||||
$this->send($indexDevices[$this->hvac[$device->ieeeAddress]], false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -94,31 +96,33 @@ class radiateurs extends hook
|
||||
function send($device, $state)
|
||||
{
|
||||
global $indexDevices;
|
||||
$flag = false;
|
||||
if ($state === false)
|
||||
{
|
||||
$t = getValue($device, "current_heating_setpoint");
|
||||
if ($t != $minTemp)
|
||||
$t = getValue($device->ieeeAddress, "current_heating_setpoint");
|
||||
if ($t != $this->minTemp)
|
||||
{
|
||||
$prevTemp[$device] = getValue($device, "current_heating_setpoint");
|
||||
$this->prevTemp[$device->ieeeAddress] = getValue($device->ieeeAddress, "current_heating_setpoint");
|
||||
}
|
||||
}else
|
||||
{
|
||||
$r = array_keys($hvac, $device->ieeeAddress);
|
||||
$r = array_keys($this->hvac, $device->ieeeAddress);
|
||||
foreach($r as $value)
|
||||
{
|
||||
if (getValue($indexDevices[$value], "contact") === true)
|
||||
logger(DEBUG, "Device to test for contact " . $value, __FILE__ . ":" . __LINE__);
|
||||
if (getValue($device->ieeeAddress, "contact") === true)
|
||||
{
|
||||
$flag = true;
|
||||
$flag &= true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($flag === false)
|
||||
{
|
||||
$msg = array("current_heating_setpoint" => (!empty($prevTemp[$device])?$prevTemp[$device]:19));
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $deviceTarget->friendlyName), __FILE__ . ":" . __LINE__);
|
||||
$deviceTarget->payload = $msg;
|
||||
$deviceTarget->set();
|
||||
$deviceTarget->method = AUTO;
|
||||
$msg = array("current_heating_setpoint" => (!empty($this->prevTemp[$device->ieeeAddress])?$this->prevTemp[$device->ieeeAddress]:19));
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $device->friendlyName), __FILE__ . ":" . __LINE__);
|
||||
$device->payload = $msg;
|
||||
$device->set();
|
||||
$device->method = AUTO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user