Monday, November 27, 2017

Capsaicin Chaos - Episode 4 - HOBloom System Updates

Capsaicin Chaos - Episode 4

HOBloom Updates

Live Stream:
Support YieldTek:

[ Live Stream ]

[ Previous Episodes ]

[ The Times They Are A Changing ]

    Today's show is going to be a little different than normal.  I have had a few major changes I have wanted to make to the HOBloom client and server side code.  The first major change I have wanted to make for a long time now was splitting up and moving the client and server-side code.  Previously, everything was in one repo and the client side code was in a subfolder on the main repo named client.  This repo was hosted on my personal GitHub account and can be found here.  I have now created repositories for each project under the YieldTek GitHub.  You can find the server side code here and the client here.  The next major step I took was refactoring the server.  The server-side code was a mess and had way too many things hard-coded or doing logic inside of the main hobloom.js file.
    If you want to see the refactor check out the previous link and switch to the development branch.  I moved all appliance and sensor management into there own classes, created tons of static utility classes for previously (unnecessarily) non-static methods.  I moved a ton of logic around and did a lot of general clean up.
    Onto the client.  For the client, I originally wrote it using Angular 2.  I don't hate angular but, it ended up being way more bloated and picky than was required for my project.  I have wanted to rewrite it for a good bit now using ReactJS.  The code isn't on git yet as I am not totally done but, this past weekend I taught myself react and rewrote a good bit of the client using React.  So far, I love React.  It is light and flexible and I love having all of my javascript and JSX in one file.  It is extremely powerful yet it never forces your hand on anything.  I still have a lot to learn but, so far so good.
   I also decided I didn't want to use intervals anymore so I decided to remove the REST API from the server and replace it with socket io.  I am now using real-time socket connections to push updates to and from the client only when necessary.  This allows me to avoid having to make unnecessary API calls to do things like check for settings changes.

[ Wrap Up ]

    I hope you are looking forward to the improvements to our open source grow software.  If you like this post be sure to give it a plus one and comment below with any questions you have.  I'll see you tomorrow with another garden update.  As always thank you for reading and happy growing!

No comments:

Post a Comment