Rabbit Holes

Mar 31 2020

My life of late seems to be full of Rabbit holes. You know that feeling looking something up and discovering that the topic is captivating and you can't stop thinking about it. I have already spoken about the 3D printing rabbit hole that started just before the "stay home" requirement. Unfortunately, or possibly, fortunately - it depends on your point of view and/or amount of time you have available, I have run into another deep, deep rabbit hole of home automation.

Back in the day, home automation was based on something called X10. It was a product that worked over the house "mains" - the 120-volt power lines. That was it for many years and some embraced it, however, it never really took off.

Over the years there has been an increased interest in home automation and you have seen new products come into the market that was once used in industrial automation - again these products never really took off.

Then a company in China, Expressif, developed a tiny little chip called the ESP8266 - and it all changed. The chip allowed little things to be connected to Wifi and controlled via commands over the internet. BOOM! This was way back in 2015 and within a year or so, the chip was available on little boards for under $3 delivered from China. I know - I bought several.

What also helped, was the development of the Arduino board out of Italy. The boards and surrounding eco-system taught a new generation of developers how to make things work via the internet. You know it as the "Internet of Things" - IOT.

So why did the ESP8266 explode the Home Automation space? The ESP8266 could be programmed the same way an Arduino could! WOW!

The last piece of the puzzle is the ability of China to make things - and they did - they placed ESP8266 in devices that could be controlled via your phone. Lights, Cameras, Switches, and many other items.

You can see how this Rabbit Hole is so big. To bring the discussion closer to home, I was given two generic switches as a Christmas gift from my daughter and her husband. They worked as expected, but you could only use your phone to control them - or to be more specific - you needed the cloud to control them. While I do understand the concept of the cloud, I would prefer to control my world, not rely on a third-party and the required world-wide internet to boot. So how does one do that... Welcome to the rabbit hole inside the rabbit hole.

Still with me? The issue at hand is how to control these two switches using something local. So I asked the vendor if they provided a way to do just that. The answer was no, but surprisingly, they offered a possible solution that I could check out called Tuya. What is Tuya? I will save you that diversion. Tuya is the software typically used by the vendors of ESP8266 devices. They could develop their device and configure Tuya's solution and then program the ESP8266 accordingly. All for a design fee of course. So how does this help? There are so many devices other there that someone developed a "way" (aka Hack) to reprogram these Tuya based ESP8266 so we can have local control of the device. It's called "tuya-convert" (Info here) and it allows you to place a new binary image on the device.

Enter Tasmoto - the binary image of choice. Welcome to the rabbit hole inside the rabbit hole, inside the rabbit hole. Tasmoto is a replacement binary image that can be flashed onto an ESP8266 in the same way you use Arduino IDE to program the ESP8266. More info on Tasmoto here. Now you can tweak the program or use one of many pre-compiled binaries - all depends on the device to be programmed. Depending on a series of factors, just how you gain access to program the ESP8266 varies. As for the two switches I had -- it was simple. Tuya-convert worked and I updated the two switches in under 30 minutes and I took my time!.

One of the mainstays of the Tasmoto environment is the use of MQTT - or Message Queue Telemetry Transport. This a communication standard developed by IBM back in 1999 and has slowly evolved as a defacto message communication standard for IOT devices. MQTT requires that a single platform will act as the hub or "broker" of all messages. An individual device talks to the broker and the broker will forward the message to all that have shown an interest. The broker will forward messages of interest to the IOT device, thus the IOT device talks solely to the Broker for all messages - no one else -- simple and straight forward. I would call this another rabbit hole but that seems obvious by now.

I can control the Tasmoto devices by sending a specially formatted MQTT message to the broker. Tasmoto tells the broker that it is interested in certain messages at startup - this is called subscribing to a message or messages. There are several tools available to help such as the Tasmoto Device Manager.

I can also use Home Assistant to send messages via MQTT to the Tasmoto devices. What is Home Assistant you ask -- another rabbit hole of course -- for tomorrow!


Total: 0 Comment(s)
Previous Posts
Rabbit Holes
3/31/2020 9:00 PM | Paul (Admin)