/**
  * overload internal IPS_Create($id) function
  */
 public function Create()
 {
     // Diese Zeile nicht löschen.
     parent::Create();
     //Hint: $this->debug will not work in this stage! must use IPS_LogMessage
     //props
     $this->RegisterPropertyString('Category', 'AVM AHA Devices');
     $this->RegisterPropertyInteger('ParentCategory', 0);
     //parent cat is root
     $this->RegisterPropertyInteger('UpdateInterval', 600);
     $this->RegisterPropertyString('Host', 'fritz.box');
     $this->RegisterPropertyString('User', '');
     $this->RegisterPropertyString('Password', '');
     $this->RegisterPropertyBoolean('AutoCreate', true);
     $this->RegisterPropertyBoolean('Debug', false);
     $this->RegisterPropertyBoolean('Active', false);
     //Vars
     //reinit timer
     $this->RegisterTimer('Update', 0, $this->module_data["prefix"] . '_UpdateEvent($_IPS[\'TARGET\']);');
     if (IPS_GetKernelRunlevel() == self::KR_READY) {
         if ($this->isActive()) {
             $this->SetStatus(self::ST_AKTIV);
             $i = $this->GetUpdateInterval();
             $this->SetTimerInterval('Update', $i * 1000);
             //ms
             $this->init();
         } else {
             $this->SetStatus(self::ST_INACTIV);
             $this->SetTimerInterval('Update', 0);
         }
     }
 }
 /**
  * overload internal IPS_Create($id) function
  */
 public function Create()
 {
     parent::Create();
     //Hint: $this->debug will not work in this stage! must use IPS_LogMessage
     //props
     $this->RegisterPropertyString('Category', 'CUL/CUx Devices');
     $this->RegisterPropertyInteger('ParentCategory', 0);
     //parent cat is root
     $this->RegisterPropertyBoolean('AutoCreate', true);
     $this->RegisterPropertyBoolean('Debug', false);
     $this->RegisterPropertyBoolean('Active', false);
     $this->RegisterPropertyBoolean('UseOW', false);
     //status Vars
     $this->RegisterVariableString('Buffer', 'Buffer', "", -1);
     IPS_SetHidden($this->GetIDForIdent('Buffer'), true);
     $this->RegisterVariableString('LastUpdate', 'Last Update', "", -2);
     IPS_SetHidden($this->GetIDForIdent('LastUpdate'), true);
     $this->RegisterVariableString('AuxMessage', 'Last System Message', "", 1);
     $this->RegisterVariableString('Version', 'Version', "", 2);
     $this->RegisterVariableString('Modus', 'Modus', "", 2);
     $this->RegisterVariableInteger('Errors', 'Errors', 0, 3);
     //reinit timer
     $this->RegisterTimer('ReInit', 58000, $this->module_data["prefix"] . '_ReInitEvent($_IPS[\'TARGET\']);');
     //call init if ready and activated
     if (IPS_GetKernelRunlevel() == self::KR_READY) {
         if ($this->isActive()) {
             $this->SetStatus(self::ST_AKTIV);
             //$this->init();
         } else {
             $this->SetStatus(self::ST_INACTIV);
         }
     }
 }
