=1s) as well as individual signal decoding (fast operation 0.1s or "on change") // This solution do not contains Direct Events (Command Editor) it must be copied from external "Advanced Event Creators" for individual system variant. // // Please refer to comments and descriptions in the file // we want make this constants global for individual access from outside class $EHOUSE_ONE_MAX_ADC=16; //Analogue to digital converters - measurement inputs $EHOUSE_ONE_MAX_INPUTS=16; //digital inputs $EHOUSE_ONE_MAX_OUTPUTS=32; //digital outputs $EHOUSE_ONE_MAX_DIMMERS=3; //PWM DIMMERS $SET_OUT_CMD_EH1=1; //eHouse 1 Set output command for other controllers there are 33 as follows however some controllers might recognized 1 as a command //$SET_OUT_CMD_EH1=33; $nrdim=1; //for commands nr range (1...max) //this binary status addresses/offsets can be used for individual query of single bit signals with eH(start_address,$nr), Sat(start_address,$nr) //or executed directly with Get*Status($nr); $STATUS_TCP_OFFSET =2; //offset in current status for data $STATUS_COMMMANAGER_OFFSET =70; //offset for storing CM/LM status attached to eHouse 1 devices status in hybrid mode $MCP9700_Offset=-500.0; //Offset voltage at 0 C [mV] global setting can be replace for array for individual calibration $MCP9701_Offset=-400.0; //Offset voltage at 0 C [mV] global setting can be replace for array for individual calibration $MCP9700x=10000.0; // uV/C global setting can be replace for array for individual calibration $MCP9701x=19500.0; //Ehouse1 under CommManager supervisor // ///eHouse1 Indexes offset $STATUS_OFFSET=2; //offset for status locations in binary buffer //byte index location of binary status query results $RM_STATUS_ADC = 1 + $STATUS_OFFSET; //start of adc measurement $RM_STATUS_OUT = 17 + $STATUS_OFFSET; //RM start of outputs $HM_STATUS_OUT = 33 + $STATUS_OFFSET; //HM start of outputs $RM_STATUS_IN = 20 + $STATUS_OFFSET; //RM start of inputs $RM_STATUS_INT = 21 + $STATUS_OFFSET; //rm start of inputs (fast) $RM_STATUS_OUT25 = 22 + $STATUS_OFFSET; //rm starts of outputs => 25-32 $RM_STATUS_LIGHT = 23 + $STATUS_OFFSET; //rm light level start $RM_STATUS_ZONE_PGM = 26 + $STATUS_OFFSET; //rm current zone $RM_STATUS_PROGRAM = 27 + $STATUS_OFFSET; //rm current program $RM_STATUS_INPUTEXT_A_ACTIVE = 28 + $STATUS_OFFSET; //em input extenders A status active inputs $RM_STATUS_INPUTEXT_B_ACTIVE = 32 + $STATUS_OFFSET; //em input extenders B status active inputs $RM_STATUS_INPUTEXT_C_ACTIVE = 36 + $STATUS_OFFSET; //em input extenders C status active inputs $RM_STATUS_INPUTEXT_A = 40 + $STATUS_OFFSET; //em --||- $RM_STATUS_INPUTEXT_B = 50 + $STATUS_OFFSET; //em $RM_STATUS_INPUTEXT_C = 60 + $STATUS_OFFSET; //em $HM_STATUS_PROGRAM = 36 + $STATUS_OFFSET; //hm current program $HM_STATUS_KOMINEK = 46 + $STATUS_OFFSET; //hm status bonfire $HM_STATUS_RECU = 48 + $STATUS_OFFSET; //hm status recu $HM_WENT_MODE = 49 + $STATUS_OFFSET; //hm went mode //Size of resources for eHouse controllers $OUTPUTS_COUNT_RM = 32; //maximal number of outputs $SENSORS_COUNT_RM = 16; //maximal number of ADCs $INPUTS_COUNT_RM = 16; //maximal number of Inputs $DIMMERS_COUNT_RM = 3; class eHouseOneC { // Class Functions //function __construct($str);//validate eHouse LAN hex coded status + load to $TextStatus and convert to binary (array of integers) $Bin //public function eH($TempOffset,$k);//get bit field value for specified eHouse signal type $k index 0..n, $TempOffset - first address of the signal *_ADDR //public function hexi(); //convert $TextStatus to binary Status $Bin //function Display();//Display Decoded status - for debuging only //function DecodeEhouseLanStatus();//Decode full eHouseLan Devices Status (when no ultra-fast operation is required) into all class fields/arrays //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////FAST USAGE function without performing whole eHouseOne Devices status - only indvidual items//////////////////////////////////////////// //public function eH($TempOffset,$k);//fast usage for eHouse RS-485/422 without storing data to arrays eg $o11=eH($RM_STATUS_OUT,10); //state of 11th binary output //public function GetProgramStatus() //get output+dimm program (together with ADC programs) //public function GetADCProgramStatus() //get adc-regulation program (not available for eHouse One - adc+out+dimm programs are integrated) //public function GetZoneStatus() //get secuirty zone for CM/LM //public function GetSecuProgramStatus() //get security program for CM (Drives+secu zone) //public function GetInStatus($nr); //Get Binary Input Status 0...max //public function GetOutStatus($nr); //Get Binary Output Status 0...max //public function GetHornStatus($nr); //Get Binary Input activated Horn (Alarm) Status 0...max //public function GetWarningStatus($nr); //0...max //public function GetMonitoringStatus($nr); //0...max //public function GetDimmerStatus($nr); //Get Dimmer Status 0...max //public function GetADCStatus($nr); //Get ADC Input Status 0...max //public function GetAdcHStatus($nr) //Get ADC HighLevel Status 0...max //public function GetAdcLStatus($nr) //Get ADC LowLevel Status 0...max //public function GetMCP9701Status($nr) //Get MCP9701 temp sensor Status 0...max //public function GetMCP9700Status($nr) //Get MCP9700 temp sensor Status 0...max //public function GetTempHStatus($nr) //Get mcp9700 temp high level calculated 0...max //public function GetTempLStatus($nr) //get mcp9700 temp low level calculated 0...max //public function GetLM35Status($nr) //Get LM35 temp sensor Status 0...max //public function GetInvPercentStatus($nr) //Get ADC inverted scale Status 0...max //public function GetPercentStatus($nr) //Get ADC Percent Status 0...max //public function GetTempLMStatus($nr) //Get LM335 temp sensor Status 0...max //public function GetVoltageStatus($nr) //get voltage calculated from adc //public ExecCommand($cmd); //prints (echo) direct command/event to be captured by eHouse.PRO Server /////=== === Event creators ====== for eHouse LAN only unless othervice specified ////function ExecOut($nr,$state=2,$time=0) //change output state ////function ExecOutRS($nr,$state=2,$time=0) //change output state for eHouse One (differs with time operatin) //public function ExecProgram($nr) //exec program out+dim+ADC //public function ExEv($cmd,$arg1=0,$arg2=0,$arg3=0,$arg4=0,$arg5=0,$arg6=0,$arg7=0) //exec all events //public function ExecProgram($nr) exec out+dimm program + eHouse ONE //public function ExecRGB($nr,$R,$G,$B) exec rgb dimmer //public function ExecADCLevels($nr,$min,$max) set adc levels //public function ExecOut($nr,$state=2,$time=0) set output //public function ExecIncDecProgram($dir) inc/dec program //public function ExecADCProgram($nr) set adc program //public function ExecSecuProgram($nr) set rollers programs //public function ExecZoneChange($nr,$delay) set security zone //public function ExecRoller($nr,$mode) set single roller/drive/servo //public function ExecMultiRoller($arg1,$arg2,$arg3,$arg4,$arg5,$arg6,$arg7) set multiple rollers //public function ExecBatch($nr,$count) exec batch commands //public function ExecDecLights($nr,$step) decrement dimm light //public function ExecIncLights($nr,$step) increment dimm light //public function ExecStopLights($nr,$step) stop dimm light //public function ExecSetLight($nr,$value) set light //public function ExecToggleLights($nr,$step) stop if moving else oposite direction //public function ExecDecOnceLights($nr,$step) decrement one step //public function ExecIncOnceLights($nr,$step) increment one step //public function ExecSetSingleLight($nr,$level) set dimmer light //public function ExecDecDMX($nr,$step=1) decrement dmx light //public function ExecIncDMX($nr,$step=1) increment dmx light //public function ExecStopDMX($nr,$step=5) stop dmx light //public function ExecSetDMX($nr,$step) set dmx light //public function ExecSetRGBDMX($nr,$R,$G,$B) set rgb dmx light //public function ExecSendDaliCMD($msb,$lsb) send dali command //public function ExecSetDaliLight($nr,$mode,$step) set dali light //public function ExecSetDaliScene($nr) set dali scene //public function ExecSetDMXScene($nr) set dmx scene //public function ExecSubmitToStatus($arg1=0,$arg2=0,$arg3=0,$arg4=0,$arg5=0,$arg6=0,$arg7=0) //submit data to the status //public function ExecSendTCPLog($arg1=0,$arg2=0,$arg3=0,$arg4=0,$arg5=0,$arg6=0,$arg7=0) //Send Data to the Log via tcp/ip //public function ExecSendUDP($arg1=0,$arg2=0,$arg3=0,$arg4=0,$arg5=0,$arg6=0,$arg7=0) //send data via udp //public function ExecSendLog($arg1=0,$arg2=0,$arg3=0,$arg4=0,$arg5=0,$arg6=0,$arg7=0) //Send Data to the Log //public function ExecSendIR($irmode,$arg1=0,$arg2=0,$arg3=0,$arg4=0,$arg5=0,$arg6=0) //Send Infrared remote contoller code //public function ExecScanIR() //Send IR Scan Command //public function ExecRestart() //Send Data to the Log /////////////////////////////////////////////////////////////////////////////////////////////////////////// /// please copy-paste direct event from external event creators for desired eHouse systems public $nrsincmd=1; //for commands range (1..max) public $ProcessChangedOnly=1; public $WasChanged=0; public $DisplayToFileOnly=0; public $TextStatus; //captured hex decoded string of status public $results; //to store display out for written to file (Display function() public $AutoDecode=0; //run automatic decode on data reception public $Bin=array(0,0,0); //status converted to array of integers public $ALARM_ENABLED=1; public $DIMMERS_ENABLED=1; public $DMX_DALI_DIMMERS_ENABLED=0; public $ADCS_ENABLED=1; public $IsHM=0; public $IsEM=0; public $IsRM=0; public $HALF_ADC=1; //if 1 all inputs taken if 2 => half (EHOUSE_LAN_MAX_ADC/HALF_ADC) public $HALF_INPUTS=1; //if 1 all inputs taken if 2 => half (EHOUSE_LAN_MAX_INPUTS/HALF_INPUTS) public $HALF_OUTPUTS=1; //if 1 all inputs taken if 2 => half (EHOUSE_LAN_MAX_OUTPUTS/HALF_OUTPUTS) public $HALF_DIMMERS=1; //if 1 all dimmers taken if 2 => half (EHOUSE_LAN_MAX_DIMMERS/HALF_DIMMERS) public $StatusReceived=0; //flag that status was received public $StatusDecoded=0; //set flag that valid eHouse.PRO status received and decoded // status fields of eHouse LAN Controllers status fields public $AdrH=0; //eHouse LAN address 192.168.AdrH.AdrL public $AdrL=0; public $adc=array(16); //ADC 2B fields //public $PresetH=array(16); //High Level Presets for ADC not in eHouse 1 => eHouse LAN //public $PresetL=array(16); //Low Level Presets for ADC not in eHouse 1 => eHouse LAN public $SensorTemps=array(16); //LM335 we use natively public $SensorPercents=array(16); public $SensorLights=array(16); public $SensorTempsLM35=array(16); //public $SensorTempsMCP9700=array(16); //public $SensorTempsMCP9701=array(16); public $SensorVolts=array(16); public $out=array(35); //Binary Optputs public $in=array(48); //Binary Inputs //public $Horn=array(48); //Binary Inputs which activated Horn Output in current security zone //public $Warning=array(48); //Binary Inputs which activated Warning Light Output in current security zone //public $Monitoring=array(48);//Binary Inputs which activated Monitoring Radio-Line Output in current security zone //public $EarlyWarning=array(48);//Binary Inputs which activate EarlyWarning Output in current security zone public $Alarm=array(48); //Binary Inputs which activate Alarm Signal in current security zone public $Dimmer=array(3); //Dimmers 1B results (0..100%) //public $DimmerDali=array(46); //Dimmers 1B results (0..100%) //public $DimmerDMX=array(32); //Dimmers 1B results (0..100%) // Calibration for calculating ADC for MCP9700 public $Calibration=array(-27315,-27315,-27315,-27315,-27315,-27315,-27315,-27315,-27315,-27315,-27315,-27315,-27315,-27315,-27315,-27315); //Calibration for calculating ADC public $VCC=5000; //Supply Voltage for ADC calculation (if not refference source is used - otherwise assign 2096) public $CurrentProgram; //1B - current program/scene for Outputs //public $CurrentADCProgram; //1B - current Regulation Program for ADCs public $CurrentSecuProgram; //1B - current Drives Program for servos, gates, Doprs, windows public $CurrentZone; //1B - current Security Zone //public $HWStates; //4B - Alarm outputs status (Horn, Warning, Silent, EarlyWarning, Monitoring...) //////////////////////////////////////////////////////////////////////////////// public function eH($TempOffset,$k) //return individual bitwise status value of eHouse signal { $d=intdiv($k,8); return ((($this->Bin[$TempOffset+$d]>>($k%8))&0x01)); } //////////////////////////////////////////////////////////////////////////////// public function hexi() { $str=$this->TextStatus; $in=array(0,0,0); $k=0; for ($i=0;$iBin=$in; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public function e($str) { $this->results.=$str; if (!$this->DisplayToFileOnly) {echo $str;} } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public function GetProgramStatus() {global $RM_STATUS_PROGRAM; $this->CurrentProgram=$this->Bin[$RM_STATUS_PROGRAM]; return $this->CurrentProgram; } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Not Available in eHouse 1 - programs are integrated with ADC, outputs, dimmers * public function GetADCProgramStatus() { global $STATUS_TCP_OFFSET,$STATUS_COMMMANAGER_OFFSET,$STATUS_ADC_PROGRAM; $this->CurrentADCProgram=$this->Bin[$STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_ADC_PROGRAM]; return $this->CurrentADCProgram; }*/ /////////////////////////////////////////////////////////////////////////////////////////// //get zone nr public function GetZoneStatus() { global $RM_STATUS_ZONE_PGM; $this->CurrentZone=$this->Bin[$RM_STATUS_ZONE_PGM]; return $this->CurrentZone; } //////////////////////////////////////////////////////////////////////////////////////////////// //rollers + secu zone public function GetSecuProgramStatus() { global $RM_STATUS_PROGRAM; $this->CurrentSecuProgram=$this->Bin[$RM_STATUS_PROGRAM]; return $this->CurrentSecuProgram; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Get***Status() functions return values directly from binary status (no Decoding necessary) public function GetInStatus($nr) //0...max { global $RM_STATUS_IN; return $this->eH($RM_STATUS_IN,$nr); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //status o single inputs public function GetOutStatus($nr) //0...max { global $RM_STATUS_OUT,$RM_STATUS_OUT25,$HM_STATUS_OUT; if ($this->IsRM) { if ($nr<24) {return $this->eH($RM_STATUS_OUT,$nr);} else {return $this->eH($RM_STATUS_OUT25,$nr-24);} } if ($this->IsHM) { Return $this->eH($HM_STATUS_OUT,$nr); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //get inputs which activate Siren/Horn Out public function GetActiveSecurityStatus($nr) //0...max { global $RM_STATUS_INPUTEXT_A; return $this->eH($RM_STATUS_INPUTEXT_A,$nr); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /*public function GetEarlyStatus($nr) //0...max { global $STATUS_TCP_OFFSET,$STATUS_COMMMANAGER_OFFSET,$STATUS_EARLY_I2C; return $this->eH($STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_EARLY_I2C,$nr); }*/ /////////////////////////////////////////////////////////////////////////////// //get inputs which activate Warning Light Out ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public function GetDimmerStatus($nr) //0...max { global $RM_STATUS_LIGHT; return round((($this->Bin[$RM_STATUS_LIGHT+$nr]&0xff)/0xff)*100); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ADC values (0..1024) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public function GetADCStatus($nr) //0...max { global $RM_STATUS_ADC; $temppp=(($this->Bin[$RM_STATUS_ADC + $nr * 2 ]&0xff)&0x3 )<<8; //$temppp=$temppp<<8; $temppp+= $this->Bin[$RM_STATUS_ADC + $nr * 2 + 1 ]&0xff; return $temppp; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Calculated Temperature for LM335 temp sensor from ADC result public function GetTempLMStatus($nr) //0...max { $temppp= $this->GetADCStatus($nr); return ($this->gettemplm($temppp, $this->Calibration[$nr], 10, $this->VCC)); } //////////////////////////////////////////////////////////////////////////////////// //Calculated percent voltage value comparing to VCC or reference source from ADC result public function GetPercentStatus($nr) //0...max { $temppp= $this->GetADCStatus($nr); return (round($this->calculate_percent($temppp))*10)/10; } ///////////////////////////////////////////////////////////////////////////////////// // Calculated inverted percent 100- public function GetInvPercentStatus($nr) //0...max { return 100-GetPercentStatus($nr); } ///////////////////////////////////////////////////////////////////////////////////// // Calculated Temperature for LM35 temp sensor from ADC result public function GetLM35Status($nr) //0...max { $temppp= $this->GetADCStatus($nr); return $this->gettemplm35($temppp,$this->VCC,$this->Calibration[$nr]); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Calculated Temperature for MCP9700 temp sensor from ADC result /*public function GetMCP9700Status($nr) //0...max { $temppp= $this->GetADCStatus($nr); return $this->calculate_MCP9700Eth($temppp,$this->VCC,$this->Calibration[$nr]); }*/ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Calculated Temperature for MCP9701 temp sensor from ADC result /*public function GetMCP9701Status($nr) //0...max { $temppp= $this->GetADCStatus($nr); return calculate_MCP9701Eth($temppp,$this->VCC,$this->Calibration[$nr]); }*/ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ADC Low Level Threshold - preset (0..1024) - not available in eHouse 1 => migrate to eHouse LAN /*public function GetAdcLStatus($nr) //0...max { global $STATUS_TCP_OFFSET,$STATUS_COMMMANAGER_OFFSET,$STATUS_ADC_LEVELS; $TotalOffset=$STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET; $adcl=(($this->Bin[$TotalOffset+($nr<<1) ]&0xff) >> 4)&0x3; $adcl=$adcl<<8; $adcl|=$this->Bin[$STATUS_ADC_LEVELS+($nr<<1)]&0xff; return $adcl; } /////////////////////////////////////////////////////////////////////////////////////////////////////////// // ADC High Level Threshold - preset (0..1024) public function GetAdcHStatus($nr) //0...max { global $STATUS_TCP_OFFSET,$STATUS_COMMMANAGER_OFFSET,$STATUS_ADC_LEVELS; $TotalOffset=$STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET; $adch=(($this->Bin[$TotalOffset+($nr<<1) ]&0xff) >> 6)&0x3; $adch=$adch<<8; $adch|=$this->Bin[$STATUS_ADC_LEVELS+($nr<<1) + 1]&0xff; return $adch; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Temperature High Level Threshold - preset (0..1024) public function GetTempHStatus($nr) //0...max { $adch=$this->GetAdcHStatus($nr); return $this->calculate_MCP9700Eth($adch,$this->VCC,$this->Calibration[$nr]); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ADC Low Level Threshold - preset (0..1024) public function GetTempLStatus($nr) //0...max { $adcl=$this->GetAdcLStatus($nr); return $this->calculate_MCP9700Eth($adcl,$this->VCC,$this->Calibration[$nr]); } */ public function GetVoltageStatus($nr) //Get Voltage Status 0...max { $adcl=$this->GetAdcLStatus($nr); return $this->calculate_voltage($adcl,$this->VCC); } // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // For debug only - manual execution (display all decoded data and store to the file public function Display() { global $RM_STATUS_ADC, $RM_STATUS_OUT, $HM_STATUS_OUT, $RM_STATUS_IN, $RM_STATUS_INT, $RM_STATUS_OUT25, $RM_STATUS_LIGHT, $EHOUSE_ONE_MAX_ADC, $RM_STATUS_ZONE_PGM, $RM_STATUS_PROGRAM, $RM_STATUS_INPUTEXT_A_ACTIVE, $RM_STATUS_INPUTEXT_B_ACTIVE , $RM_STATUS_INPUTEXT_C_ACTIVE, $RM_STATUS_INPUTEXT_A, $RM_STATUS_INPUTEXT_B, $RM_STATUS_INPUTEXT_C, $HM_STATUS_PROGRAM, $HM_STATUS_KOMINEK, $HM_STATUS_RECU, $HM_WENT_MODE,$EHOUSE_ONE_MAX, $EHOUSE_ONE_MAX_ADC, $EHOUSE_ONE_MAX_INPUTS, $EHOUSE_ONE_MAX_OUTPUTS, $EHOUSE_ONE_MAX_DIMMERS; $lineDebug=date("Y:m:d H:i:s"); $adcss ="\tA:"; //$this->e("\r\n=========================================================================================\r\n"); if (($this->ProcessChangedOnly>0) && ($this->WasChanged===0)) {return;} $resfil=$this->AdrH."_".$this->AdrL."."; $this->e("Address: ".$this->AdrH.".".$this->AdrL." ".date("Y:m:d H:i:s")."\r\n"); if ($this->ADCS_ENABLED) { for ($i=0;$i<$EHOUSE_ONE_MAX_ADC/$this->HALF_ADC;$i++) { $this->e("a$i=" . $this->adc[$i] /*.' ('.$this->PresetL[$i].','. $this->PresetH[$i].")"*/ ."\t"); $adcss.=$this->adc[$i].","; } $this->e("\r\n"); for ($i=0;$i<$EHOUSE_ONE_MAX_ADC/$this->HALF_ADC;$i++) { // $low=$this->calculate_MCP9700Eth($this->PresetL[$i],$this->VCC,$this->Calibration[$i]); // $high=$this->calculate_MCP9700Eth($this->PresetH[$i],$this->VCC,$this->Calibration[$i]); $ranges="";// (".$low.",".$high.") "; $this->e("t$i=" . $this->SensorTemps[$i] .$ranges."\t"); } $this->e("\r\n"); } $lineDebug=substr($lineDebug,0,strlen($lineDebug)-1); $lineDebug.="\tO:"; $size=$EHOUSE_ONE_MAX_OUTPUTS; if (($this->IsHM) ) {$size=21;} if (($this->IsEM) ) {$size=35;} for ($i=0;$i<$size;$i++) { $this->e("o$i=" . $this->out[$i] ."\t"); if ($this->out[$i]) $lineDebug.="1"; else $lineDebug.="0"; if (($i%8)===7) $lineDebug.='_'; } $this->e("\r\n"); $lineDebug=substr($lineDebug,0,strlen($lineDebug)-1); $lineDebug.="\tI:"; $size=16; if ($this->IsHM) {$size=16;} //status outs for ($i=0;$i<$size;$i++) { $this->e("i$i=" . $this->in[$i] ."\t"); if ($this->in[$i]) $lineDebug.="1"; else $lineDebug.="0"; if (($i%8)===7) $lineDebug.='_'; } $this->e("\r\n"); if (($this->ALARM_ENABLED) && ($this->IsEM)) { $size=48; for ($i=0;$i<$size;$i++) {$this->e("H$i=" . $this->Alarm[$i]."\t");} $this->e("\r\n\r\n"); // for ($i=0;$i<$size;$i++) {$this->e("W$i=" . $this->Warning[$i]."\t");} $this->e("\r\n\r\n"); // for ($i=0;$i<$size;$i++) {$this->e("M$i=" . $this->Monitoring[$i]."\t");} $this->e("\r\n\r\n"); //for ($i=0;$i<$size;$i++) {$this->e("Q$i=" . $this->Silent[$i]."\t");} $this->e("\r\n\r\n"); //for ($i=0;$i<$size;$i++) {$this->e("E$i=" . $this->EarlyWarning[$i]."\t");} $this->e("\r\n\r\n"); //for ($i=0;$i<$size;$i++) {$this->e("S$i=" . $this->SMS[$i]."\t");} $this->e("\r\n\r\n"); //for ($i=0;$i<$size;$i++) {$this->e("A$i=" . $this->Alarm[$i]."\t");} $this->e("\r\n\r\n"); } if ($this->DIMMERS_ENABLED) {for ($i=0;$i<$EHOUSE_ONE_MAX_DIMMERS/$this->HALF_DIMMERS;$i++) {$this->e("D$i=" . $this->Dimmer[$i]."\t");} /*$this->e("\r\n");*/} /*if ($this->DMX_DALI_DIMMERS_ENABLED) //=> not in eHouse 1 => migrate to eHouse LAN { for ($i=0;$i<46;$i++) {$this->e("Dali$i=" . $this->DimmerDali[$i]."\t");} $this->e("\r\n\r\n"); for ($i=0;$i<32;$i++) {$this->e("DMX$i=" . $this->DimmerDMX[$i]."\t");} $this->e("\r\n\r\n"); } */ $lineDebug=substr($lineDebug,0,strlen($lineDebug)-1); $this->e("\r\nProgramNr =" . $this->CurrentProgram); //programs all together outputs+dimmers+adcs measurment-regulations $lineDebug.="\tPGM:".$this->CurrentProgram; //$this->e("\r\nAdcProgramNr =" . $this->CurrentADCProgram); //not in eHouse 1 if ($this->IsEM) { $this->e("\r\nDRVProgramNr =" . $this->CurrentSecuProgram); $this->e("\r\nZoneNr =" . $this->CurrentZone); } //$this->e("\r\nHW Outs =" . $this->HWStates); $this->e("\r\n\r\n"); if (!is_dir('AI-Stat')) {mkdir ('AI-Stat' );} // $fn=$resfil.date("H_i_s"); $fn=$resfil."txt"; file_put_contents("AI-Stat/$fn", $this->results); if (filesize("AI-Stat/".$this->AdrH."-".$this->AdrL.".txt")>100000) unlink("AI-Stat/".$this->AdrH."-".$this->AdrL.".txt"); file_put_contents("AI-Stat/".$this->AdrH."-".$this->AdrL.".txt", $lineDebug.$adcss."\r\n",FILE_APPEND); } ////////////////////////////////////////////////////////////////////////////////////// // Decode complete eHouse LAN (ERM, EPM, CM/LM + Security System state ///////////////////////////////////////////////////////////////////////////// public function DecodeEhouseOneStatus() { global $RM_STATUS_ADC, $RM_STATUS_OUT, $HM_STATUS_OUT, $RM_STATUS_IN, $RM_STATUS_INT, $RM_STATUS_OUT25, $RM_STATUS_LIGHT, $EHOUSE_ONE_MAX_ADC, $RM_STATUS_ZONE_PGM, $RM_STATUS_PROGRAM, $RM_STATUS_INPUTEXT_A_ACTIVE, $RM_STATUS_INPUTEXT_B_ACTIVE , $RM_STATUS_INPUTEXT_C_ACTIVE, $RM_STATUS_INPUTEXT_A, $RM_STATUS_INPUTEXT_B, $RM_STATUS_INPUTEXT_C, $HM_STATUS_PROGRAM, $HM_STATUS_KOMINEK, $HM_STATUS_RECU, $HM_WENT_MODE,$EHOUSE_ONE_MAX, $EHOUSE_ONE_MAX_ADC, $EHOUSE_ONE_MAX_INPUTS, $EHOUSE_ONE_MAX_OUTPUTS, $EHOUSE_ONE_MAX_DIMMERS; if (($this->ProcessChangedOnly>0) && ($this->WasChanged===0)) {return;} if (strlen($this->TextStatus)<210) {return;} //smaller then eHouse1 status if (strlen($this->TextStatus)>0xc0*2) {return;} //greater than CommManager $i=0; $k=0; $TotalOffset=0; $ind=0; $Max_ADC = 16; $this->size=$this->Bin[$ind++]; $this->AdrH=$this->Bin[$ind++]; $this->AdrL=$this->Bin[$ind++]; $toind=$EHOUSE_ONE_MAX_OUTPUTS; //ERM, EPM outputs amount if (($this->IsEM) ) //LM, CM {$toind=35;} for ($k=0;$k<$toind;$k++) { if ($this->IsRM) { if ($k<24) {$this->out[$k]=$this->eH($RM_STATUS_OUT,$k);} else {$this->out[$k]=$this->eH($RM_STATUS_OUT25,$k);} } if ($this->IsHM) { {$this->out[$k]=$this->eH($HM_STATUS_OUT,$k);} //else {$this->out[$k]=$this->eH($RM_STATUS_OUT25,$k);} } if ($this->IsEM) { $this->out[$k]=$this->eH($RM_STATUS_OUT,$k); } } $toind=16; //ERM, EPM inputs count $ind=$RM_STATUS_IN; for ($k=0;$k<$toind;$k++) { $this->in[$k]=$this->eH($ind,$k); } //for trying some optimalization -> ommit not changed inputs for controller if($this->ALARM_ENABLED) { if (($this->IsEM)) //LM, CM { $toind=48; $ind=$RM_STATUS_INPUTEXT_A; for ($k=0;$k<$toind;$k++) { $this->alarm[$k]=$this->eH($ind,$k); } } } if ($this->ADCS_ENABLED) { $i=0; $offset=0; $TotalOffset=$RM_STATUS_ADC; while ($i < $EHOUSE_ONE_MAX_ADC/$this->HALF_ADC) { $temppp = $this->adc[$i] = $this->GetADCStatus($i); $this->SensorTemps[$i] = $this->gettemplm($temppp, $this->Calibration[$i], 10, $this->VCC); $temdp = $this->calculate_percent($temppp); $this->SensorPercents[$i] = $temdp; //$temdp=$this->SensorPercents[$i]; $this->SensorLights[$i] = round((100-$temdp) * 10) / 10; $this->SensorTempsLM35[$i] = $this->gettemplm35($temppp,$this->VCC,$this->Calibration[$i]); /* $this->SensorTempsMCP9700[$i] = $this->calculate_MCP9700Eth($temppp,$this->VCC,$this->Calibration[$i]); $this->SensorTempsMCP9701[$i] = $this->calculate_MCP9701Eth($temppp,$this->VCC,$this->Calibration[$i]);*/ $this->SensorVolts[$i] = $this->calculate_voltage($temppp,$this->VCC); /* $this->adc[$i] = $this->GetADCStatus($i); //more elegant but more time consuming $this->SensorTemps[$i] = $this->GetTempLMStatus($i); $this->SensorPercents[$i] = $this->GetPercentStatus($i); $this->SensorLights[$i] = $this->GetInvPercentStatus($i); $this->SensorTempsLM35[$i]=$this->GetLM35Status($i); $this->SensorTempsMCP9700[$i]=$this->GetMCP9700Status($i); $this->SensorTempsMCP9701[$i]=$this->GetMCP9701Status($i); $this->SensorVolts[$i]=$this->GetVoltageStatus($i); */ /* if (($this->IsERM)) { $adch=(($this->Bin[$TotalOffset+($i<<1) ]&0xff) >> 6)&0x3; $adcl=(($this->Bin[$TotalOffset+($i<<1) ]&0xff) >> 4)&0x3; $adch=$adch<<8; $adcl=$adcl<<8; $adcl|=$this->Bin[$STATUS_ADC_LEVELS+($i<<1)]&0xff; $adch|=$this->Bin[$STATUS_ADC_LEVELS+($i<<1) + 1]&0xff; $this->PresetH[$i]=$adch; $this->PresetL[$i]=$adcl; $this->TempH[$i]=$this->calculate_MCP9700Eth($adch,$this->VCC,$this->Calibration[$i]); $this->TempL[$i]=$this->calculate_MCP9700Eth($adcl,$this->VCC,$this->Calibration[$i]); // more elegant but more time consuming substitute // $this->PresetH[$i]=$this->GetAdcHStatus($i); // $this->PresetL[$i]=$this->GetAdcLStatus($i); // $this->TempH[$i]=$this->GetTempHStatus($i); // $this->TempL[$i]=$this->GetTempLStatus($i); } */ $i++; } } if ($this->DIMMERS_ENABLED) { $i=0; while ($i < $EHOUSE_ONE_MAX_DIMMERS/$this->HALF_DIMMERS) { $this->Dimmer[$i]=$this->GetDimmerStatus($i); //round((($this->Bin[$STATUS_DIMMERS_ETH+$i]&0xff)/0xff)*100); $i++; } } $this->CurrentProgram=$this->Bin[$RM_STATUS_PROGRAM]; //$this->CurrentADCProgram=$this->Bin[$STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_ADC_PROGRAM]; $this->CurrentSecuProgram=$this->Bin[$RM_STATUS_PROGRAM]; $this->CurrentZone=$this->Bin[$RM_STATUS_ZONE_PGM]; $this->StatusDecoded=1; //complete status decoding } //////////////////////////////////////////////////////////////////////////////// // // // Constructor feeding with hexcoded textstatus for decoder // Verify status for eHouseLan Controllers if valid => store to TextStatus, convert to binary array of integers function __construct($str) { //echo "const"; if (strlen($str)<2*0x60) {return;} if (strlen($str)>2*0xc0) {return;} //eHouse.Pro ignored $siz=hexdec(substr($str,0,2)); if ($siz===0xff) {return;} //eHouse PRO //echo "const"; //if ($siz<0xb4) {return;} //ERM status size //we start modifying data $this->StatusDecoded=0; //set flag that valid eHouse.PRO status received and decoded $this->StatusReceived=0; $this->TextStatus=trim($str); if (stripos($this->TextStatus,"*")!==FALSE) { $this->WasChanged=1; $this->TextStatus=substr($this->TextStatus,0,strlen($this->TextStatus)-1); } $this->hexi(); //convert Hex TextStatus to binary array of integer $this->AdrH=$this->Bin[1]; $this->AdrL=$this->Bin[2]; $this->IsEM=0; $this->IsRM=0; $this->IsHM=0; $this->StatusReceived=1; //set flag that valid eHouse.PRO status received if ($this->Bin[1]==1) {$this->IsHM=1;} else if ($this->Bin[1]==2) {$this->IsEM=1;} else { $this->IsRM=1; } if ($this->AutoDecode) {$this->DecodeEhouseOneStatus();} } ///////////////////////////////////////////////////////////////////////////////// //send direct event to via eHousePro Server 10B hex coded (string size 20) //events syntax are: [DevAddrH,DevAddrL,CommandCode,SignalNR,State,Arg1,Arg2,Arg3,Arg4,Arg5]; //eg 00C92103020000000000 // | adres 0,201 - eHouse LAN device 192.168.0.201 // | command "set output" // | nr=4 (starts from 1) // | state=2 (toggle), no advanced arguments //Only Direct Event are performed here other are ignored public function ExecCommand($cmd) { $str=trim($cmd); if (strlen($str)===20) {echo "$str\n";} } ///////////////////////////////////////////////////////////////////////////////// //Get templm35 temperature sensor value public function gettemplm35($dta,$VCC) { $temp=($dta*$VCC/(1023*10)); $temp = round($temp*10); $temp/=10; return $temp; } /////////////////////////////////////////////////////////////////////////////// /*public function calculate_MCP9701Eth($dta,$VCC,$Calibration) { global $MCP9701x; $tmp = ((($dta * $VCC ) / 1023))+$Calibration; //MCP9701_Offset ; //get temp in [C] $tmp=(round(($tmp/$MCP9701x)*10*1000)*1.0)/10; return $tmp; } */ ///////////////////////////////////////////////////////////////////////////////// //calculate voltage comparing to VCC public function calculate_voltage($dta,$VCC) { $tmp = round((($dta * $VCC ) / 1023)*100); //up ot 2 decimal fractional digits $tmp=$tmp/100000; return $tmp; } //////////////////////////////////////////////////////////////////////////////// ////Calculate Temperature for MCP9700 sensor for Ethernet eHouse controllers /*public function calculate_MCP9700Eth($dta,$VCC,$Calibration) { global $MCP9700x; $tmp = ((($dta * $VCC ) / 1023))+$Calibration; //get temp in [C] $tmp=(round(($tmp/$MCP9700x)*10*1000)*1.0)/10; return $tmp; }*/ /////////////////////////////////////////////////////////////////////////////////// //calculate lm335 value public function gettemplm($dta, $calibration, $k, $VCC) { //var temp=0.00; $temp=($dta*$VCC/(1023*$k))+$calibration/100; $temp = (((round($temp*10))*1.0)/10); return $temp; } //////////////////////////////////////////////////////////////////////////////// // calculate percent value public function calculate_percent($dta) { $percent=(round((($dta * 10 ) / 1023)*10)); return $percent/10; //rounding to 1 digits of fractional part } //////////////////////////////////////////////////////////////////////////////// public function Hex($int) { $ad=dechex($int); while (strlen($ad)<2) {$ad='0'.$ad;} return $ad; } ////////////////////////////////////////////////////////////////////////////////// // EVENT Senders // Compose and Exec complete Direct Event 10B binary => 20B Hex-coded string // AdrH, AdrL added as prefix ////////////////////////////////////////////////////////////////////////////////// public function ExEv($cmd,$arg1=0,$arg2=0,$arg3=0,$arg4=0,$arg5=0,$arg6=0,$arg7=0) { $str=$this->Hex($this->AdrH&0xff). $this->Hex($this->AdrL&0xff). $this->Hex($cmd&0xff). $this->Hex($arg1&0xff). $this->Hex($arg2&0xff). $this->Hex($arg3&0xff). $this->Hex($arg4&0xff). $this->Hex($arg5&0xff). $this->Hex($arg6&0xff). $this->Hex($arg7&0xff); echo $str."\n"; //echo -> will be captured by ehousepro return $str; //return value } ////////////////////////////////////////////////////////////////////////////////// // Exec Program 0...n public function ExecProgram($nr) { $this->ExEv(2,$nr+1-$this->nrsincmd,0,0,0,0,0,0); } ////////////////////////////////////////////////////////////////////////////////// //Set all dimmers states public function ExecRGB($nr,$R,$G,$B) { $this->ExEv(4,$nr+1-$this->nrsincmd,$R,$G,$B,0,0,0); } //////////////////////////////////////////////////////////////////////////////// //Set ADC Low, High Threshold for regulation public function ExecADCLevels($nr,$min,$max) { $this->ExEv(12,$nr+1-$this->nrsincmd,$this->Hex($min>>8),$this->Hex($min&0xff),$this->Hex($max>>8),$this->Hex($max&0xff),0,0); } ////////////////////////////////////////////////////////////////////////////////// //// Output Event/Command creator example - 10B converted to hex text format // Please reffer to https://www.isys.pl/download/ehouse-lan-protocol-en.pdf public function ExecOut($nr,$state=2,$time=0) { global $SET_OUT_CMD_EH1; //// $state 0=OFF, 1=ON, 2=TOGGLE ////// $nr range (0..max) //$nrinc=1; //for commands nr range (1...max) $ad=trim($state); //Time-out for turning-on output (for ON,Toggle state) in [s] up to 18h //Field Description Byte Location $str=$this->Hex($this->AdrH). //address H (1B) $this->Hex($this->AdrL). //Address L (2B) $this->Hex($SET_OUT_CMD_EH1). //Set Output Command 0x21 (3B) $this->Hex($nr+1-$this->nrsincmd). //Output No. (4B) $this->Hex($state). //State (5B) $this->Hex($time&0xff). //Time Low nibble (6B) $this->Hex($time>>8). //Time High nibble (7B) $this->Hex(0). //Additions to 10B (8B) $this->Hex(0). //Additions to 10B (9B) $this->Hex(0); //Additions to 10B (10B) echo $str."\n"; return $str; } ////////////////////////////////////////////////////////////////////////////////// ///Increment Decrement Program Outs+Dimm $dir=> 1 (inc) | 2 (dec) /* public function ExecIncDecProgram($dir) { $this->ExEv(96,$dir,0,0,0,0,0,0); } */ ////////////////////////////////////////////////////////////////////////////////// //Set ADC/Regulation program /*public function ExecADCProgram($nr) { $this->ExEv(97,$nr+1-$this->nrsincmd,0,0,0,0,0,0); }*/ ////////////////////////////////////////////////////////////////////////////////// //Exec Security Program (drives+secu zone) - CM (ONLY) /* public function ExecSecuProgram($nr) { $this->ExEv(98,$nr+1-$this->nrsincmd,0,0,0,0,0,0); } */ ////////////////////////////////////////////////////////////////////////////////// //Change security zone with delay /* public function ExecZoneChange($nr,$delay) { $this->ExEv(99,$nr+1-$this->nrsincmd,$delay,0,0,0,0,0); } */ ///////////////////////////////////////////////////////////////////////////////// ////Control single Drive/Servo /* public function ExecRoller($nr,$mode) {//$mode => 0=n/a, 1=odd output, 2=even output,3=stop (both for somfy, none for other) $this->ExEv(100,$nr+1-$this->nrsincmd,$mode,0,0,0,0,0); } */ ////////////////////////////////////////////////////////////////////////////////// //Control Multi-Drive/Servo bitwise operation for each outputs /* public function ExecMultiRoller($arg1,$arg2,$arg3,$arg4,$arg5,$arg6,$arg7) { $this->ExEv(101,$arg1,$arg2,$arg3,$arg4,$arg5,$arg6,$arg7); } */ ////////////////////////////////////////////////////////////////////////////////// //Execute preprogrammed macro of events in the controller /* public function ExecBatch($nr,$count) { $this->ExEv(104,$nr,$count,0,0,0,0,0); } */ ////////////////////////////////////////////////////////////////////////////////// /*enum ModifyLight: int { case DEC_CONT = 0; //decrease continuously by step case INC_CONT = 1; //increase continuously by step case STOP = 2; //stop movment case SET_VAL = 3; //imediate set value case TOGGLE = 4; //stop or move oposite direction case DEC = 5; //decrement single step case INC = 6; //increment single step } For modify light level * */ ///////////////////////////////////////////////////////////////////////////////// //$nr 0...max /* public function ExecDecLights($nr,$step) {global $nrdim; $this->ExEv(105,$nr+$nrdim,0,$step,0,0,0,0); } */ ////////////////////////////////////////////////////////////////////////////////// //$nr 0...max /* public function ExecIncLights($nr,$step) {global $nrdim; $this->ExEv(105,$nr+$nrdim,1,$step,0,0,0,0); } */ ////////////////////////////////////////////////////////////////////////////////// /* public function ExecStopLights($nr,$step) {global $nrdim; $this->ExEv(105,$nr+$nrdim,2,$step,0,0,0,0); } */ ////////////////////////////////////////////////////////////////////////////////// /* public function ExecSetLight($nr,$value) {global $nrdim; $this->ExEv(105,$nr+$nrdim,3,$value,0,0,0,0); } */ ////////////////////////////////////////////////////////////////////////////////// /* public function ExecToggleLights($nr,$step) { global $nrdim; $this->ExEv(105,$nr+$nrdim,4,$step,0,0,0,0); } */ //////////////////////////////////////////////////////////////////////////////////// //decrement once by step than stop /* public function ExecDecOnceLights($nr,$step) { global $nrdim; $this->ExEv(105,$nr+$nrdim,5,$step,0,0,0,0); } */ ////////////////////////////////////////////////////////////////////////////////// //increment once by step than stop /* public function ExecIncOnceLights($nr,$step) { global $nrdim; $this->ExEv(105,$nr+$nrdim,6,$step,0,0,0,0); } */ ////////////////////////////////////////////////////////////////////////////////// //$nr 0...max //public function ModifyLights($nr,$cmd,$step) //{global $nrdim; //ExEv(105,$nr+$nrdim,$cmd,$step,0,0,0,0); //} ////////////////////////////////////////////////////////////////////////////////// /* public function ExecSetSingleLight($nr,$level) {global $nrdim; $this->ExEv(106,$nr+$nrdim,$level,0,0,0,0,0); }*/ ////////////////////////////////////////////////////////////////////////////////// /*public function ExecDecDMX($nr,$step=1) { $this->ExEv(108,$nr,0,$step,0,0,0,0); } ////////////////////////////////////////////////////////////////////////////////// public function ExecIncDMX($nr,$step=1) { $this->ExEv(108,$nr,1,$step,0,0,0,0); } ////////////////////////////////////////////////////////////////////////////////// public function ExecStopDMX($nr,$step=5) { $this->ExEv(108,$nr,2,$step,0,0,0,0); } ////////////////////////////////////////////////////////////////////////////////// public function ExecSetDMX($nr,$step) { $this->ExEv(108,$nr,3,$step,0,0,0,0); } ////////////////////////////////////////////////////////////////////////////////// public function ExecSetRGBDMX($nr,$R,$G,$B) { $this->ExEv(109,$nr,$R,$G,$B,0,0,0); } ////////////////////////////////////////////////////////////////////////////////// public function ExecSendDaliCMD($msb,$lsb) { $this->ExEv(242,$msb,$lsb,0,0,0,0,0); } ////////////////////////////////////////////////////////////////////////////////// public function ExecSetDaliLight($nr,$mode,$step) {// mode 0 dec, 1 inc, 2 stop, 3 stop $this->ExEv(243,$nr,$mode,$step,0,0,0,0); } ////////////////////////////////////////////////////////////////////////////////// public function ExecSetDaliScene($nr) { $this->ExEv(246,$nr,0,0,0,0,0,0); } ////////////////////////////////////////////////////////////////////////////////// public function ExecSetDMXScene($nr) { $this->ExEv(247,$nr,0,0,0,0,0,0); }*/ ////////////////////////////////////////////////////////////////////////////////// //add values to the status /* public function ExecSubmitToStatus($arg1=0,$arg2=0,$arg3=0,$arg4=0,$arg5=0,$arg6=0,$arg7=0) { $this->ExEv(248,$arg1,$arg2,$arg3,$arg4,$arg5,$arg6,$arg7); }*/ ////////////////////////////////////////////////////////////////////////////////// //Send Data to the Log via tcp/ip /* public function ExecSendTCPLog($arg1=0,$arg2=0,$arg3=0,$arg4=0,$arg5=0,$arg6=0,$arg7=0) { $this->ExEv(249,$arg1,$arg2,$arg3,$arg4,$arg5,$arg6,$arg7); }*/ ///////////////////////////////////////////////////////////////////////////////////// //Send Data via UDP /* public function ExecSendUDP($arg1=0,$arg2=0,$arg3=0,$arg4=0,$arg5=0,$arg6=0,$arg7=0) { $this->ExEv(250,$arg1,$arg2,$arg3,$arg4,$arg5,$arg6,$arg7); }*/ ////////////////////////////////////////////////////////////////////////////////// //Send Data to the Log /* public function ExecSendLog($arg1=0,$arg2=0,$arg3=0,$arg4=0,$arg5=0,$arg6=0,$arg7=0) { $this->ExEv(251,$arg1,$arg2,$arg3,$arg4,$arg5,$arg6,$arg7); }*/ ////////////////////////////////////////////////////////////////////////////////// //Send Infrared remote contoller code /* public function ExecSendIR($irmode,$arg1=0,$arg2=0,$arg3=0,$arg4=0,$arg5=0,$arg6=0) { $this->ExEv(252,$irmode,$arg1,$arg2,$arg3,$arg4,$arg5,$arg6); }*/ ////////////////////////////////////////////////////////////////////////////////// /* //Send IR Scan Command public function ExecScanIR() { $this->ExEv(253,0,0,0,0,0,0,0); }*/ ////////////////////////////////////////////////////////////////////////////////// //Send Data to the Log public function ExecRestart() { $this->ExEv(254,0,0,0,0,0,0,0); } } //class //examples //creator and feeding with status invalid are ignored not writing data to the Status locations //$eHouseOne=new eHouseOneC("6D370100000256025203FF03FF03FF03FF03FF0000000000FFFFFFFF0005000000000000000000000000000000000000000000006DFEFE37017300000256025203FF03FF03FF03FF03FF0000000000FFFFFFFF000500000000000000000000000000000000000000000000000000*"); //$eHouseOne->DecodeEhouseOneStatus(); //$eHouseOne->Display(); //$out5=$eHouseOne->GetOutStatus(4); //Individual signal decoding (binary output nr 5 (starts from 0) fast - without complete status decoding //$in15=$eHouseOne->GetInStatus(14); //Individual signal decoding (binary input nr 15 (starts from 0) fast - without complete status decoding // We can disable processing of subsystems we don't use for bigger speed and lower processor utilization /* $ALARM_ENABLED=0; //local security system (Horn, Silent, Warning, EarlyWarning, Monitoring, Alarm Flags) $DIMMERS_ENABLED=0; //External Dimmers $ADCS_ENABLED=0; //1-Wire temperature sensors or other linked //if we have smaller amount of inputs/outputs we can limit processing $HALF_ADC=1; //if 1 all inputs taken if 2 => half (EHOUSE_ONE_MAX_ADC/HALF_ADC) $HALF_INPUTS=1; //if 1 all inputs taken if 2 => half (EHOUSE_ONE_MAX_INPUTS/HALF_INPUTS) $HALF_OUTPUTS=1; //if 1 all inputs taken if 2 => half (EHOUSE_ONE_MAX_OUTPUTS/HALF_OUTPUTS) $HALF_DIMMERS=1; //if 1 all dimmers taken if 2 => half (EHOUSE_ONE_MAX_DIMMERS/HALF_DIMMERS) */ /*$eHouseOne->DecodeEhouseOneStatus(); //Full status decoding - no results displays in case of valid status $eHouseOne->Display(); //debug only information - fully decoded status written on the screen and write to the file echo "\r\n"; echo $eHouseOne->GetTempStatus(8); //0...max echo "\r\n"; ////echo $eHouseLan->GetTempHStatus(8); //0...max ////echo "\r\n"; ////echo $eHouseLan->GetTempLStatus(8); //0...max ////echo "\r\n"; ////echo $eHouseOne->GetAdcHStatus(8); //0...max ////echo "\r\n"; ////echo $eHouseOne->GetAdcLStatus(8); //0...max ////echo "\r\n"; echo $eHouseOne->GetADCStatus(0); //0...max echo "\r\n"; echo $eHouseOne->GetADCStatus(1); //0...max echo "\r\n"; echo $eHouseOne->GetADCStatus(2); //0...max echo "\r\n"; * */ ?>