Home Automation eHouse decoding CommManager status – source code

eHouse Home Automation , Building Management – Data format CommManager status in binary code .

CommManager is controller of eHouse Home Automation system , which gather communication functions and is the “gateway to the world” for system based on system controllers eHouse version 1 (485).

It allows you to dispense with your PC while maintaining high functionality (standard built-in controllers).

In addition, the system replaces the old version of ExternalManager from “eHouse1” and 3 InputExtenders, Acting fully functional controller of: roller , gates and awnings . It is also integrated with an alarm that allows Control by SMS or LAN .

It also has a built-in alarm notification SMS – Ethernet Home Automation – Rollers , Gates , Gateways – controllers and security systems

The controller in a hybrid version (eHouse1 under the supervision of CommManager) collects all the statuses of RoomManagers ( Home Automation – Room Controller ) And HeatManager ( Boiler Controller , recovery , Automatic green energy ) And sends them on to the control panel via TCP/IP or UDP.

In addition, allows you to send the status as UDP broadcast to all devices on the LAN , allowing you to track the status and connectionless system status eHouse by any number of control panels and visualization of outputs , inputs and measured values.

This type of broadcast not charge extra CPU of CommManager , no matter how much the panels receives the above data.

In addition to the data received from the controller eHouse 1 (working on RS485) , CommManager attach its current status , which is the state of the alarm system .

Frame status in binary code was discussed in posts:

” Smart Home , Intelligent Building eHouse frame status in binary code ”

” Smart Home , Intelligent Building eHouse – frame decoding status – source code ”

So far we've covered the frame format , importance of bits and bytes in a frame and presented to facilitate ready source code decoding data from all controllers eHouse one connected by CommManager or application eHouse.exe (for eHouse 1) .

It's time for the software to decode the status of the enlarged frame CommManager.

Although status can be sent both TCP/IP and UDP in the same form, we will only broadcast UDP, due to the lack of having to log on to the controller and increase the CPU load.

Communications over TCP / IP socket servers we leaving free to remote mobile panels needs, working outside the LAN (Smartphones , GSM phones), use UDP as the transmission of the Internet can be difficult and involves a lot of errors , preventing correct decoding status , due to the poor quality of the links, and the lack of mechanisms confirmations and repetitions of UDP session .

To this end, in the final template Delphi control panel that was discussed earlier in the posts: ” smart home eHouse , source code control panels for the tablet working on Windows XP , Vista , 7 ”

Bundled change the status of the binary receive data via UDP by adding support CommManager

procedure TForm1.binaryDataReceived(Sender: TComponent;NumberBytes:Integer;FromIP:String;Port:Integer);

var C:array[0..1024] of char;

MyStream:TMemoryStream;

numberb:integer;

begin

if filesystem_status then exit; // Only when udp is active

MyStream:=TMemoryStream.Create;

binary.ReadStream(MyStream);

numberb:=NumberBytes;

if numberb>1023 then numberb:=1023 // limiting number of bytes received – we cut to the size of the data buffer

MyStream.Read(C[0],numberb) ;

set_rm(C,1) ; // Decode status eHouse 1 controllers – RM decode controller status , HM

set_status_commmanager (C,0,254) ; // Decode commanager controller status – decode status commmanagera

Test_save; // Test save data to text files for each RM , HM – save for test results to a text file for all controllers eHouse 1 (RM , HM)

Test_save_eth; // Test save data to text file for CommManager and each Ethernet Controller – save for test results to a text file for CommManagera and all the controllers EtherneteHouse

update_panel ; / / Update data to the panel for selected controller – update the data controller panel

end ; :

The complete implementation of the decoding process status for CommManagera frame and other controllers perform the procedure Ethernet eHouse

set_status_commmanager (C , 0 , 254) ; / / The parameter you specify the name and address of the data buffer controller (the last two components of the IP address) .

This procedure performs the decoding of binary status of the frame and then loads the decoded data to record the Ethernet controller which is an instance of a record ” ethernet_rm_hm_cm_lm ” called ” ethrm ” .

The index is searched automatically linked to an IP address in the status .

This allows us to:

  • direct analysis of the data of all controllers
  • create your own algorithms depending on the status of the outputs , Inputs , measurements sensors
  • implementation of control systems dedicated to analyzing any number of parameters of the existing system
  • log analyzer software development and eHouse system status
  • software allows calculation the electricity consumption
  • allows the execution of individual control panels and visualization for all controllers on the basis of a template
  • no need for knowledge of the ways of communication and data frames
  • writing high-level software (a few lines of source code) through the implementation of the eHouse system software libraries .