eHouse Smart Home visualization – Java

Visualization of eHouse smart home system in Java

eHouse Smart home system graphical visualization, extends eHouse development libraries for the intelligent home system and makes possibility of independent creation of software by end users of the eHouse system, associated companies and companies wishing to individually develop eHouse system for Java SE .

eHouse for Java (eHouse4Java) are Android and Windows Mobile compatible libraries allowing you to create your own software for control panels and PADs.
Library is an application template which can:

  • load on the system configuration, the names of the controllers, outputs, inputs, sensors , etc.
  • providing communication with home automation controllers
  • reception and decoding of controller status data
  • send control commands graphically ( with visualization objects ) or textually ( the fields selected )
  • control system via WiFi , Internet , SMS , eMail
  • graphic visualization and control – load a text configuration file of graphic objects associated with the events to be executed ( control commands ) and device statuses
  • automatic visualizations for RoomManager or other controller

Visualization is created using Java swing library like: JPanel, jbutton, etc. .
These objects are automatically “double-buffered” , thus eliminated the flicker effect , very annoying for the user .

The user has the ability to control the image:

  • Zoom in and out
  • moving up , down, left, right
  • change the current view by choosing “Options”
  • return to the graphical visualization of the system by selecting “View”

Visualization Example of eHouse system:
 Intelligent home control eHouse online graphics and visualization - java open source
 Intelligent home control eHouse online graphics and visualization - java open source
Zoom in and out ( zoom in and out ) implemented using scalable vector graphics ( SVG ) , so that the image does not lose quality when you change the scale:

Configured controllers are automatically displayed :

Statuses is updated through the network or the Internet (TCP or UDP) – online (real-time)
 Intelligent home control eHouse online graphics and visualization - java open source
 Intelligent home control eHouse online graphics and visualization - java open source
 Intelligent home control eHouse online graphics and visualization - java open source
 Intelligent home control eHouse online graphics and visualization - java open source
by selecting the ” Options ” and the room can watch the states drivers and select programs . Changing the status of incoming UDP will automatically rewizualizacjÄ™ :
 Intelligent home control eHouse online graphics and visualization - java open source
 Intelligent home control eHouse online graphics and visualization - java open source
In addition to visualization of the individually designed based on the architectural design and installation of smart home there is also automatic visualization created independently for each controller in the system (in particular for RoomManagers and EthernetRoomManagers – for individual rooms ). This allows for independent control panels and visualize for each room individually , without tedious creating visualizations based on installation design.

For CommManager ( states of alarm sensors , outputs)
 Intelligent home control eHouse graphics and visualization automatic online - java open source

For RoomManagers and EthernetRoomManagers:
 Intelligent home control eHouse graphics and visualization automatic online - java open source
 Intelligent home control eHouse graphics and visualization automatic online - java open source
 Intelligent home control eHouse graphics and visualization automatic online - java open source
For boiler controller , recovery of CO ( HeatManager )  Intelligent home control eHouse graphics and visualization automatic online - java open source
 Intelligent home control eHouse graphics and visualization automatic online - java open source

More information can be found in the articles devoted to programming libraries eHouse4Android ( eHouse for Android – Java Android) which have been translated into Java SE for compatibility and facilitate the development of software for different operating systems.

SOURCE CODE PROGRAM

/ *
* Template applications for graphic visualization system, smart home eHouse
* ONLY for registered users of the system eHouse , Cooperating Firm All Rights Reserved
*
* Requires grades:
* ehousecommunication.class – send events to the system
* EhouseTCP.class – initialization and maintenance of communications over TCP / IP drivers , updated data from the system inputs and outputs
* StatusEhouse.class – data storage and driver settings , updated on a regular basis over TCP / IP drivers ehouse1 ( 485 )
* StatusCommManager.class – store current data and settings drivers , updated on a regular basis over TCP / IP drivers ehouse2 (Ethernet )
* GraphicObject.class – storage of graphical objects
* visualization.class – drawing graphic objects ( lines , ellipses , rectangles ) and event handling related
*
* Application template designed a graphic visualization of eHouse System
* ONLY FOR REGISTERED USERS , VENDORS , COOPERATIVES Copyright iSys . En All Rights Reserved
*
* Required classes :
* ehousecommunication.class – sending events is a system
* EhouseTCP.class – initialization and maintenance of TCP / IP communication with drivers , updating current status of drivers
* StatusEhouse.class – drivers settings and data storage , updating data ( TCP / IP) for ehouse1 drivers ( 485 )
* StatusCommManager.class – drivers settings and data storage , updating data ( TCP / IP) for ehouse2 drivers (Ethernet )
* GraphicObject.class – graphic data storage objects
* visualization.class – drawing graphic objects ( lines , ellipses , rectangles ) and handling events related to them
* /

package ehouse4java ;

import java.awt.* ;
import java.awt.event.* ;
import javax.swing.* ;
import javax.swing.event.changeevent ;
import javax.swing.event.ChangeListener ;

