Automating the Nespresso Coffee Machine Part 3

Architecture 

screen-shot-2016-12-24-at-12-27-08-am

Step 1: 

Follow the steps in my previous blog entry to connect the Nespresso machine to the internet using particle photon and a servo.

Step 2: 

Now we build an API.AI agent to handle the natural language request translation, this would require building an agent and training it to understand the requests and how to translate them.

Create Agent

Each agent should have a specific domain, in our case the agent’s domain will be home automation.

screen-shot-2016-12-23-at-1-30-21-pm

Create new Intent make.coffee

The intent is the action flow for the agent, it will include the agent training set and the expressions it is to expect and the parameters it expects to gather before invoking an action. In our case the device to use and whether to warm the device or actually make the coffee.

Create Entities 

Here we create the entities (also serve as parameters) that the intent will use.

I defined two abstract entities, device and action.

I then created 1 device instance :Coffee machine and listed all the synonyms i usually use to refer to it.

Two actions were then defined : Warm and make, also with all the synonyms usually used to refer to them.

This slideshow requires JavaScript.

Configure intent make.coffee

Now we go back to the intent and add the user expressions (commands) I added some expressions such as :

  • can I have some coffee please
  • heat up the Nespresso machine
  • prepare the Nespresso machine
  • make me some coffee please

Make sure that the entities are mapped in your expressions. If not you can click on any of the terms and manually map it to the correct entity.

expressions

The next step is to define the required parameters for the actions, scroll to the actions section and expand it and add the required entities, in this case we have two required parameters : Device and Action. Also add what should the agent prompt the user if a parameter is missing. For instance you an ask the user for action if it was not picked up from the initial interaction or the device if it was not mentioned.

Fill the action field with a name that can be used by the backend code to execute the user’s request such as : coffeemachine, this will be used by our backend to understand how to execute it along with the parameters.

actions_required.png

entities_Action_prompt .png

 

Scroll down to the full filment section and tick the use webhooks checkbox.

enable_fulfilment-in-entnty

Response

Go to the response section and add a response such as : “working on it.” This will later be replaced by the webservice response, or if the service timed out.

Test Your agent

In theory the agent is ready now to translate requests so its time for some QA, the test scenarios you should try are a fully completed request and a partial request to check whether the more info question prompt would be triggered or not.

The JSON interpretation of the request should include in the result object the request interpretation in this case

Action ->  warm

coffee_machine ->  coffee machine

This slideshow requires JavaScript.

Integrate with FB chat 

This will allow you to talk with your bot through facebook chat. Follow the steps here-> How to link api.ai with FB chat.

Step 3 :

In this step we  set up the webhook endpoint that this agent is going to use as a back end

Go to the fulfillment tab and fill in the url as acquired while building the hook.io service (part2).

Now you are ready to go, test your bot again and you should get your coffee made for you.

Advertisements

Automating the Nespresso Coffee Machine part 1

I like drinking coffee first thing in the morning, however preparing coffee in the early morning is not something I’m a big fan of, so I decided to use my particle photon to automate the coffee making process. Thus turning my normal Nespresso machine to an IoT enabled machine.

The steps for this build are quite simple, it requires the following components :

  • Particle Photon
  • Servo
  • Power Bank
  • Paper Clip
  • Rubber Band
  • Velcro Tape

To build it connect the Servo to the photon, noting that the data pin must be connected to one of the PWM enabled pins, in my build I used Pin D0.

Use the paper clip to twist and attach on the servo keeping it in place using the rubber band, this serves as the push rod that’ll press on the coffee maker’s button.

wp-1482139836728.jpg

Attach the servo to the Nespresso machine using velcro and tape, you’ll need to adjust the servo angles on the code to work with your machine and how the servo is attached to its body.

Connect it to IFTTT service and enjoy your coffee, Personally I then created a DO button on my phone to press the first thing in the morning.

Continue reading

