Thursday, April 16, 2015

Building a SolarEdge Windows Desktop Widget - Part 4 - Finished For Now

The last few days when I wasn't working on actual work, was spent mostly cleaning up and finishing up the work on this project. There were a few major changes between now and then that I want to focus on.

The first big change was to the methods for handling the data points that are different for 2 users.  Username, Password, and SiteId.  Storing all of these is a relatively trivial thing other than Password.  I did not want to store the password in plain text, but was uncertain how to encrypt it in a way that wouldn't be quickly and easily decryptable.  I ended up going with this solution http://weblogs.asp.net/jongalloway//encrypting-passwords-in-a-net-app-config-file. The DPAPI isn't perfect, but it would handle securing the text and tying it to the currently logged in windows user.

I created a simple settings form to handle adding these values in.  In doing this I felt if I was going to spend the time securing the password I should go all the way and make sure the input was secure.  To that end I found http://weblogs.asp.net/pglavich/440191.  This allowed me to ensure that the text in memory from the Textbox wasn't vulnerable to being read by using SecureString.


There is one other setting that I found needed to be added after some time monitoring my solar system; Tolerance Offset.  I have 2 different methods of monitoring my solar generation.  One is through the inverter and thus through the SolareEdge monitoring site.  The other is a revenue grade electrical meter.  After a week or so I noticed that the 2 no longer agreed with each-other on how much I was generating.  After talking to the installer and to SolarEdge, it turns out the inverter has a +/- 5% tolerance for monitoring.  I find this odd, but it is what it is.  The Tolerance Offset will modify all the data by a certain %.  For example, my inverter reports roughly 4.2% more generation than is actually happening.  So I would put in 95.8 in the tolerance offset.  This isn't exactly perfect, but it gets it within a couple kWh for now.  I will probably need to tweak it as the years go on.

The next big change that needed to happen was to gain access to these settings.  To this I added an icon of a gear. Additionally I added a refresh and arrows icon (for dragging).  The icons are from http://www.flaticon.com/.   The refresh and configure icons were fairly straight forward, but the move icon required a little extra work. I used this method to handle it: http://stackoverflow.com/questions/1592876/make-a-borderless-form-movable.  The icons only show themselves when you hover over the right area of the gadget.

The last major addition was a 3rd graph that would show generation by month for the whole year.

Overall this project has been quite enjoyable if not a bit more time consuming than I had originally planned.  There are surely improvements to be made, but for now I need to move onto the next thing.  Probably the biggest improvement would be to give more control over the colors (or rather, any control).  Right now you can have it in any colorset that you want as long as the color is black, dark blue and light blue.

The code exists here https://github.com/iamwyza/SolarEdgeGagdet.  Here are the final images of the design.




No comments:

Post a Comment