eHouse EthernetHome Automation, Building Management – C source code for Linux
Control and management of eHouse Ethernet building automation and eHouse1 under the supervision of CommManager .
This article describes “Open Source” source code for management and control of eHouse smart home system: Ethernet and eHouse1 under the supervision of CommManager .
It is a part of server application for eHouse home automation ( open source C++), written to operate and manage smart home system with devices that are mini-computers running Linux. These are devices with very low performance hardware and resources , thus require low-level software to be able to work effectively , functionally and efficiently in relation to their potential .
Since eHouse server will operate on LAN most suitable and least utilizing solution for a server, is receiving status of the controllers via UDP broadcasts, of each controller on the same port. UDP broadcasts are connectionless protocol and does not require a maintained connection between the client and the server, which would be cumbersome and utilize additionally controllers and network. UDP datagrams can be received by any of the control panels in the network, no matter their count. It does not create an additional traffic on the LAN comparing to TCP/IP client-server connections that would be duplicated. In addition, active TCP/IP connections have to be for each panel to all Etheret eHouse home automation controllers to receive the status of all smart home controllers. Such a tree would have to be duplicated for each subsequent panel causing unnecessary and multiple increase utilization of LAN.
Due to architecture of C++ software and Linux hardware, requirements for eHouse server are many times smaller compared to the similar version of the software working under Windows Operating system. The graphical environment is also not required for server level , so you can use for this purpose microprocessor board ATOM processor , ARM , Samsung many times cheaper than a standard PC . It is also possible to install such software on ” historic ” PC hardware running on the processor 486 , eg by launching Linux and software from a USB memory .
The main element is the UDPListener ( which listens broadcasts of controllers on port 6789 (default) which are statuses of smart home controllers in binary format (below 200B per controller) . These data are directly copied to the structure of the status for CommManager in ECM structure, matrix EHE status for EthernetRoomManagers , and for eHouse1 building automation controllers under the supervision of CommManager statuses are loaded into the array of structures eH.
Set the software configuration is in the file Smart House eHouse – Open Source C ++ configuration “globals.h” .
To activate processing as Ethernet eHouse server, it is necessary to set the definition of
ETHERNET_EHOUSE = 1 which is the default settings.
another critical parameters are:
COMMANAGER_IP_HIGH – IP address CommManger (3th byte) – default (0 )
COMMANAGER_IP_LOW – IP address CommManager (4th byte) – default (254 ) total IP address for CM 192.168.%COMMANAGER_IP_HIGH%.% COMMANAGER_IP_LOW%
INITIAL_ADDRESS_L – Minimum IP address ( 4th byte) EthernetRommManagers – default (200 ) – ERM addresses begin with a standard 201 . It is used to create the index in status table EHE[ADRESL-INITIAL_ADDRESS_L] so the controller with the IP 192.168.0.201 will be in the varible EHE .
STATUS_ARRAYS_SIZE – Mask for the index status at the same time specifies the number of drivers eHouse 4 Ethernet ( ERM ) and eHouse1 (RM ) – default (15 ) .
Unless you have installed more controllers you should leave this value. Otherwise, “uncomment” another line with defined and do not edit the digits. When editing can disguise the index matrix and status of the controllers will be overwritten by another .
The most important function of the software is “UDPListener()”, which works in an infinite loop statuses downloading the Ethernet eHouse building automation controllers, and eHouse 1 under the supervision of CommManager.
Termination of the loop is possible only by way of application Ctrl-C or run function “TerminateUDP()” .
The software is simplified , because it is an educational – development , to allow the teaching of software development .
It is not multi-server and does not have a configuration (requires a recompile after changes to the definition in the file globals.h) .
To enhance its functionality you should put configuration into external files.
To increase efficiency, it is necessary to place the function “UDPListener()” in an independent thread run from the main application with the priority ( lowest or lower). Smart House eHouse – C server software ++ source code / open source Smart House eHouse – Open Source C ++ software source code listening UDP datagrams from Ethernet controllers eHouse .
For more information about the Open source C++ software for eHouse . Smart House eHouse – Open Source C++