Toxic Technology Behavior

Over my career I observed this behavior in more than one company; the only difference between one company to another is how prevalent this behavior is. Its a cancer that slowly spreads in the company kicking out all the none toxic behavior until the entire organization seizes and productivity drops to zero.

 

  1. Always create a dependency on someone else.
  2. Always leave an open action item pending on someone else.
  3. Make sure to include as many people into the project as possible. i.e. Generally speaking if a project includes more than 10 people it comes to a stand still.
  4. Raise open ended questions to external parties with little or no background on the project on hand. ex: looping in security team/compliance.
  5. Make sure that the last email in the chain is not addressed to you.

The main directive here is to make sure that the project is always late, because of other people of course, and is not delivered. The product of an undelivered project can not be assessed and the more critical it becomes with delay the importance of the people handling it increases.

The worst thing about this toxic behavior is how the number of people practicing it seems to increase exponentially, with the good employees either turning or simply leaving the organization.

Digital Telecoms Explained

Digital is the new frontier in the telecom industry with digital transformation projects becoming a commonality among telcos, but what exactly is a digital telecom ?

A good starting would be defining what is NOT a digital telecom, A telecom that requires direct interaction between customers and its employees can not be classified as a digital telecom.

A telecom that requires direct interaction between the user and its employees can not be classified as a digital telecom.

A digital telco is a telco that allows customers to enjoy the service without having to think or deal with the telco itself. In the digital world a service provider biggest differentiator is being invisible. Digital telcos don’t try to improve the quality of their call centers they eliminate them all together.

Call centers have no place in the digital services era. The services offered to the customer should be built from the ground up to cater for self-service, customers shouldn’t need anybody to help them complete certain tasks, CallCenters were created in a time when the technology fell short from achieving true customer autonomy certain tasks were simply too hard to automate and thus required that human touch.

creativeadvertisements10

Too hard to automate? have someone do it

Technology has gone a long way since these days and digital experiences are now possible and accessible. A good example of a digital experience is gmail, it requires little effort from the user with minimal friction with the service provider, gmail users rarely if ever require any support from Google, there is little a user can’t do online using few clicks.

Digital telcos are typically cheaper to run and operate as most of the operational expenses are minimized or even eliminated, this allows for cheaper rates and affording a higher customer acquisition cost (as in pampering potential customers). Digitizing the user end experience can be conducted by focusing on the following fronts:

  1. Online :
    • No interaction with employees should be required, Everything should be available online.
    • The sale process should be offered online with most of the sales happening through the online channel.
  2. Mobile :
    • Customers should be able to fulfill all of their needs using their devices, no task should be too hard or too complicated to be conducted using the customer’s mobile device. This requires building everything from the ground up with that in mind, customer’s should be able to see his account information, buy services, even terminate his line using his device.
    • The entire experience should be contained within a single application, even when the customer transitions to a web-shop this should be done transparently and offering a consistent look and feel.
  3. Digital Store :
    • Since most of the sales is targeted to be conducted online the digital store should be in the center of the customer experience.
    • Drawing from the accumulated knowledge by eCommerce sites such as amazon and ebay to offer the customer a truly tailed experience based on his usage history and segmentation.
  4. Social:
    • Social networks can be seen as a platform rather than websites, value can be derived by building on top of them.
    • Social promos can be created (such as Member Get Member promos) to motivate users to organically share their experience with the product.

A good example of a digital telco is the company I’m currently engaged with, feel free to check out the experience we are offering http://www.Jawwy.sa

Delivery PipeLine Approach (CoD)

Usually there are many projects waiting in the delivery queue, in most cases the HiPPO method is what determines their relative priority and thus the order they are implemented in. Pet projects take precedence on potentially more important changes, with no consideration to the financial impact especially given how illusive it is to measure the financial impact of unrealised projects.

cartoon-hippo-clipart-1

HiPPO

