Saturday, November 27, 2010

Home Automation Android Client v1.0 Release

I have completed my 1.0 release!! I thought I would be posting this earlier in the Month, but with work and life, I have not had any time to write any code. I got a nice chunk of time yesterday and a little today for final cleanup. As usual, I have posted my files on Box.net and have embedded a window for accessing everything below. I have not included any new screen shots as the changes did not really affect the way the application appears.

Regarding the changes made, most of the updates were to address user interaction and prevent the user from making incorrect choices. I cleaned up both the Room and Unit(Device) Configuration Activities. I also added a bunch of code/functionality to the Main Activity. At first, the new code broke the application. It was so bad that I was at the point of building a test project and doing more investigation online about parameter passing as I thought I was losing my values. As it turned out, my code was sound, with the exception that I forgot to assign values to my variables before attempting to use them. I also mixed up how I was managing my addresses which was causing units to be assigned to the wrong rooms. Once I realized this and was able to easily replicate the issue, I had to rewrite a bunch of code to fix it.

There are a couple of things still not addressed in this release of the application. They may appear as updates or by the 2.0 release. The application does not handle landscape mode at all. I also didn't lock the application to portrait mode as I do want to address this in a future release. Lastly, that I know of,  when switching between landscape and portrait, the view will reset itself and any changes not saved will most likely be lost.

Now I will be spending my time on my Arduino code adding the TTL to Serial Converter I soldered together. Once I have that piece finished, I will be tying it all together in it's final form. From there, it will be only a matter of adding more devices and updating the configurations to use it all. Based on the family schedule over the next month or two though, I don't expect to be done with it until well into the new year. I will just hope I am wrong and it happens earlier.

Once I am controlling all the important parts of my home that I want to start with, I will be back to work on updates and future versions. Here's to not finding any significant bugs or need for code improvements until then.

Wednesday, November 3, 2010

HomeAutomation Client Beta is Ready

As promised, I am posting the Beta today. I needed to put together the screenshots and post the source files online. As usual, the files have all been posted on box.net and the folder is embedded below. As my post last night implied, there is still some work to be done on the code, including commenting and cleanup in addition to the user error proofing. 







The Main Activity Screen is the meat and potatos of the app. Currently, the app is only designed to send commands one way. There is a response that is currently being displayed, just not used for anything yet. If nothing has been configured, the app will load and won't do anything. The digital button will toggle and the Analog slider will move, but that is about it. 











This is just a shot of the Main menu. Clicking "Exit", does just what it implies. "Config" launches a list of configuration options for selection as in the next Screen shot






These are the configuration options. "Rooms" will bring you into the room configuration activity, "Units" for configuring the devices in the rooms, and "Server" for defining the IP/Host Address of the server (Arduino with my version of the Webduino server).

This is the Room Configuration Activity Screen. The room code is a spinner with the options of 'A' through 'P' to match the X10 House Code range. The name is the user defined name to associate with the room code. I think I will be rearranging the order of the components to keep the Name field at the top.

The "DELETE ALL ROOMS" button is my way of being able to delete rooms without having to worry about the functionality of one at a time.

The buttons on the bottom are accessible through the menu. I think I prefer the menus, but I had issues with the Delete code working when implemented through the menu.


This is the Device, or Unit, Configuration activity. Similar to the Room with additional properties unique to devices. The Room Code and Device Codes support the X10 values of 'A' through 'P' and 1 through 16 respectively.

The "DELETE ALL UNITS" is just like the Room Configuration's "Delete.." button just for the configured Devices.

This screen also utilizes the Room Configuration's menu for saving/canceling. This screen is the reason I prefer the menu option for Delete as well. I think it makes the screens look cleaner. I hope to resolve the issue before the 1.0 release.
This is the activity screen for modifying the server IP Address. The IP address that is already configured will populate the "Server" text field when launched.

I have my Arduino set up on my home LAN at the address shown. I plan on exposing my Arduino to the web, but want to figure out how I will authenticate to ensure the commands come from me or somebody I have provided the necessary authentication information. This feature is definitely not going to be in the 1.0 release as I need to figure out the Arduino side first.

The "Update" button does as it suggests and updates the client to use the Server IP address in the Edit text. I didn't use the menu here as I only needed to save. The cancel can be performed by hitting the phone's back button and returning to the Main Activity.






This is the Main Activity again, but now there are items selected and the send button was pressed. The Toast message is the entire HTTP Request string as it was sent to the server. I am displaying this for my current debugging needs.


This is a response received from the Arduino. I am displaying the JSON response with a Toast Message for debugging purposes.



Overall, the functionality is still relatively simple, but it is just the beta for what will be a 1.0 release. I am pretty excited about finishing this. Once I am done with the 1.0, I have to go back to my Arduino server to finish implementing some functionality there. With the tasks left, I am feeling optimistic about my time frame for doing my actual home testing. I will continue to post project updates throughout the process.

Tuesday, November 2, 2010

HomeAutomation Client Beta v0.7: Will be Posted Tomorrow

This is just a quick status update since I put the time in to get the beta ready for release tomorrow. I added a few more functional pieces to round out everything I need for my first release. I added the Server Configuration into the stored preferences, added functionality for deleting all Rooms/Units and set the Unit Spinner to update based on the Room Selection.

I have not addressed any of the UI user interaction, in terms of eliminating, minimizing or catching usability errors. For example, the app will currently allow all the Rooms to be deleted from the configuration while there are still devices associated with them. I am still using a mix of buttons and menus throughout. I am still trying them out to see if I prefer one over the other, at least for the the different needs of this project. Once I get the beta posted tomorrow, the usability, error proofing and look/feel will be the next process to finish up. The code will be ready for a release candidate post once those issues have been addressed.

Tomorrow, I will provide a post for the beta with Screenshots, links to the code and the apk file, as well as a brief explanation of everything.

Monday, November 1, 2010

HomeAutomation Client Beta Coming Along, slowly...

Free time has been scarce and as a result, this project has been suffering. With work, Halloween, and my wedding anniversary, last week, I was very busy. But, it was a fun and exciting week since the kids really got into Halloween this year.

Anyways, I have finally made enough progress that most testing has been moved to my physical phone and off of the emulator. The Emulator doesn't have true network support, and since networking is the core of this project, it was time.
Server Configuration Activity
In regards to updates, I have added a Server Configuration Activity (left) for allowing the user to define the server IP. I have also been testing the functionality with regards to the HTTP request strings I am generating, and the JSON responses I am receiving. I am currently displaying both strings within simple Toast messages for debugging purposes, but have a plan to do something with their responses later. Most likely when they can indicate a success/failure of the command issued.

I also need to add some more UI code for managing the main Activity's Spinner controls before I stop calling this a beta. Currently the Room List and Unit List spinners are populated with every possible option. I want the Unit List to update according to the Room Selection. I have to finish testing and possibly flushing out some additional functionality for saving/restoring preferences  first, but the spinner code will be next.

I have updated my files on box.net . Here are the links to the project folder, the app apk file, as well as the individual source files updated since last post:
ArduinoClient.apk
Arduino Client(Folder)
JsonParser.java
ServerConfigurator.java
editserver.xml
menu.xml
AndroidManifest.xml