VB.NET automation controller

iostream212

Active Member
Hello CT,
I am rying to write an automation controller with my limited knowledge in VB.NET, C++. I know the theory pretty well, but something is being lost in execution. I have a mainly form driven program filled with various buttons. The forms are borderless and full-screen for use on my touch panel. I seem to be running into an issue that as I switch screens I can visibly see the controls being drawn one at a time. It takes about 2 seconds and then the screen is complete. That lag was much more evident when I set a background image for the form to act as a wallpaper. Any hints to speedup screen loading or drawing? I can take the back image off, but then my forms look sooooo plain. ;) Thanks!
 
Hmm, you might be filling up a video buffer or something, perhaps the background graphic is too large.. What are the specs of the PC you're running the app on? There are some excellent .Net resources on here, I'm sure you'll get a more intelligent response than what I've provided.

Not to try to sway you from doin' you're own thing; but If you're just starting out, why not look into something like Housebot, j9 Automation engine, or even Homeseer. Those would allow you to start with a good HA foundation, yet still write pretty advanced scripts/plugins/modules/etc. in .NET, C++ or some other language. It might help to further refine you skill set then you could jump into your own app.

I feel ya though, I have started writing my own stuff in Linux or FreeBSD or OS X probably a dozen times. It just ends up so much easier to do on my HouseBot server so I always just end up sticking to that. I do have a sort of combined solution though where I use HouseBot for it's nice GUI interface, and a Linux server in the background that feeds HouseBot with information - at the moment that seems to calm my craving to write stuff.

Good luck, be sure to post your progress!

Terry
 
I'm doing a home automation controller in .NET myself, but mine is primarily web-based with some gui add-ons for touch-screens. I also have my Light Show Master product that is done entirely in .NET, with a fairly sophisticated gui with custom rendering.

Sounds like you have a lot of dynamic controls that are being created and rendered after the form is being displayed. I recommend that you preload your forms and that you instantiate your controls before the form is displayed. This should make it nearly instant. Also, try to avoid doing a lot of stuff (like disk access) during the activate event, and avoid it in the load event as well unless you are going to load all your forms at startup.
 
This is running on my Advent ADV3500PC. Yeah it's a real 'monster.' But come on! Who could resist the lure of the $269 flat panel? ;)
 
Creating your own software can be fun, but also requires a lot of time, especially if you are thinking about creating a full automation system. If you are interested in leveraging the use of an existing system and being able to add your own device drivers written in .net, take a look at the J9 Automation Engine. There's even a Device Developer's Incentive Program that grants you a free license to the software if you develop a driver. There are currently 50 device drivers, and if you are familiar with .Net then creating a device driver would likely be easy for you. A brand new user created a device driver in just a few hours last week.

Full Disclosure: I am the author of the J9 Automation Engine.
 
Thanks for the hints. I will look into that for sure. I like the challenge of trying to develop my own software. Functionality of this program already includes serial, tcp/ip and ir communication with custom device drivers supporting Samsung and Onkyo protocols, Insteon device control, sms interface for sending commands and receiving system status updates. Next project is to add Elk control... oh yeah and speeding up my screen loads!

I might throw it out there, especially to roussell and Xpendable, what were your motivations for developing your own software? Was there features lacking or real world problems too complex for commercially available software controllers?
 
Programming Update.
Finishing up a few aspects of this program and thought I'd upload some screen shots. I would like to thank the CT community because a lot of the inspiration came from the posts and ideas of others.

Things I have learned from this project (so far):
Form drawing in .NET and how to speed it up
ELK M1 control... the hardest part was the checksum for me. I can post vb.net code if anyone needs it.
XML and how to grab data from external sites to use in my project (thanks to Johnny Nine for the NOAA.gov site idea)
Serial, ASCII, TCP/IP communication reading and writing

Things to Learn List:
I am still trying to figure out how to read and write to my Universal Devices ISY-99i. I am having trouble because it is protected and I am not 100% sure on how to provide credentials to login pragmatically and even how to communicate once authenticated.
Make better graphics and forms! :(

main.jpg


media.jpg


security.jpg


security_violated.jpg


weather.jpg


weatherdetail.jpg
 
>> ELK M1 control... the hardest part was the checksum for me. I can post vb.net code if anyone needs it.

I'd like to have a look at your code. I struggled with the checksum as well, and I'm not sure if what I have is right (getting the elk on the network and talking to it are my next project)

And one other thing... for your weather maps are you using the url for the pictures and downloading them into a picturebox? I did something like that for a weather page I wrote and it seemed to work well enough.

Matt
 
I believe Grayson Peddie posted some .NET code somewhere, showing how to interface the M1, but you can also look at my old VB script for some clues.
 
I wouldnt mind having a look too. I wrote a kitchen touchscreen app and am going to incorporate some insteon and elk code. This will give me a head start. I can share what I have done later too.

My kitchen app has weather, shopping list that is built from a bluetooth UPC scanner, iphone access to the shopping list, to do list, recipes, and a mixed drink list (not finished). I plan to add thermostat control and security status and maybe then add another terminal in the house somewhere. thanks
 
Private Function CreatePacket(ByVal packet As String)
'packet is the string command without the packet length or checksum
'this function will compute the packet length and checksum and add it to the packet
'This is a variable to store the sumation
'of each ascii character value in the string
Dim intCheckSum As Integer = 0

'This computes the packet length and adds the result in hex to the packet
If (packet.Length + 2) <= 15 Then
packet = "0" + Hex(packet.Length + 2) + packet
Else
packet = Hex(packet.Length + 2) + packet
End If

'Turns ascii string into ascii values and adds them together
For i As Integer = 0 To (packet.Length - 1)
intCheckSum = intCheckSum + Asc(packet.Substring(i, 1))
Next

'finds two's compliment and adds 1 to it
intCheckSum = (intCheckSum Xor 255) + 1

'takes the two's compliment and converts it to hex.
'Then takes the result and saves it as a string
Dim strCheckSum As String = Hex(intCheckSum)

'The reason for saving the result as a string above
'is so that we can perform some string manipulation
'In this case whatever the result is we want the last two digits
strCheckSum = strCheckSum.Substring(strCheckSum.Length - 2, 2)

'finish the packet by adding the checksum that we had just calculated
packet = packet + strCheckSum

Return packet
End Function
 
Back
Top