Monday, July 18, 2016

A Little HA A.D.D.

I've been busy working on a whole bunch of different projects. It's been a little HA A.D.D. as I keep jumping from project to project and so far, not completing any.

Referring to my "So Much to Learn" post, I went through the Learning JavaScript Design Patterns book and cleaned up the JavaScript in our HA GUI, making it not only cleaner to read but more efficient and easier to add on to.  There's still work to do, but I distract easily.  Next, I did the freeCodeCamp course on frontend design.  I zooooooomed through it, completing all the exercises in less than a week, but I never did any of the projects.  I'd rather take what I learn and feed it back into our HA GUI as my project.

After I completed the frontend coursework, I saw freeCodeCamp had some not yet ready exercises on D3, which I hadn't heard of.  So after some digging, I got around to learning a little D3.  It has some neat visuals that CanvasJS doesn't offer, and I used it with my Jawbone activity tracking data.  I went a little overboard charting that data, but that will be the topic of a future post.

I also have an Ouya game console which I plan on making a standalone Android box for who knows what.  I went through the process of rooting it, installing a new bootloader, wiping the Ouya OS and installing CyanogenMod 11.  Once I finished that, I parked this project and went on to the next.

Last week, I received my C.H.I.P.s, and I played around with my first one.  I did a complete reflash of the OS (which has an interesting browser plugin approach to do this).  Then I started installing my usual packages like Perl, Python, VNC, Emacs, etc.  The first thing I plan to do with it is interface to a few current sensors using its GPIO pins.  I've already found an appropriate library to do the interfacing, I just need to decide if I'll use xPL or MQTT to notify the HA system of changes.  I really need to get the other 3 up and running to make sure they're good, but for now, it's on the backburner.

The Amazon Echo I got on Prime Day also arrived last week, and last night, I got an Alexa app server framework up and running with my own local endpoint.  It was my first time really playing with NodeJS and it was pretty straightforward.  Configuring things on the Amazon side was simple too.  Right now, I need to figure out how to securely get messages from my endpoint (in the DMZ) to my LAN in order to control devices.  Hopefully, I'll do that before starting on a new project!

Monday, July 11, 2016

Got My C.H.I.P.s Today

Just got home and found my 4 C.H.I.P.s had arrived.  I've only unboxed them:

Each comes with an adapter that connects to a jack on the C.H.I.P. and fans out to 3 RCA jacks for composite video and stereo audio.

A nice touch is the header pins are labeled unlike Pis or BeagleBones.

It even comes premounted to a nice plastic base!

It also includes builtin WiFi B/G/N, Bluetooth 4.0 and 4GB of onboard flash. DRAM is a skimpy 512MB however. The CPU is a 1GHz R8.  Hardware-wise I think it's a really good deal for ~$41 shipped for 4.  You can read more about C.H.I.P. at

Not sure what I will do with them yet. I have 2 BeagleBone Blacks and a Pi Model B lying around unused still, but I'll update after I've had a chance to play with them.

Sunday, July 10, 2016

Playing Around with Visuals: CanvasJS & FusionCharts

I was off from work this past week (and sick and recovering from a sprained ankle), so I've had lots of time to sit in front of the computer and try new things. I usually use CanvasJS for charting, but it has some limitations that bug me. I've looked into other charting packages, but always end up coming back to CanvasJS.  In the embedded below, I show the input bandwidth chart for my HA server using CanvasJS.  One thing you'll notice is the spike that dominates the chart. CanvasJS doesn't support log scale so you end up with large spikes drowning out the rest of the bars.  People have been asking for this feature for years but it's not in their roadmap.  Also, CanvasJS does automatic time/date labeling on the X-axis. There are 3-4 different days in the chart, only the times are shown. It would be nice if it would show the dates too, but apparently only does so when there are even more days of data.  It does have a nice zoom feature, which works great because I usually store a year's worth of data in MySQL.

FusionCharts promised log scales, for line and bar charts, and you can see that at the end of the clip.  Unfortunately, the X-axis doesn't auto-format for dates. My data is stored in MySQL by UNIX timestamp which means for every bit of data, I convert the timestamp in PHP before sending it over to chart. Log scale is nice, but there isn't any zoom/pan ability for these type of charts.  Apparently, only some line and bar charts with linear scales have zooming.

I didn't have any chance to pretty up the FusionChart, but I have to say, in spite of the log scale feature, I much prefer CanvasJS.  I also did some work with D3 but I'll save that for another post.