Minor modif to moha.php\nDebug\nAdded script rdc_temperature_int_ext
This commit is contained in:
28
hooks/scripts/rdc_temperature_int_ext.php
Normal file
28
hooks/scripts/rdc_temperature_int_ext.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
// script to prevent when exterior temperature become inferior or superior to interior one
|
||||
class rdc_temperature_int_ext extends hook
|
||||
{
|
||||
public $hookName = "rdc_wc_eclairage";
|
||||
public $active = true; //enable/disable hook (true => enabled)
|
||||
|
||||
protected $devicelist = array(
|
||||
METEO=> "tempc",
|
||||
);
|
||||
|
||||
// callback fonction. Is called with these 4 parameters
|
||||
public function callBack(&$device, $property, $value)
|
||||
{
|
||||
global $indexDevices;
|
||||
if ($device->properties["indoortempc"]["value"] > $value)
|
||||
{
|
||||
logger(ALERT, _("Indoor temperature is superior to outdoor one"))
|
||||
}elseif ($device->properties["indoortempc"]["value"] < $value)
|
||||
{
|
||||
logger(ALERT, _("Indoor temperature is inferior to outdoor one"))
|
||||
}
|
||||
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, bool2string($value)), __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
}
|
||||
|
||||
$hooks["rdc_temperature_int_ext"] = new rdc_temperature_int_ext();
|
||||
?>
|
Reference in New Issue
Block a user