Beispiel #3
0
 public function Destroy()
 {
     parent::Destroy();
     if (IPS_GetKernelRunlevel() != 10103) {
         return;
     }
     $MediaID = @IPS_GetObjectIDByIdent('Voice', $this->InstanceID);
     if ($MediaID > 0) {
         IPS_DeleteMedia($MediaID, true);
     }
 }
 /**
  * overload internal IPS_ApplyChanges($id) function
  */
 public function ApplyChanges()
 {
     // Diese Zeile nicht loeschen
     parent::ApplyChanges();
     if (IPS_GetKernelRunlevel() == self::KR_READY) {
         if ($this->HasActiveParent()) {
             $this->SetStatus(self::ST_AKTIV);
         } else {
             $this->SetStatus(self::ST_NOPARENT);
         }
         //check status
     }
     //must be here!!
     $this->SetStatusVariables();
     //Update Variables
 }
 /**
  * overload internal IPS_Create($id) function
  */
 public function Create()
 {
     // Diese Zeile nicht löschen.
     parent::Create();
     //Hint: $this->debug will not work in this stage! must use IPS_LogMessage
     //props
     $this->RegisterPropertyString('Category', 'NUT Devices');
     $this->RegisterPropertyInteger('ParentCategory', 0);
     //parent cat is root
     $this->RegisterPropertyInteger('Port', 3493);
     $this->RegisterPropertyInteger('UpdateInterval', 300);
     $this->RegisterPropertyInteger('NomPower', self::default_nomval);
     $this->RegisterPropertyString('IDfield', 'ups.serial');
     $this->RegisterPropertyString('UPSname', '');
     $this->RegisterPropertyString('Host', '');
     $this->RegisterPropertyString('LogFile', '');
     $this->RegisterPropertyBoolean('AutoCreate', true);
     $this->RegisterPropertyBoolean('Debug', false);
     $this->RegisterPropertyBoolean('Active', false);
     //timer
     $this->RegisterTimer('Update', 0, $this->module_data["prefix"] . '_UpdateEvent($_IPS[\'TARGET\']);');
     //Vars
     $this->RegisterVariableString('Buffer', 'Buffer', "", -1);
     IPS_SetHidden($this->GetIDForIdent('Buffer'), true);
     //Connect Parent
     $this->RequireParent($this->module_interfaces['ClientSocket']);
     $pid = $this->GetParent();
     if ($pid) {
         $name = IPS_GetName($pid);
         if ($name == "Client Socket") {
             IPS_SetName($pid, __CLASS__ . " Socket");
         }
     }
     if (IPS_GetKernelRunlevel() == self::KR_READY) {
         if ($this->isActive() && $this->GetParent() > 0) {
             $this->SetStatus(self::ST_AKTIV);
             $i = $this->GetUpdateInterval();
             $this->SetTimerInterval('Update', $i * 1000);
             //ms
             $this->debug(__FUNCTION__, "Starte Timer {$i} sec");
             $this->init();
         } else {
             $this->SetStatus(self::ST_INACTIV);
         }
     }
 }
 /**
  * overload internal IPS_Create($id) function
  */
 public function Create()
 {
     // Diese Zeile nicht löschen.
     parent::Create();
     //Hint: $this->debug will not work in this stage! must use IPS_LogMessage
     //props
     $this->RegisterPropertyString('Category', 'FS20WUE Devices');
     $this->RegisterPropertyInteger('ParentCategory', 0);
     //parent cat is root
     $this->RegisterPropertyInteger('RainPerCount', 295);
     $this->RegisterPropertyString('LogFile', '');
     $this->RegisterPropertyBoolean('AutoCreate', true);
     $this->RegisterPropertyBoolean('Debug', false);
     $this->RegisterPropertyBoolean('Active', false);
     //Vars
     $this->RegisterVariableString('Buffer', 'Buffer', "", -1);
     IPS_SetHidden($this->GetIDForIdent('Buffer'), true);
     $this->RegisterVariableString('LastUpdate', 'Last Update', "", -2);
     IPS_SetHidden($this->GetIDForIdent('LastUpdate'), true);
     //reinit timer
     $this->RegisterTimer('ReInit', 60000, $this->module_data["prefix"] . '_ReInitEvent($_IPS[\'TARGET\']);');
     //Connect Parent
     $this->RequireParent($this->module_interfaces['SerialPort']);
     $pid = $this->GetParent();
     if ($pid) {
         $name = IPS_GetName($pid);
         if ($name == "Serial Port") {
             IPS_SetName($pid, __CLASS__ . " Port");
         }
     }
     //call init if ready and activated
     if (IPS_GetKernelRunlevel() == self::KR_READY) {
         if ($this->isActive()) {
             $this->SetStatus(self::ST_AKTIV);
             $this->init();
         } else {
             $this->SetStatus(self::ST_INACTIV);
         }
     }
 }
 /**
  * overload internal IPS_Create($id) function
  */
 public function Create()
 {
     // Diese Zeile nicht löschen.
     parent::Create();
     //Hint: $this->debug will not work in this stage! must use IPS_LogMessage
     //props
     $this->RegisterPropertyString('Category', 'WS2500 Devices');
     $this->RegisterPropertyInteger('ParentCategory', 0);
     //parent cat is root
     $this->RegisterPropertyInteger('RainPerCount', 295);
     $this->RegisterPropertyInteger('UpdateInterval', 1800);
     $this->RegisterPropertyString('URL', 'http://raspberry/cgi-bin/get_ws2500_data.cgi');
     $this->RegisterPropertyString('LogFile', '');
     $this->RegisterPropertyBoolean('AutoCreate', true);
     $this->RegisterPropertyBoolean('Debug', false);
     $this->RegisterPropertyBoolean('Active', false);
     //Vars
     $this->RegisterVariableInteger('NewDayRainCounter', 'Rain Counter at new Day', "", -1);
     $this->RegisterVariableInteger('LastRainCounter', 'Last Rain Counter', "", -2);
     $this->RegisterVariableInteger('TimeStamp', 'Device Timestamp', 'UnixTimestamp', -3);
     $this->RegisterVariableInteger('Block', 'Block Number', '', -1);
     IPS_SetHidden($this->GetIDForIdent('LastRainCounter'), true);
     IPS_SetHidden($this->GetIDForIdent('NewDayRainCounter'), true);
     //reinit timer
     $this->RegisterTimer('Update', 0, $this->module_data["prefix"] . '_UpdateEvent($_IPS[\'TARGET\']);');
     if (IPS_GetKernelRunlevel() == self::KR_READY) {
         if ($this->isActive()) {
             $this->SetStatus(self::ST_AKTIV);
             $i = $this->GetUpdateInterval();
             $this->SetTimerInterval('Update', $i * 1000);
             //ms
             $this->debug(__FUNCTION__, "Starte Timer {$i} sec");
         } else {
             $this->SetStatus(self::ST_INACTIV);
         }
     }
 }
