ATIX #CrewDay: Rhino learns to speak!

On November 20th, 2017 it was that time again: All colleagues at ATIX AG – from consultants to developers to marketing and support – met for ATIX #CrewDay to exchange ideas and work together on various projects. Of course, these are all about LINUX & Open Source.

Of course, colleagues from marketing are not left out at #CrewDay. It is therefore important to find topics that are relevant to all departments. Against this background, a colleague had the idea some time ago to create a new host using orcharhino using voice control. A perfect project for #CrewDay! So it wasn’t a matter of waiting for long, but rather teaching our rhino to speak. Rhino? Is that a colleague at ATIX? Fast – Rhino is the “mascot” of our product orcharhino. With this, data centers can be further automated and the deployment, configuration and patch management of Linux servers can be implemented under a uniform interface.

But back to our little Alexa project: First we had to explore the available options. Option one would be to write your own Alexa skill. Variant two is the one we initially decided on: We used Node-RED as a communication mediator between Amazon Echo Dot and orcharhino. Node-RED was initially designed by IBM and is available under an open source license. This means that scenarios in the Internet of Things can be put together directly in the browser like in a modular system. In addition to Alexa, other modules are available for Google services, IRC, social media platforms and for controlling smart home devices. Another idea immediately came up: Why not build a new server using orcharhino with the help of a tweet?

After installing Node-RED using “npm” you can access it directly with the browser via http://127.0.0.1:1880. Additional modules can be searched for and installed using the “Manage Palette” via the menu on the right next to “Deploy”. Here we have added the node-red-contrib-alexa-home-skill [1] module. This module uses a server [2] on the Internet with which it communicates between Alexa and Node-RED. We actually wanted to avoid that and implement everything locally. But then we realized that other modules [3] that were content with the local network were no longer applicable. Because Node-RED, Alexa and orcharhino are not in the same network. It took a few minutes until there was successful communication between Alexa and Node-RED. We were now able to receive the first voice commands via Node-RED. The next step was to connect orcharhino.

Node-RED has a module for sending HTTP requests. The orcharhino API allows you to control almost everything via appropriate API calls. This includes creating content views, deleting compute resources and starting a deployment process for new hosts. This was done in a short time and we were able to ask Alexa to build a new host with “Alexa, rhino on” (we use rhino instead of orcharhino because we as developers know: “The spice is in brevity” 😉 ).

Now the solution for anyone who is wondering why we used “orcharhino on” as a command: This node-red-contrib-alexa-home-skill internally maps smart home functionalities such as lamp control. Therefore, the skill of syntax and voice commands is unsuitable for our use case.

But that’s only mentioned in passing, now back to the essentials:

Creating new hosts by tweeting and posting a message to an IRC channel as soon as a new host is available 🙂

The finished Node-RED flow looks like this:


To control the orcharhino API we had to define the header and the HTTPS post body. For this we used the following method:

//set headers and payload
var payload = { "host":  {
  "enabled": true,
  "compute_resource_id":"1",  
  "hostgroup_id":"1",
  "location_id":"2",
  "organization_id":"1",
  "compute_attributes": {
   "start":"1"
},
"interfaces_attributes": {
  "0":{
     "subnet_id":"1"
   }
  }
}};
// construct the result
msg.payload= JSON.stringify(payload);
msg.headers = {};
msg.headers["Content-Type"] = "application/json";
msg.headers["Accept"] = "application/json";
return msg;

After the message has been sent via “Send orcharhino HTTPS Post”, Node-RED receives the response to the HTTPS Post Request in “Set New Host Msg”. In this Javascript function we extract the name of the new host:

//Set New Host Msg
var hostname = msg.payload.match(/"name":"([a-zA-Z-.]*).stage.atix"/); 
var msg = {};

if (hostname !== null{
  msg.payload = "New Host created: " + hostname[1];
}

return msg;

In the remaining time we thought about how we could design our own Alexa skill so that we could do without the remote server and also give real commands like “Alexa, build a medium-sized host with orcharhino“. Here we had the problem again with different network segments. Unfortunately, we then ran out of time to find an adequate solution. At one of the next ATIX #CrewDays we want to take this up again and design our own Alexa skill.

What have we learned:

– voice control via Alexa is pretty good!

– Node-RED as a tool for connecting Internet of Things components is very powerful!

– it’s fun to implement unusual ideas with orcharhino!

[1] https://www.npmjs.com/package/node-red-contrib-alexa-home-skill

[2] https://alexa-node-red.bm.hardill.me.uk/

[3] https://www.npmjs.com/package/node-red-contrib-alexa-local

Amazon has set standards with Alexa and Echo (Dot). It can be assumed that our project can also be implemented with other systems such as Google Home Assistant or Apple HomePod.

What is orcharhino?

orcharhinois THE tool for automatically deploying servers in a data center, carrying out configuration management and always being up-to-date using patch management. In orcharhino, several open-source technologies are linked together to achieve the goals of automation and standardization. orcharhino offers three core functions; Deployment, patch management, configuration management and much more. Everything, of course, enterprise-grade.

The following two tabs change content below.

ATIX-Crew

Der ATIX-Crew besteht aus Leuten, die in unterschiedlichen Bereichen tätig sind: Consulting, Development/Engineering, Support, Vertrieb und Marketing.

Latest posts by ATIX-Crew (see all)