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.