According to the Lean Enterprise, the biggest two risks to any IT projects are: Projects getting cancelled halfway through and Delivered projects to be shelved and never used. Based on my experience both are quite common, perhaps because of the aforementioned project prioritisation methods.

The Cost of Delay method (CoD) is an analytical approach that can help prioritise projects based on a measurable metric that can be understood by business. Simple, perhaps simplistic even yet it is much more scientific than the HiPPO approach.

CoD works as follows (and I’m using an example from the Lean Enterprise book), first each project is assigned a cost of delay value, for instance Project A which is a compliance project would entail a penalty of $250k per week of none compliance. Project B introduces a new sales method which is expected to bring in $100k per week. There are three options: A is implemented first, B implemented first, A&B are implemented concurrently.

 

Screen Shot 2016-08-27 at 9.34.53 PM

Scenario 1: If A is implemented first , the cost of delay incurred by delaying B is $200k.

Scenario 2: If B is implemented first, the cost of delaying A is $250k.

Scenario 3: If A&B are concurrently implemented with the resources split between them, the cost of delay is $350K

Based on this the decision is easy, implementing A first has a lower CoD hence it is the best choice to go for. An objective rational decision that doesn’t rely on personal preferences of product owners.

Real life scenarios are more complicated, as calculating the CoD for a project often includes many factors some of which are not foreseeable, Furthermore the CoD is often not constant over time and risk might increase overtime with increase in sales. Even more interesting projects are often not independent and delaying one project might result in a chain of events incurring unpredictable costs.

CoD is not perfect yet it is provides an economical, analytical way to prioritise projects within a complex pipeline.

 

 

 

Downloading Torrents Remotely

I’ve set up a home server and wanting a simple straight forward way to download torrents remotely I relied on an old hack I’ve heard about but never attempted. You can configure transmission the torrents client to pick up torrents files from a certain directory, sharing this directory on google drive means that you can drop torrent files for transmission to download for you at home.

Screen Shot 2016-03-15 at 4.21.56 PM.png

The problem is you can’t really monitor the progress of the torrents and some of these torrent files may not even start. So I decided to write a small shell script that monitors two events and updates me through push bullet, the first event being the torrent download start (creation of a *.part file) the second event is the completion of the download (new file in the downloads directory).

The script works as follows:

Screen Shot 2016-03-15 at 4.15.30 PM.png

 
#!/bin/bash
partsLocation=<DOWNLOADS LOCATION HERE>
completeLocation=<COMPLETE LOCATION HERE>
logLocation=./TorrentsMonitor.log
pushBulletAPI=<PBAPI KEY HERE>

for i in $(find $partsLocation -name "*.part" -maxdepth 1|sed -e "s/ /_/g");
do 
echo "Handling File"
echo $i;
echo "----------------------"

#apply check here if file exists
countOfParts=$(cat parts.log|grep $i|wc -l)
echo $countOfParts
if [ $countOfParts -gt 0 ]
then 
echo "already listed"
else 
echo "new file, adding to parts.log"
echo $i >> parts.log
curl -u $pushBulletAPI: https://api.pushbullet.com/v2/pushes -d type=note -d title="Tor Started" -d body="Download started for file $i"
fi
done

#-------------------------
#scan for complete files
#-----------------------------

for i in $(find $completeLocation ! -name '*.part' ! -name '*.log' ! -name "*.sh*" ! -name "." -maxdepth 1|sed -e "s/ /_/g");
do 
echo "Handling File"
echo $i;
echo "----------------------"
#apply check here if file exists
countOfComplete=$(cat complete.log|grep $i|wc -l)
echo $countOfComplete
if [ $countOfComplete -gt 0 ]
then 
echo "already listed"
else 
echo "new file, adding to complete.log"
echo $i >> complete.log

curl -u $pushBulletAPI: https://api.pushbullet.com/v2/pushes -d type=note -d title="Tor Completed" -d body="Download Completed for file $i"
fi
done