Decoding the binary status of home automation controllers – free source code

Home Automation , Building Management eHouse – Decoding the status of microprocessor controllers

Home Automation received by the control panel connected to the LAN or WiFi , via UDP (User Datagram Protocol) .


The standard frame reception status in binary form , with Controllers was discussed in the article ” Intelligent Building eHouse controller status package” .

Decoding the frame needs to analyze every bit of data from pack.
In addition, each type of controller:

  • RoomManager
  • ExternalManager
  • HeatManager
  • InputExtender
  • CommManager
  • LevelManager
  • EthernetRoomManager

Have a difference in amount of digital inputs , measurement inputs, digital outputs , dimmers , monitoring functions and algorithms that result , that the data in the standard frame mutate depending on the type of controller.

This results in the need for decoding the bit by bit for each type of controller independently .

In the case of the implementation of all types of microprocessor controllers to create and test the frame decoding algorithm may take up to 1 month .

To minimize this time to a minimum , to facilitate ready to present the algorithm borrowed from eHouse.exe application, to automatically decode all the information from the controller and load data into the template records of touch panel (for tablets) Windows XP , Vista , 7 , 8 .

After automatically loading the data into the eHouse software libraries , with a few lines of code, you can create your own control algorithms eHouse system in a few minutes.

Binary Frame decoding software of the eHouse status standard is implemented in template library for panel. It needs to be done binary, for direct decoding status from Ethernet controllers without eHouse.Exe application supervision.

Decoding the entire frame (for microprocessor controllers eHouse1 RM , EM , HM) is carried out by the procedure set_rm function(str:array_of_char;TCP_INDEX_INC:integer);

parameters are functions of the buffer status and shift (offset) . The buffer contains all the received data from the status . Offset depends on the type of transmission (extended address , normal , and other future applications dependent on communication algorithms) .

It automatically fills the array status for each controller individually and can then directly manipulate the data or update data automatically on screen touch panels .

This function is activated in event procedure of receive data from UDP socket component (TNMUDP – called binary) in the event onDataReceived.

The reception is as follows:

procedure TForm1 . binaryDataReceived (Sender:TComponent ;

NumberBytes:Integer ; FromIP:String ; Port:Integer) ;

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

MyStream:TMemoryStream ;

begin

if filesystem_status then exit ; // If no file system filesystem_status

MyStream:=TMemoryStream.Create; // Create a stream of data

binary.ReadStream (MyStream); // Read the data stream

MyStream.Read(C[0],NumberBytes); // Loads the buffer C

set_rm(C,1);// Converts the binary data and loads the registers rm [index] for controllers eHouse 1

Test_save; // Test record the output to a text file for easy operation

update_panel; // Load data for the control panel

end;

It allows you to automatically and non-invasive collection of data over a LAN or Wi-Fi with the package broadcast via UDP (User Datagram Protocol) .

What more does not require an open connection to the server only listens on the port broadcast ‘6789’ default or other.

Errors link , Network , routers do not result in a suspension or unspecified software errors (as in the case of communication with TCP server) , but disappears just update the data without affecting the data or suitable server UDP client application.

WARNING! . If you create control software on a Windows for eHouse Home Automation, it is necessary to implement all algorithms in one application, which analyzes the data and performs all the algorithms and visualize them. We observed sometimes that 2 UDP listener socket can not exist on the same PC.

The most important variables in the library binary:

boiler_alarm:Boolean=false; // Boiler alarm alarm programmed temperature above

// Over-temperature alarm boiler

bonfire_stat:integer;// Bonfire heating level 0 – 7 for binary mode – employment status fire

// 0 – fire off-does not heat

// 1 – Fire on/extinguishing => ; green level < ; temp jacket (green LED blinking) – expires flashes green

// 2 – fire on => ; green level> ;=Temp jacket> ; yellow level – histeressis (green LED) – green

// 3 – fire on => ; yellow level – histeressis> ; temp jacket> ; histeressis level + yellow) (green + yellow leds) – green – yellow

// 4 – fire on => ; yellow level + histeressis> ; temp jacket> ; red level – histeressis (yellow) – yellow

// 5 – unconditional => ; red level – histeressis < ; temp jacket < ; histeressis level + red (red + yellow leds) yellow – red

// 6 – unconditional => ; temp jacket> ; histeressis level + red (red LED constant) – red

// 7 – unconditional => ; temp jacket> ; bonfire alarm (red LED blinking) ALARM – red flashes

bonfire_sensor_error:Boolean=false; // Error sensors bonfire too much different water jacket temperature sensors Between Two

// Error fireplace mantle temperature sensors too big difference

recuperator_status:string ; // Status of recuperation , ventilation , air heating – recuperator and ventilation status

recu_winter:Boolean=false ; // Recuperator winter / summer heat exchanger mode enabled / disabled – recuperator winter / summer

recu_manual_amalva:boolean=true ; // Recuperator auto / manual mode for amalva recuperator (auto managed by internal controler amalva , manual to eHouse HeatManager) //
recuperator amalva manual / auto

went_cooler:boolean=true ; // Water cooler on / off for ventilation or cooler in the system recuperation recuperation or GWC ON / OFF

went_gwc:Boolean=false ; // GHE (ground heat exchanger) Servomotor on / off – ground heat exchanger motor on / off

went_aux_gwc_fan:Boolean=false ; // Auxiliary GWC ventilator / fan on / off switch for ground heat exchanger – GWC fan assisted

bonfire_dgp:Boolean=false ; // Bonfire hot air distribution system enabled / disabled – Fan distribution of hot air from the fireplace DGP

ventilation_on:Boolean=false ; // Ventilation is currently working on / off – include ventilation and heat recovery

heater_pump:boolean=true ; // Pump for heater for ventilation on / off – pump heating and ventilation circuit for radiators

three_ways_cutoff:integer=0 ; // Three ways cutoff direction 0 off , Increasing level 1 , – Decreasing level 1) the direction of rotation electro-way valve

solar_pump:Boolean=false ; // Solar pump on / off – solar pump

boiler_on:Boolean=false ; // Boiler enabled / disabled – boiler on / off

boiler_pump:Boolean=false ; // Status of the boiler pump on / off – boiler pump on / off

boiler_fuel_out:Boolean=false ; // Boiler out of fuel aproximate (count hours of heating) – estimated fuel shortages for solid fuel boiler (calculated on the basis of hours of operation of the boiler)

boiler_power_on:Boolean=false ; // Boiler supplay power on / off ; – Boiler power on / off

boiler_fuel_supply_override:Boolean=false ; // Override supplyier fuel boiler (control by eHouse / internal boiler controller) – Parent controlled fuel delivery system eHouse on / off

bonfire_pump:Boolean=false ; // Bonfire pump status on / off – fire pump on / off

recu_speed:integer=0 ; // Recuperator Speeed 0 . . 3 – recuperator speed

recu_temperature:integer ; // Temperature level of RECU 0 . . 30C temperature recuperator for amalwa

_recu_mode:string=’ ‘ ; // Recuperation mode in text as it HEatManager control panel (eHouse.exe) – recuperator mode as the control panel application HeatMAnagerem eHouse.exe

went:string ; // Text ventilation status as a HeatManager Control panel (eHouse.exe) – ventilation status the same as in HeatManager panel of eHouse.exe

boiler,solar:string ; // Boiler , Solar text HeatManager status as a Control Panel (eHouse.exe) – status of the boiler and the solar panel control (HeatManager) eHouse.exe

komi:string ; // Text bonfire status as a HeatManager Control panel (eHouse.exe) – status as the fire control panel application heatmanager eHouse.exe

Control Lights