Tuesday 29 November 2016

I'm on Fire

I've had an Amazon account since the early naughties and do most of my online purchases there. This was brought home to me this week when I signed in to Amazon Music for the first time and found that it populated itself with all of the CDs I'd purchased over the past 15 years. In all that time, however, I've only been dipping my toes into the Amazon world.

I recently acquired an  Echo Dot and signed up for a developer account in order to write skills for it. For some reason, this has magically indoctrinated me into the Amazon way and I'm turning into the biggest fanboy.

Over roughly the same period, I've been trying to find the ideal whole-house entertainment system. I've built more HTPCs than you could shake a stick at and have tried all the back-ends there are from SageTV to my current fav., a TVHeadEnd/EMBY combo. However, there's always been at least one shortcoming in anything I've tried.

With my new Prime account, I thought I'd try an Amazon FireTV device - just to see, I ordred a FireTV and plugged it in to the living room set, replacing a Gigabyte Brix HTPC. I installed Kodi and a FLIRC for IR control and started playing.

Monday 14 November 2016

Alexa, meet Squeezebox

Since my Amazon Dot arrived, I've been smitten. A little like how I didn't think I'd use a smart watch until I bought a Fossil Founder, I though voice control a gimmick until I started playing with Alexa. In the past few days I've been toying with the idea of building full Alexa control of my squeezebox based whole-house audio system. Here's what I've managed so far. It's a basic proof of concept but it does work;


This comprises a very basic LMS plug-in which links the local squeeze server software to the cloud-based skill. The skill is written using Node-RED with a mySQL database in the background.  I'm really growing to love Node-RED more and more and it seems ideal for flow-based functionality like an Alexa skill. Here's the current flow that drives the demo in the video;



There's still a long way to go but so far this is promising and a blast to put together.




Friday 11 November 2016

Importing a lib for use in Node-Red in a Docker

In one of my Node-Red flows, I wanted to use the fuzzyset.js library. This has an npm installer but it didn't work inside the docker. The recommended approach is to install to the /data directory (appdata/nodered) from the host system but as unRAID doesn't support npm, I couldn't do that either.

So, I had a .js library that I needed to manually install and use. Here's how I did it;

First, from unRaid console, I created a 'fuzzyset' folder inside /mnt/user/docker/appdata/nodered/lib/. Then, I copied the fuzzyset.js file to this folder.

Next, I edited this part of the/mnt/user/docker/appdata/nodered/settings.js file to include the library;


 functionGlobalContext: {

      fuzzyset:require('/data/lib/fuzzyset/fuzzyset.js')

    },


Then, I could call and use the fuzzyset functions inside a node-red function like this



  
   var FuzzySet = context.global.get('fuzzyset');


   var a = FuzzySet(someArray);
   var result = a.get("Some String");




      
       

Tuesday 1 November 2016

Naked Redirects

To facilitate external service access to Mediaserver8 which is on a dynamic IP, I set up a domain with dns redirect via duckdns. While this works fine for ww.mydomain.online, plain old mydomain.online was still defaulting to a GoDaddy page as the A record needs an IP address.

Recently I stumbled on this post which outlines a solution using wwwizer.com. Simply point the domain A record to their service IP address and they will 301 redirect it to whatever the www CNAME record is set to - in my case duckdns.org. Now both www.mydomain.online AND mydomain.online reach my server. Magic. And free!

The only caveat is that wwwizer don't do https, http only. I can live with that.