public class extends Ehouse4java JFrame implements ActionListener , ChangeListener {
/ **
* Class responsible for initialization status of the system and the creation of
* The main application window . Implements interfaces that support Event
* Associated with buttons .
*
* Class Responsible for initializing the status of classes and creating
* The main application window . That Implements interfaces support events
* Related to the buttons .
* /
/ **
* Visualization object containing currently Displayed view
* /
Public visualization Visualization ;
// public visualization Options ;
// public visualization TextEvents ;
/ **
* Pallete of buttons supporting zooming , shifting and changing
* Displayed view
* /
JButton ZoomPlusButton ;
JButton ZoomMinusButton ;
JButton LeftShiftButton ;
JButton RightShiftButton ;
JButton UpButton ;
JButton DownButton ;
JButton ExitB = null ;
JButton Options ;
JButton View ;
JButton Back ;
JButton [] ViewsB = new JButton[MAX_VIEWS_COUNT];
/ **
* Panel with all buttons
* /
JPanel ZoomPanel ;
/ **
* Panel containing currently Displayed visualization
* /
JPanel ViewPanel ;
/ **
* The panel containing a group of buttons used to access controllers,
* System schedules etc .
* /
JPanel optionspanel ;
/ **
* Oprional scrollpanes
* /
JScrollPane jsp1 ;
JScrollPane jsp2 ;

public static int buttonscounter ;

public int CenterX ;
public int Centera ;
public int prevCenterX ;
public int prevCenterY ;

public int Ycompensation ;

prevOffsetX int = 0 , prevOffsetY = 0 ;

double prevScaleX ;
double prevScaleY ;

public final double zoomfactor = 0 . 3 ;

public static String previousoptionsview = ” ” ;
/ **
* Creates new forms Ehouse4java . Initiates the status of classes and graphic
* Components with main window .
* /
Public Ehouse4java () {
super ( ” ehouse ” ) ;

onCreate () ;

setDefaultCloseOperation ( JFrame . EXIT_ON_CLOSE ) ;

/ **
* Initiates all graphic components
* /
addComponentToPane ( getContentPane ()) ;

setSize (400 , 400) ;
setLocation (200 , 0) ;
setMinimumSize ( new Dimension (200 , 200 ) ) ;
setVisible (true) ;

prevCenterX = ( int) Visualization . getBounds () . getCenterX () ;
prevCenterY = ( int) Visualization . getBounds () . getCenterY () ;
}
/ **
* Initiates all components dry as graphic panels , buttons , scrollbars , etc. .
*
* @ Param pane
* /
public void addComponentToPane ( Container pane ) {

optionfirsttime = true ;

ExitB = new JButton ( ” Exit ” ) ;
ExitB . setActionCommand ( ” Exit ” ) ;
ExitB . addActionListener (this) ;
. . .
indexView int = 0 ;

ZoomPanel = new JPanel ( new FlowLayout ()) ;

ViewPanel . add ( ZoomPanel , BorderLayout . PAGE_END ) ;

ZoomPlusButton = new JButton ( ” + ” ) ;
ZoomPlusButton . setActionCommand ( ” ZoomPlus ” ) ;
ZoomPlusButton . addActionListener (this) ;
ZoomPanel . add ( ZoomPlusButton ) ;

ZoomMinusButton = new JButton ( ” – ” ) ;
ZoomMinusButton . setActionCommand ( ” ZoomMinus ” ) ;
ZoomMinusButton . addActionListener (this) ;
ZoomPanel . add ( ZoomMinusButton ) ;
. . .
}
/ **
* Initiates classes StatusCommManager and StatusEhouse by loading drivers ‘ ‘
* status
* /
public void onCreate () { . . . }
/ **
* @ Param args the command line arguments
* /
public static void main (String args []) {
/ *
* Create and display the form
* /
java . awt . EventQueue . invokeLater ( new Runnable () {

public void run () {
New Ehouse4java () . setVisible (true) ;
}
} ) ;
}
/ **
* Supports events invoked by Clicking on button
*
* @ Param e
* /
Override
public void actionPerformed ( ActionEvent e) {
switch ( e . getActionCommand ()) {
case ” ZoomPlus ” :

prevOffsetX = ehousecommunication . OffsetX ;
prevOffsetY = ehousecommunication . offsets ;

ehousecommunication . ScaleX * = (1 + zoomfactor ) ; // * 100 / zoomleve ;
ehousecommunication . Scaley * = (1 + zoomfactor ) ; // * 100 / zoomleve ;
// Centering the view after rescalling
ehousecommunication . OffsetX + = ( int) ( ( Visualization . getBounds () . getCenterX () + prevOffsetX ) * zoomfactor ) ;
ehousecommunication . Offsets + = ( int) ( ( Visualization . getBounds () . getCenterY () + prevOffsetY ) * zoomfactor ) + Ycompensation / (1 / (2 * zoomfactor ) ) ;

EhouseTCP . ReadViewFile ( ehousecommunication . currentview ) ; // calculate zoom
Visualization . repaint ( ) ;

return ;

. . .
}
}
}