Tellstick Server

Web interface for Telldus Tellstick.
Start a server on your home computer and controll your electronics & ligth.
You can also connect to it via your Android phone.
See Tellstick App for the client.

Have not done anything on this for a long time so it is kind of dead :-(
  • Contoll Tellstick with web interface.
  • Works on NEXA units.
  • Connect Android app to this server.
  • Works on every OS Tellstick works on (linux, Window, Mac OS X).
  • Schedule to turn on and off devices.
Here you can download the code: Google Drive

Screenshots




Dependencies (All needed jar is under the lib directory, except telldus-core)

Java 1.6
Apache Tomcat 6.0 (Servlet-api, Jsp-api) (http://tomcat.apache.org)
SteelsquidClassCollection 
SteelsquidSpringUtils
SteelsquidTellstickController
Spring Framework 3.0.3 (http://www.springsource.org)
Spring Security 3.0.3 (http://static.springsource.org/spring-security/site/index.html)
Apache Derby 10.6.1.0 (http://db.apache.org/derby)
Apache log4j 1.2.16 (http://logging.apache.org/log4j/1.2)
Commons Collections 3.1 (http://commons.apache.org/collections)
Commons DBCB 1.3 (http://commons.apache.org/dbcp)
Commons Pool 1.5.5 (http://commons.apache.org/pool)
Commons Codec 1.4 (http://commons.apache.org/codec)
Commons Logging 1.1.1 (http://commons.apache.org/logging)
Commons FileUpload 1.2.2 (http://commons.apache.org/fileupload)
Commons IO 2.0 (http://commons.apache.org/io)
Hibernate 3.5.6 (http://www.hibernate.org)
Hibernate Validator 4.1.0 (http://www.hibernate.org)
Hibernate jpa 2.0 (http://www.hibernate.org)
JSTL 1.1.2 (http://tomcat.apache.org/taglibs/standard)
SLF4J 1.5.8 (http://www.slf4j.org)
CGLIB 2.2 (http://cglib.sourceforge.net)
Dom4j 1.6.1 (http://www.dom4j.org)
Antlr 2.7.6 (http://www.antlr2.org)
JTA 1.1 (http://www.oracle.com/technetwork/java/javaee/tech/jta-138684.html)
Javassist 3.9.0 (http://www.javassist.org)
Aopalliance 1.0 (http://www.antlr.org)
Validation-api 1.0.0 (???)
Quartz 1.8.4 (http://www.quartz-scheduler.org)
RXTX, if you use RXTX [TellstickJavaController] (http://rxtx.qbang.org/)
Telldus-core, if you use wrapper[TellstickCoreController] (http://www.telldus.se/products/tellstick)
Linux (Working on windows version)
Telldus Tellstick (http://www.telldus.se/products/tellstick)
Computer with usb port
NEXA device (http://www.nexa.se)

Usage

You can either use my java driver (with RXTX) or telldus-core (wrapper for telldus-core).

Java driver (RXTX):
Will only works on Linux i686 and x86_64.
You must have the Tellstick connected and available at /dev/tellstick or /dev/ttyUSB0.
If tellstick is on other place than /dev/tellstick or /dev/ttyUSB0 you must change it in the web-interface settings.

Wrapper for telldus-core:
Works on every OS Tellstick works on (linux, Window, Mac OS X).
You have to install Delldus Tellstick software (http://www.telldus.se/products/tellstick).
Set the path to tdtool binary in the web-interface.
In my case (Ubuntu): /usr/bin/tdtool
Or for Windows example: C:\Program Files\Telldus\tdtool.exe

If the values stored in the database is lost when you install a new version, 
you must change where Derby saves the database files (applicationContext-database.xml)

Application must be deployed under http(s)://xxxx:xx/TellstickServer for the 
TellstickAndroidApp to work.

Deploy in Apache Tomcat/Jetty.
Point your browser to http://localhost:8080/TellstickServer
- You should see a login page.
- You can login with User: admin, Password: admin
- Klick on Settings and set the Tdtool Path or USB-port

I think the gui is self-explanatory... 

Short description of classes

org.steelsquid.tellstickserver.controller
All controller in the system, handles request from a client
org.steelsquid.tellstickserver.controller.AndroidController
This is android controller for SteelsquidTellstickServer.
Listen for connections from SteelsquidTellstickAndroid app.
org.steelsquid.tellstickserver.controller.DevicesController
This is device controller for SteelsquidTellstickServer.
Lists all units that can be turned on and off.
Maps to devices.jsp.
org.steelsquid.tellstickserver.controller.SchedulingController
This is the Scheduling controller for SteelsquidTellstickServer.
Schedule to turn on and off devices.
Maps to scheduling.jsp.
org.steelsquid.tellstickserver.controller.SettingsController
This is settings controller for SteelsquidTellstickServer.
Configure settings.
Maps to settings.jsp.
org.steelsquid.tellstickserver.controller.IndexController
This is the entry point of Steelsquid Spring Template.
Maps to index.jsp.
This controller is connected to index.htm request.
org.steelsquid.tellstickserver.controller.ManageController
This is the Manage controller for SteelsquidTellstickServer.
Add and remove devices.
Maps to manage.jsp.
org.steelsquid.tellstickserver.controller.UsersController
This controller list users from the database.
Maps to users.jsp.
This controller is connected to users.htm (and some others) request.
User with ROLE_ADMIN can search and edit users.
User with ROLE_USER can change there own information.
This controller list, add and delete users to Spring security.
org.steelsquid.tellstickserver.dao
All database stuff.
org.steelsquid.tellstickserver.dao.security
All security database stuff (Tbale User and authority).
org.steelsquid.tellstickserver.dao.security.Authority
This is a authority for a user on the system.
using hibernate to map the table authoritieslist.
org.steelsquid.tellstickserver.dao.security.SecurityDao
This is the Dao object for the users and authorities tables
Use this to list, add and delete users to Spring security
org.steelsquid.tellstickserver.dao.security.User
This is a user on the system.
using hibernate to map the table users and authorities.
org.steelsquid.tellstickserver.dao.tellstick.Device
This is a device in this system.
Using hibernate to map the table devices.
org.steelsquid.tellstickserver.dao.tellstick.Settings
This is all settings in this system.
Using hibernate to map the table settings.
org.steelsquid.tellstickserver.dao.tellstick.Schedule
This is a scheduled task (Turn on or off device).
Using hibernate to map the table schedules.
org.steelsquid.tellstickserver.dao.tellstick.TellstickDao
This is the Dao object for the devices and settings tables.
Use this to list, add and delete devices.
Add and remove sceduling.
Load and save settings.
org.steelsquid.tellstickserver.interceptor
Run some stuff att startup (Add users to spring Security tables).
And a request interceptor.
org.steelsquid.tellstickserver.interceptor.StartStopInterceptor
This will execute on start and stop of application.
Using it to run startupp stuff.
Se applicationContext-database.xml
Add roles and create a default user: admin
Start the TellstickController.
org.steelsquid.tellstickserver.rxtx
Contains the librarys for RXTX (serial connector).
org.steelsquid.tellstickserver.view.AndroidView
View to return xml answer to android app.
org.steelsquid.tellstickserver.schedule.DeviceTask
This job execute every 10 minute to check if to turn on or off devices.
/web/META-INF/context.xml
This file can be used to define certain behaviours for your application,
JNDI resources and other settings.
All i use it for is deployment path: /TellstickServer
/web/WEB-INF/jsp/devices.jsp
This is the device page for Steelsquid TellstickServer.
Using DevicesController as controller.
/web/WEB-INF/jsp/scheduling.jsp
This is the schedule page for Steelsquid TellstickServer.
Schedule to turn on and off devices.
Using ScheduleController as controller.
/web/WEB-INF/jsp/index.jsp
This is the start page for Steelsquid TellstickServer.
Using IndexController as controller.
This page is connected to index.htm request
Usng steelsquid:Workspace to generate a workspace for the application.
The workspace has a iframe for the different pages.
/web/WEB-INF/jsp/manage.jsp
This is the manage page for Steelsquid TellstickServer.
Using ManageController as controller.
/web/WEB-INF/jsp/settings.jsp
This is the settings page for Steelsquid TellstickServer.
Configure settings.
Using SettingsController as controller.
/web/WEB-INF/jsp/users.jsp
This page list users from the database.
Using UsersController as controller.
This page is connected to users.htm (and some others) request
User with ROLE_ADMIN can search and edit users.
User with ROLE_USER can change there own information only.
This page list, add and delete users to Spring security
/web/WEB-INF/jspf/head.jspf
This file create the html head content.
Contaions all Javascript and css that SteelsquidTellstickServer needs.
A think it is useful to have a jspf file as header on all pages...can add things globaly very easy.
This page executes onPageLoad() on start. Create method named onLoad() do execute stuff in page implementing this.
/web/WEB-INF/tld/steelsquidSpringUtils.tld
Some useful tags, i use in my project.
- Path: Generate the path to a application. Ex http://xxxx.org/[thePath]
- BasePath: Generate the base path to a application. Ex http://xxxx.org/yyy
- Window: Generate a simple window with rounded corners, title and a body (Uses two images to the corners, See img/head.gif, img/body.gif)
- Section: Generate a section of the page (a border). Very simple...
- Workspace: Generate a simple workspace width links (8 links + logout link) and rounded corners (the body is a iframe)
- FormHasErrorTagHandler: The body of the tag will be shown if there is a error in the form.
- FormIsOkTagHandler: The body of the tag will not be shown if there is a error in the form.
/web/WEB-INF/applicationContext.xml
Application context definition (Configuration Files).
Create empty database and configure Tellstick.
/web/WEB-INF/applicationContext-database.xml
Application context definition (Configuration Files).
Configuring the database/hibernate in this file.
/web/WEB-INF/applicationContext-security.xml
Configuring spring security.
/web/WEB-INF/dispatcher-servlet.xml
Loading spring settings
Configuring the spring request handling.
/web/WEB-INF/web.xml
The web.xml file provides configuration and deployment information
for the Web components that comprise a Web application.
Examples of Web components are servlet parameters, servlet and
JavaServer Pages (JSP) definitions, and Uniform Resource Locators (URL) mappings.
/web/login.jsp
This is the login page to Steelsquid TellstickServer.
Using Spring security.
See applicationContext-security.xml
/web/redirect.jsp
This JSP is here to provide a redirect to the dispatcher servlet but should be the only JSP outside of WEB-INF.

Revision history

2010-12-12   0.1   Initial release
2010-12-13   0.2   Can now use telldus-core insted of java driver
2010-12-14   0.3   Using tdtool insted of rfcmd
2010-12-16   0.4   Works on all OS Tellstick works on
2010-12-18   0.5   Can change settings in the web-interface
2010-12-18   0.6   Schedule events
2011-03-20   0.7   New icon And have inadvertently commenting out the on / off command to TellStick
2011-04-06   0.8   Change the workspace colors (Gray)
2011-06-15   0.9   Nothing new in the code but using Netbeans 7