=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 systems. // // Please refer to comments and descriptions in the file // we want make this constants global for individual access from outside class $EHOUSE_LAN_MAX_ADC=16; //Analogue to digital converters - measurement inputs $EHOUSE_LAN_MAX_INPUTS=48; //digital inputs $EHOUSE_LAN_MAX_OUTPUTS=80; //digital outputs $EHOUSE_LAN_MAX_DIMMERS=3; //PWM DIMMERS $nrdim=1; //for commands nr range (1...max) //please refer to eHouse LAN TCP/UDP protocol for full stats frame and event codes. //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 //in reference to STATUS_COMMMANAGER_OFFSET each ethernet controllers $STATUS_ADC_ETH =0; //adc values * 2B $STATUS_ADC_ETH_END =32; //end of adc values $STATUS_OUT_I2C =$STATUS_ADC_ETH_END; //i2c output for CM/LM buffers states //max=160 outputs $STATUS_INPUTS_I2C =$STATUS_OUT_I2C+20; //I2c Input for CM/LM //max 96 inputs $STATUS_ALARM_I2C =$STATUS_INPUTS_I2C+12; //--|--- for alarm states in case of CM/LM $STATUS_WARNING_I2C =$STATUS_ALARM_I2C+12; //--|--- for warning states in case of CM/LM $STATUS_MONITORING_I2C =$STATUS_WARNING_I2C+12; //--|--- for monitoring states in case of CM/LM $STATUS_PROGRAM_NR =$STATUS_MONITORING_I2C+12; //--|--- for alarm states in case of CM/LM $STATUS_ZONE_NR =$STATUS_PROGRAM_NR+1; // //current program no. $STATUS_ADC_PROGRAM =$STATUS_ZONE_NR+1; //current adc program no. $STATUS_LIGHT_LEVEL =$STATUS_ADC_PROGRAM+2; //dimmer levels $STATUS_PROFILE_ERM =180-1; //for ERMs overlapped CM/LM status space $STATUS_DIMMERS_ETH =4; //3b $STATUS_DALI =$STATUS_INPUTS_I2C+2; //Dali lights $STATUS_DMX_DIMMERS =$STATUS_DIMMERS_ETH+3; //DMX lights $STATUS_DMX_DIMMERS2 =$STATUS_OUT_I2C+5; //more DMX lights $STATUS_ADC_LEVELS =24; //adc low levels (thresholds) $STATUS_ADC_LEVELSH =64; //adc high levels (thresholds) $EHOUSE_PRO_ADC_ADDR =6; //ADCs address class eHouseLanC { // 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 eHouseLAN Devices status - only indvidual items//////////////////////////////////////////// //public function eH($TempOffset,$k);//fast usage for eHouse.Lan without storing data to arrays eg $o11=eH($EHOUSE_LAN_OUTPUTS_ADDR,10); //state of 11th binary output //public function GetProgramStatus() //get output+dimm program //public function GetADCProgramStatus() //get adc-regulation program //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 //function ExecOut($nr,$state=2,$time=0) //change output state //public function ExecProgram($nr) //exec program out+dim //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 //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 $ProcessChangedOnly=1; public $WasChanged=0; public $DisplayToFileOnly=1; 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 $IsCM=0; public $IsLM=0; public $IsEPM=0; public $IsERM=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 public $PresetL=array(16); //Low Level Presets for ADC public $SensorTemps=array(16); 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(80); //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(256); //Binary Inputs which activate Alarm Signal in current security zone public $Dimmer=array(5); //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(-500.0,-500.0,-500.0,-500.0,-500.0,-500.0,-500.0,-500.0,-500.0,-500.0,-500.0,-500.0,-500.0,-500.0,-500.0,-500.0); //Calibration for calculating ADC public $VCC=3300; //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 $STATUS_PROFILE_ERM; $this->CurrentProgram=$this->Bin[$STATUS_PROFILE_ERM]; return $this->CurrentProgram; } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 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; } /////////////////////////////////////////////////////////////////////////////////////////// public function GetZoneStatus() { global $STATUS_TCP_OFFSET,$STATUS_COMMMANAGER_OFFSET,$STATUS_ZONE_NR; $this->CurrentZone=$this->Bin[$STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_ZONE_NR]; return $this->CurrentZone; } //////////////////////////////////////////////////////////////////////////////////////////////// public function GetSecuProgramStatus() { global $STATUS_TCP_OFFSET,$STATUS_COMMMANAGER_OFFSET,$STATUS_PROGRAM_NR; $this->CurrentSecuProgram=$this->Bin[$STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_PROGRAM_NR]; return $this->CurrentSecuProgram; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Get***Status() functions return values directly from binary status (no Decoding necessary) public function GetInStatus($nr) //0...max { global $STATUS_TCP_OFFSET,$STATUS_COMMMANAGER_OFFSET,$STATUS_INPUTS_I2C; return $this->eH($STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_INPUTS_I2C,$nr); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //status o single inputs public function GetOutStatus($nr) //0...max { global $STATUS_TCP_OFFSET,$STATUS_COMMMANAGER_OFFSET,$STATUS_OUT_I2C; return $this->eH($STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_OUT_I2C,$nr); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //get inputs which activate Siren/Horn Out public function GetHornStatus($nr) //0...max { global $STATUS_TCP_OFFSET,$STATUS_COMMMANAGER_OFFSET,$STATUS_ALARM_I2C; return $this->eH($STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_ALARM_I2C,$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 GetWarningStatus($nr) //0...max { global $STATUS_TCP_OFFSET,$STATUS_COMMMANAGER_OFFSET,$STATUS_WARNING_I2C; return $this->eH($STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_WARNING_I2C,$nr); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //get inputs which activate Monitoring Radioline Out public function GetMonitoringStatus($nr) //0...max { global $STATUS_TCP_OFFSET,$STATUS_COMMMANAGER_OFFSET,$STATUS_MONITORING_I2C; return $this->eH($STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_MONITORING_I2C,$nr); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /*public function GetAlarmStatus($nr) //0...max { global $STATUS_TCP_OFFSET,$STATUS_COMMMANAGER_OFFSET,$STATUS_ALARM_I2C; return $this->eH($STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_ALARM_I2C,$nr); }*/ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public function GetDimmerStatus($nr) //0...max { global $STATUS_DIMMERS_ETH; return round((($this->Bin[$STATUS_DIMMERS_ETH+$nr]&0xff)/0xff)*100); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ADC values (0..1024) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public function GetADCStatus($nr) //0...max { global $STATUS_TCP_OFFSET,$STATUS_COMMMANAGER_OFFSET; $temppp=(($this->Bin[$STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET + $nr * 2 ]&0xff)&0x3 )<<8; //$temppp=$temppp<<8; $temppp+= $this->Bin[$STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET + $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) 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 $EHOUSE_LAN_MAX_ADC, $EHOUSE_LAN_MAX_INPUTS, $EHOUSE_LAN_MAX_OUTPUTS, $EHOUSE_LAN_MAX_DIMMERS, $STATUS_TCP_OFFSET, $STATUS_COMMMANAGER_OFFSET, $STATUS_ADC_ETH, $STATUS_ADC_ETH_END, $STATUS_OUT_I2C, $STATUS_INPUTS_I2C, $STATUS_ALARM_I2C, $STATUS_WARNING_I2C, $STATUS_MONITORING_I2C, $STATUS_PROGRAM_NR, $STATUS_ZONE_NR, $STATUS_ADC_PROGRAM, $STATUS_LIGHT_LEVEL, $STATUS_PROFILE_ERM, $STATUS_DIMMERS_ETH, $STATUS_DALI, $STATUS_DMX_DIMMERS, $STATUS_DMX_DIMMERS2, $STATUS_ADC_LEVELS, $STATUS_ADC_LEVELSH, $EHOUSE_PRO_ADC_ADDR; //$this->e("\r\n=========================================================================================\r\n"); $lineDebug=date("Y:m:d H:i:s"); $adcsss="\tA:"; 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_LAN_MAX_ADC/$this->HALF_ADC;$i++) { $this->e("a$i=" . $this->adc[$i].' ('.$this->PresetL[$i].','. $this->PresetH[$i].")" ."\t"); $adcsss.=$this->adc[$i].'('.$this->PresetL[$i].','. $this->PresetH[$i].");" ; } $this->e("\r\n"); for ($i=0;$i<$EHOUSE_LAN_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->SensorTempsMCP9700[$i] .$ranges."\t"); } $this->e("\r\n"); } $lineDebug=substr($lineDebug,0,strlen($lineDebug)-1); $lineDebug.="\tO:"; $size=40; if (($this->IsCM) || ($this->IsLM)) {$size=80;} 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=24; if (($this->IsCM) || ($this->IsLM)) {$size=48;} 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"); $lineDebug=substr($lineDebug,0,strlen($lineDebug)-1); if (($this->ALARM_ENABLED) && (($this->IsCM) || ($this->IsLM))) { for ($i=0;$i<$size;$i++) {$this->e("H$i=" . $this->Horn[$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_LAN_MAX_DIMMERS/$this->HALF_DIMMERS;$i++) { $this->e("D$i=" . $this->Dimmer[$i]."\t"); $lineDebug.=$this->Dimmer[$i].","; } $this->e("\r\n\r\n"); $lineDebug=substr($lineDebug,0,strlen($lineDebug)-1); } if ($this->DMX_DALI_DIMMERS_ENABLED) { 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.="\tPGM:".$this->CurrentProgram.",".$this->CurrentADCProgram.",".$this->CurrentZone; $this->e("\r\nProgramNr =" . $this->CurrentProgram); $this->e("\r\nAdcProgramNr =" . $this->CurrentADCProgram); //$this->e("\r\nDRVProgramNr =" . $this->CurrentSecuProgram); $this->e("\r\nZoneNr =" . $this->CurrentZone); //$this->e("\r\nHW Outs =" . $this->HWStates); 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.$adcsss."\r\n",FILE_APPEND); } ////////////////////////////////////////////////////////////////////////////////////// // Decode complete eHouse LAN (ERM, EPM, CM/LM + Security System state ///////////////////////////////////////////////////////////////////////////// public function DecodeEhouseLanStatus() { global $EHOUSE_LAN_MAX_ADC, $EHOUSE_LAN_MAX_INPUTS, $EHOUSE_LAN_MAX_OUTPUTS, $EHOUSE_LAN_MAX_DIMMERS, $STATUS_TCP_OFFSET, $STATUS_COMMMANAGER_OFFSET, $STATUS_ADC_ETH, $STATUS_ADC_ETH_END, $STATUS_OUT_I2C, $STATUS_INPUTS_I2C, $STATUS_ALARM_I2C, $STATUS_WARNING_I2C, $STATUS_MONITORING_I2C, $STATUS_PROGRAM_NR, $STATUS_ZONE_NR, $STATUS_ADC_PROGRAM, $STATUS_LIGHT_LEVEL, $STATUS_PROFILE_ERM, $STATUS_DIMMERS_ETH, $STATUS_DALI, $STATUS_DMX_DIMMERS, $STATUS_DMX_DIMMERS2, $STATUS_ADC_LEVELS, $STATUS_ADC_LEVELSH; if (($this->ProcessChangedOnly>0) && ($this->WasChanged===0)) {return;} if (strlen($this->TextStatus)<200) {return;} //no eHouse Pro Status stored in status $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=40; //ERM, EPM outputs amount if (($this->IsCM) || ($this->IsLM)) //LM, CM {$toind=80;} for ($k=0;$k<$toind;$k++) { $this->out[$k]=$this->eH($STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_OUT_I2C,$k); } $toind=24; //ERM, EPM inputs count $ind=$STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_INPUTS_I2C; if (($this->IsCM) || ($this->IsLM)) //LM, CM {$toind=48;} 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(eHousePRO[index].AlarmChanged) /* for ($k=0;$k<$toind;$k++) { $this->Alarm[$k]=$this->eH($ind,$k); }*/ $ind=$STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_ALARM_I2C; for ($k=0;$k<$toind;$k++) { $this->Horn[$k]=$this->eH($ind,$k); } $ind=$STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_WARNING_I2C; for ($k=0;$k<$toind;$k++) { $this->Warning[$k]=$this->eH($ind,$k); } $ind=$STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_MONITORING_I2C; for ($k=0;$k<$toind;$k++) { $this->Monitoring[$k]=$this->eH($ind,$k); } /* for ($k=0;$k<$toind;$k++) { $this->Silent[$k]=$this->eH($ind,$k); }*/ //if (eHousePRO[index].SmsChanged) /* for ($k=0;$k<$toind;$k++) { $this->SMS[$k]=$this->eH($ind,$k); }*/ /*$ind=$STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_EARLY_I2C; //if (eHousePRO[index].EarlyChanged) for ($k=0;$k<$toind;$k++) { $this->EarlyWarning[$k]=$this->eH($ind,$k); }*/ } if ($this->ADCS_ENABLED) { $i=0; $offset=0; $TotalOffset=$STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET; while ($i < $EHOUSE_LAN_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_LAN_MAX_DIMMERS/$this->HALF_DIMMERS) { $this->Dimmer[$i]=$this->GetDimmerStatus($i); //round((($this->Bin[$STATUS_DIMMERS_ETH+$i]&0xff)/0xff)*100); $i++; } } if ($this->DMX_DALI_DIMMERS_ENABLED) { $i=0; if ($this->IsERM) { while ($i < 17) { $temppp= $this->Bin[$STATUS_DMX_DIMMERS+$i]&0xff; $this->DimmerDMX[$i] = round((100*$temppp)/255); $i++; } $i=0; while ($i < 15) { $temppp= $this->Bin[$STATUS_DMX_DIMMERS2+$i]&0xff; $this->DimmerDMX[$i+17] = round((100*$temppp)/255); $i++; } $i=0; while ($i < 46) { $temppp= $this->Bin[$STATUS_DALI+$i]&0xff; $this->DimmerDali[$i] = round((100*$temppp)/255); $i++; } } } $this->CurrentProgram=$this->Bin[$STATUS_PROFILE_ERM]; $this->CurrentADCProgram=$this->Bin[$STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_ADC_PROGRAM]; $this->CurrentSecuProgram=$this->Bin[$STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_PROGRAM_NR]; $this->CurrentZone=$this->Bin[$STATUS_TCP_OFFSET+$STATUS_COMMMANAGER_OFFSET+$STATUS_ZONE_NR]; $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) { if (strlen($str)<100) {return;} if (strlen($str)>500) {return;} //eHouse.Pro ignored $siz=hexdec(substr($str,0,2)); if ($siz===0xff) {return;} 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->StatusReceived=1;} //set flag that valid eHouse.PRO status received if ($this->Bin[2]>249) {$this->IsCM=1;} else { $this->IsCM=0; $this->IsLM=0; if ($this->Bin[2]==249) {$this->IsEPM=1;} else {$this->IsERM=1;} } if ($this->AutoDecode) {$this->DecodeEhouseLanStatus();} } ///////////////////////////////////////////////////////////////////////////////// //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,0,0,0,0,0,0); } ////////////////////////////////////////////////////////////////////////////////// //Set all dimmers states public function ExecRGB($nr,$R,$G,$B) { $this->ExEv(4,$nr,$R,$G,$B,0,0,0); } //////////////////////////////////////////////////////////////////////////////// //Set ADC Low, High Threshold for regulation public function ExecADCLevels($nr,$min,$max) { $this->ExEv(12,$nr,$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) { //// $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(33). //Set Output Command 0x21 (3B) $this->Hex($nr+$nrinc). //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,0,0,0,0,0,0); } ////////////////////////////////////////////////////////////////////////////////// //Exec Security Program (drives+secu zone) - CM (ONLY) public function ExecSecuProgram($nr) { $this->ExEv(98,$nr,0,0,0,0,0,0); } ////////////////////////////////////////////////////////////////////////////////// //Change security zone with delay public function ExecZoneChange($nr,$delay) { $this->ExEv(99,$nr,$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,$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 //$eHouseLan=new eHouseLanC("B400C973000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000495230303032303000180019001A0301001900190019001900DC03FF001B03FF03FF03FF03FF03FF4501000080000000000000000000000000000000FF0F1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080D4F"); //$eHouseLan=new eHouseLanC("B400C97314D70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000049523030303230300017001800190301001800190018001900E103FF001A03FF03FF03FF03FF03FF4501000080000000000000000000000000000000FF0F1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080E39"); //$eHouseLan=new eHouseLanC("B400C97314D700000000000000000000000000000000000000FF00FFCACD00FFCACDC7CAD3D4CACDC7CAFAF2C7CA00FF00FF00FF00FF00FF00000000000000004952303030323030C017C0180019C301001800190019001900E1F3FF001AC3FFC3FFC3FFC3FFC3FF4501003C80000000000000000000000000000000FF0F1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000082A6B"); //$eHouseLan=new eHouseLanC("B400C97314D700000000000000000000000000000000000000FF00FFE3E600FFCACDE3E6E6E9D3D6E0E3F9F1E0E300FF00FF00FF00FF00FF00000000000000004952303030323030C017C017001AC300001900180018001900E0F3FF001AC3FFC3FFC3FFC3FFC3FF450100BC80000000000000000000000000000000FF0F1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000082BED"); //$out5=$eHouseLan->GetOutStatus(4); //Individual signal decoding (binary output nr 5 (starts from 0) fast - without complete status decoding //$in15=$eHouseLan->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_LAN_MAX_ADC/HALF_ADC) $HALF_INPUTS=1; //if 1 all inputs taken if 2 => half (EHOUSE_LAN_MAX_INPUTS/HALF_INPUTS) $HALF_OUTPUTS=1; //if 1 all inputs taken if 2 => half (EHOUSE_LAN_MAX_OUTPUTS/HALF_OUTPUTS) $HALF_DIMMERS=1; //if 1 all dimmers taken if 2 => half (EHOUSE_LAN_MAX_DIMMERS/HALF_DIMMERS) */ /*$eHouseLan->DecodeEhouseLanStatus(); //Full status decoding - no results displays in case of valid status $eHouseLan->Display(); //debug only information - fully decoded status written on the screen and write to the file echo "\r\n"; echo $eHouseLan->GetMCP9700Status(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 $eHouseLan->GetAdcHStatus(8); //0...max echo "\r\n"; echo $eHouseLan->GetAdcLStatus(8); //0...max echo "\r\n"; echo $eHouseLan->GetADCStatus(0); //0...max echo "\r\n"; echo $eHouseLan->GetADCStatus(1); //0...max echo "\r\n"; echo $eHouseLan->GetADCStatus(2); //0...max echo "\r\n"; * */ /* Some Tests to of functions $mode=1;$level=100;$delay=1000;$nr=1;$step=1;$R=100;$G=30;$B=20;$time=100;$state=2;$dir=1;$arg1=$arg2=$arg3=$arg4=$arg5=$arg6=$arg7=0x55;$irmode=13; $vgroup=0;$hgroup=0;$Rcont=0;$Gcont=0;$Bcont=0;$Wcont=0;$min=100;$max=800;$invin=0;$alarmin=0;$alarmdelay=0;$rememberstate=10;$disableevent=0; $stateout=1;$repeat=2;$timeonout=10;$timeoffout=5;$timedisabledrv=3;$disabledrv=1;$somfy=1; $modedim=1;$valuedima=10;$valuedimb=20;$valuedimc=30;$valuedimd=10;$rgbwdimm=1; $invertdimm=0;$disable=1;$mindim=0;$valuedim=90;$stepdim=10;$maxdim=100; $invertadc=0;$alarmadcl=1;$alarmadch=1;$alarmdelayadc=10;$lleveladc=100;$hleveladc=400;$adcdis=0; $admin=1;$stateout=2;$disableout=0;$adminout=1;$repeatouts=2;$timeonout=10;$timeoffout20;$count=3;$value=99;$msb=10;$lsb=3; $eHouseLan->ExecProgram($nr); //exec program out+dim $eHouseLan->ExEv(0x21); //exec all events $eHouseLan->ExecProgram($nr);// exec out+dimm program $eHouseLan->ExecADCLevels($nr,$min,$max);// set adc levels $eHouseLan->ExecOut($nr,$state,$time);// set output $eHouseLan->ExecIncDecProgram($dir);// inc/dec program $eHouseLan->ExecADCProgram($nr);// set adc program $eHouseLan->ExecSecuProgram($nr);// set rollers programs $eHouseLan->ExecZoneChange($nr,$delay);// set security zone $eHouseLan->ExecRoller($nr,$mode);// set single roller/drive/servo $eHouseLan->ExecMultiRoller($arg1,$arg2,$arg3,$arg4,$arg5,$arg6,$arg7);// set multiple rollers $eHouseLan->ExecBatch($nr,$count);// exec batch commands $eHouseLan->ExecDecLights($nr,$step);// decrement dimm light $eHouseLan->ExecIncLights($nr,$step);// increment dimm light $eHouseLan->ExecStopLights($nr,$step);// stop dimm light $eHouseLan->ExecSetLight($nr,$value);// set light $eHouseLan->ExecToggleLights($nr,$step);// stop if moving else oposite direction $eHouseLan->ExecDecOnceLights($nr,$step);// decrement one step $eHouseLan->ExecIncOnceLights($nr,$step);// increment one step $eHouseLan->ExecSetSingleLight($nr,$level);// set dimmer light $eHouseLan->ExecDecDMX($nr,$step);// decrement dmx light $eHouseLan->ExecIncDMX($nr,$step);// increment dmx light $eHouseLan->ExecStopDMX($nr,$step);// stop dmx light $eHouseLan->ExecSetDMX($nr,$step);// set dmx light $eHouseLan->ExecSetRGBDMX($nr,$R,$G,$B);// set rgb dmx light $eHouseLan->ExecSendDaliCMD($msb,$lsb);// send dali command $eHouseLan->ExecSetDaliLight($nr,$mode,$step);// set dali light $eHouseLan->ExecSetDaliScene($nr);// set dali scene $eHouseLan->ExecSetDMXScene($nr);// set dmx scene $eHouseLan->ExecSubmitToStatus($arg1,$arg2,$arg3,$arg4,$arg5,$arg6,$arg7); //submit data to the status $eHouseLan->ExecSendTCPLog($arg1,$arg2,$arg3,$arg4,$arg5,$arg6,$arg7); //Send Data to the Log via tcp/ip $eHouseLan->ExecSendUDP($arg1,$arg2,$arg3,$arg4,$arg5,$arg6,$arg7); //send data via udp $eHouseLan->ExecSendLog($arg1,$arg2,$arg3,$arg4,$arg5,$arg6,$arg7); //Send Data to the Log $eHouseLan->ExecSendIR($irmode,$arg1,$arg2,$arg3,$arg4,$arg5,$arg6); //Send Infrared remote contoller code $eHouseLan->ExecScanIR(); //Send IR Scan Command $eHouseLan->ExecRestart(); //Send Data to the Log //$eHouseLan->ExecSendIRAlias($cmdadr1=0,$cmdadr2=0,$cmdadr3=0,$cmdadr4=0); */ ?>