Beispiel #8
0
 protected function SetStatus($InstanceStatus)
 {
     if (IPS_GetKernelRunlevel() == KR_READY) {
         $OldStatus = IPS_GetInstance($this->InstanceID)['InstanceStatus'];
     } else {
         $OldStatus = -1;
     }
     if ($InstanceStatus != $OldStatus) {
         parent::SetStatus($InstanceStatus);
     }
 }
Beispiel #9
0
 /**
  * Timer abgelaufen Alarm wird erzeugt.
  *
  * @access public
  */
 public function TimerFire2()
 {
     $this->StopTimer();
     if (IPS_GetKernelRunlevel() != KR_READY) {
         return;
     }
     if ($this->Alerts == 0) {
         $this->SetStateVar(true, $this->ActiveVarID);
         $this->DoScript($this->ActiveVarID, true, false);
     } else {
         if ($this->ReadPropertyBoolean('MultipleAlert')) {
             $this->DoScript($this->ActiveVarID, true, false);
         }
     }
     $this->Alerts++;
     $TriggerVarList = $this->NoTriggerVarList;
     foreach ($TriggerVarList->Items as $i => $IPSVars) {
         if ($IPSVars->VarId == $this->ActiveVarID) {
             $TriggerVarList->Items[$i]->Alert = true;
         }
     }
     $this->NoTriggerVarList = $TriggerVarList;
     $this->StartTimer();
 }
