コード例 #1
0
 /**
  * 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', 'XS1');
     $this->RegisterPropertyInteger('ParentCategory', 0);
     //parent cat is root
     $this->RegisterPropertyInteger('UpdateInterval', 600);
     $this->RegisterPropertyString('Host', 'xs1');
     $this->RegisterPropertyBoolean('AutoCreate', true);
     $this->RegisterPropertyBoolean('Debug', false);
     $this->RegisterPropertyBoolean('Active', false);
     //Vars
     $this->RegisterVariableInteger('LastUpdate', 'Last Update', "UnixTimestamp", -1);
     IPS_SetHidden($this->GetIDForIdent('LastUpdate'), 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->init();
         } else {
             $this->SetStatus(self::ST_INACTIV);
             $this->SetTimerInterval('Update', 0);
         }
     }
 }
コード例 #2
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);
         }
     }
 }
コード例 #3
0
 /**
  * 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', 'OWNet Devices');
     $this->RegisterPropertyInteger('ParentCategory', 0);
     //parent cat is root
     $this->RegisterPropertyInteger('Port', 4304);
     $this->RegisterPropertyInteger('UpdateInterval', 300);
     $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\']);');
     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");
             $this->init();
         } else {
             $this->SetStatus(self::ST_INACTIV);
             $this->SetTimerInterval('Update', 0);
         }
     }
 }
コード例 #4
0
 /**
  * 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);
         }
     }
 }
コード例 #5
0
 /**
  * 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
     // register property
     $this->RegisterPropertyString('DeviceID', '');
     $this->RegisterPropertyString('Typ', '');
     $this->RegisterPropertyString('Class', '');
     $this->RegisterPropertyString('CapList', '');
     $this->RegisterPropertyBoolean('Debug', false);
     //nonstandard profile
     $this->check_profile('Signal', 1, "", " dB", "Gauge", -120, +10, 1, 0, false);
     $this->CreateStatusVars();
 }
コード例 #6
0
 /**
  * overload internal IPS_Create($id) function
  */
 public function Create()
 {
     // Diese Zeile nicht löschen.
     parent::Create();
     // register property
     $this->RegisterPropertyString('DeviceID', '');
     $this->RegisterPropertyString('Typ', '');
     $this->RegisterPropertyString('Class', '');
     $this->RegisterPropertyString('CapList', '');
     $this->RegisterPropertyBoolean('Debug', false);
     //nonstandard profile
     $this->check_profile('Signal', 1, "", " dB", "Gauge", -120, +10, 1, 0, false);
     //timer
     $this->RegisterTimer('DeviceTimer', 0, $this->module_data["prefix"] . '_TimerEvent($_IPS[\'TARGET\']);');
     $this->CreateStatusVars();
 }
コード例 #7
0
 /**
  * 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);
         }
     }
 }
コード例 #8
0
 /**
  * overload internal IPS_Create($id) function
  */
 public function Create()
 {
     // Diese Zeile nicht löschen.
     parent::Create();
     // register property
     $this->RegisterPropertyString('DeviceID', '');
     $this->RegisterPropertyString('Typ', '');
     $this->RegisterPropertyString('Class', '');
     $this->RegisterPropertyString('CapList', '');
     $this->RegisterPropertyBoolean('Debug', false);
     $this->RegisterPropertyFloat('CounterFactor', 1.0);
     //NonStandard Profiles (needed for Webfront)
     $this->check_profile('Time.min', 2, "", ' min', "Hourglass", null, null, null, 1, false);
     $this->check_profile('Power_W.3', 2, "", " W", "Electricity", 0, 9999, 1, 3, false);
     $this->check_profile('Power_Wh', 2, "", " Wh", "Electricity", 0, 9999, 1, 0, false);
     $this->check_profile('Signal', 1, "", " dB", "Gauge", -120, +10, 1, 0, false);
     $this->CreateStatusVars();
 }
コード例 #9
0
 /**
  * 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', 'WDE1 Devices');
     $this->RegisterPropertyInteger('ParentCategory', 0);
     //parent cat is root
     $this->RegisterPropertyString('LogFile', '');
     $this->RegisterPropertyInteger('RainPerCount', 295);
     $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', "", -4);
     IPS_SetHidden($this->GetIDForIdent('LastUpdate'), true);
     //Timers
     $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);
             $this->SetTimerInterval('ReInit', 0);
         }
     }
 }
コード例 #10
0
 /**
  * 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);
         }
     }
 }
コード例 #11
0
 /**
  * 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);
         }
     }
 }