Beispiel #10
0
 protected function SetStatus($InstanceStatus)
 {
     if (IPS_GetKernelRunlevel() == KR_READY) {
         $OldStatus = IPS_GetInstance($this->InstanceID)['InstanceStatus'];
     } else {
         $OldStatus = -1;
     }
     if ($InstanceStatus != $OldStatus) {
         parent::SetStatus($InstanceStatus);
         if ($InstanceStatus == IS_ACTIVE) {
             $this->SetTimerInterval('KeepAlive', 3600000);
         } else {
             $this->SetTimerInterval('KeepAlive', 0);
         }
         return true;
     } else {
         return false;
     }
 }
 /**
  * overload internal IPS_Create($id) function
  */
 public function Create()
 {
     // Diese Zeile nicht löschen.
     parent::Create();
     //Hint: $this->debug will not work in this stage! must use IPS_LogMessage
     //props
     $this->RegisterPropertyString('Category', 'WS300PC Devices');
     $this->RegisterPropertyInteger('ParentCategory', 0);
     //parent cat is root
     $this->RegisterPropertyInteger('RecordInterval', 5);
     $this->RegisterPropertyInteger('WS300PCInterval', 300);
     $this->RegisterPropertyString('LogFile', '');
     //$this->RegisterPropertyString('WSWinFile', '');
     $this->RegisterPropertyInteger('Altitude', 0);
     $this->RegisterPropertyInteger('RainPerCount', 295);
     $this->RegisterPropertyBoolean('AutoCreate', true);
     $this->RegisterPropertyBoolean('Debug', false);
     $this->RegisterPropertyBoolean('Active', false);
     //willi profile
     if (!IPS_VariableProfileExists('WS300_Willi')) {
         IPS_CreateVariableProfile('WS300_Willi', 1);
         //integer
         IPS_SetVariableProfileAssociation('WS300_Willi', 0, 'Sunny', 'Sun', -1);
         IPS_SetVariableProfileAssociation('WS300_Willi', 1, 'some Clouds', 'Cloud', -1);
         IPS_SetVariableProfileAssociation('WS300_Willi', 2, 'Cloudy', 'Cloud', -1);
         IPS_SetVariableProfileAssociation('WS300_Willi', 3, 'Rainy', 'Drops', -1);
     }
     //Vars
     $this->RegisterVariableInteger('RecCount', 'History Record Count');
     $this->RegisterVariableString('Last', 'Last History Record');
     $this->RegisterVariableString('Buffer', 'Buffer', "", -1);
     IPS_SetHidden($this->GetIDForIdent('Buffer'), true);
     $this->RegisterVariableBoolean('isPolling', 'isPolling', "", -2);
     IPS_SetHidden($this->GetIDForIdent('isPolling'), true);
     $this->RegisterVariableString('Config', 'Config Record', "", -3);
     IPS_SetHidden($this->GetIDForIdent('Config'), true);
     $this->RegisterVariableString('LastUpdate', 'Last Update', "", -4);
     IPS_SetHidden($this->GetIDForIdent('LastUpdate'), true);
     //Timers
     $this->RegisterTimer('ReInit', 60000, $this->module_data["prefix"] . '_ReInitEvent($_IPS[\'TARGET\']);');
     $this->RegisterTimer('Update', 0, $this->module_data["prefix"] . '_UpdateEvent($_IPS[\'TARGET\']);');
     //Connect Parent
     $this->RequireParent($this->module_interfaces['SerialPort']);
     $pid = $this->GetParent();
     if ($pid) {
         $name = IPS_GetName($pid);
         if ($name == "Serial Port") {
             IPS_SetName($pid, __CLASS__ . " Port");
         }
     }
     //call init if ready and activated
     if (IPS_GetKernelRunlevel() == self::KR_READY) {
         if ($this->isActive() && $this->HasActiveParent()) {
             $this->SetStatus(self::ST_AKTIV);
             $i = $this->GetWS300pcInterval();
             $this->SetTimerInterval('Update', $i * 1000);
             //ms
             $this->SetTimerInterval('ReInit', 60000);
             $this->init();
             SetValueInteger($this->GetIDForIdent('RecCount'), 0);
             $this->GetWS300pcInterval();
         } else {
             $this->SetStatus(self::ST_INACTIV);
             $this->SetTimerInterval('ReInit', 0);
             $this->SetTimerInterval('Update', 0);
         }
     }
 }
Beispiel #12
0
 /**
  * Timer abgelaufen Alarm wird erzeugt.
  *
  * @access public
  */
 public function TimerFire()
 {
     if (IPS_GetKernelRunlevel() == KR_READY) {
         $this->SetStateVar(true);
         $this->DoScript($this->ReadPropertyInteger('VarID'), true, $this->State);
         $this->State = true;
         if ($this->ReadPropertyBoolean('MultipleAlert') == false) {
             $this->StopTimer();
         } else {
             $this->SetTimerInterval('NoTrigger', $this->ReadPropertyInteger('Timer') * 1000);
         }
         // neuer Timer mit max. Zeit, ohne now zu berücksichtigen.
     }
 }
 /**
  * overload internal IPS_Create($id) function
  */
 public function Create()
 {
     // Diese Zeile nicht löschen.
     parent::Create();
     //Hint: $this->debug will not work in this stage! must use IPS_LogMessage
     //props
     $this->RegisterPropertyString('Category', 'TE923 Devices');
     $this->RegisterPropertyInteger('ParentCategory', 0);
     //parent cat is root
     $this->RegisterPropertyInteger('RainPerCount', self::rc_to_mm);
     $this->RegisterPropertyInteger('UpdateInterval', 600);
     $this->RegisterPropertyString('URL', 'http://raspberry/cgi-bin/get_data.cgi');
     $this->RegisterPropertyString('LogFile', '');
     $this->RegisterPropertyBoolean('AutoCreate', true);
     $this->RegisterPropertyBoolean('Debug', false);
     $this->RegisterPropertyBoolean('Active', false);
     //Vars
     $this->RegisterVariableInteger('NewDayRainCounter', 'Rain Counter at new Day', "", -1);
     $this->RegisterVariableInteger('LastRainCounter', 'Last Rain Counter', "", -2);
     $this->RegisterVariableInteger('TimeStamp', 'Device Timestamp', 'UnixTimestamp', -3);
     IPS_SetHidden($this->GetIDForIdent('LastRainCounter'), true);
     IPS_SetHidden($this->GetIDForIdent('NewDayRainCounter'), true);
     //reinit timer
     $this->RegisterTimer('Update', 0, $this->module_data["prefix"] . '_UpdateEvent($_IPS[\'TARGET\']);');
     if (!IPS_VariableProfileExists('TE923_Storm')) {
         IPS_CreateVariableProfile('TE923_Storm', 0);
         //boolean
         IPS_SetVariableProfileValues('TE923_Storm', 0, 1, 0);
         //status is inverted because a 0 value is every time marked red, regardless of color
         IPS_SetVariableProfileAssociation('TE923_Storm', 1, "Not this", "Ok", -1);
         IPS_SetVariableProfileAssociation('TE923_Storm', 0, "Save your dog", "Warning", 16711680);
         IPS_SetVariableProfileIcon('TE923_Storm', "Warning");
     }
     //Forecast
     $forecast = array(0 => array('Heavy Snow', 'Snowflake'), 1 => array('Little Snow', 'Snowflake'), 2 => array('Heavy Rain', 'Rainfall'), 3 => array('Little Rain', 'Drops'), 4 => array('Cloudy', 'Cloud'), 5 => array('some Clouds', 'Cloud'), 6 => array('Sunny', 'Sun'));
     if (!IPS_VariableProfileExists('TE923_Forecast')) {
         IPS_CreateVariableProfile('TE923_Forecast', 1);
         //integer
         IPS_SetVariableProfileValues('TE923_Forecast', 0, 6, 0);
         for ($i = 0; $i < 7; $i++) {
             IPS_SetVariableProfileAssociation('TE923_Forecast', $i, $forecast[$i][0], $forecast[$i][1], -1);
         }
     }
     if (IPS_GetKernelRunlevel() == self::KR_READY) {
         if ($this->isActive()) {
             $this->SetStatus(self::ST_AKTIV);
             $i = $this->GetUpdateInterval();
             $this->SetTimerInterval('Update', $i * 1000);
             //ms
             $this->debug(__FUNCTION__, "Starte Timer {$i} sec");
         } else {
             $this->SetStatus(self::ST_INACTIV);
         }
     }
 }