First, yes I’m bored, It’s raining outside, I’ve installed all the sensors, switches and outlets I have at the time, so I’m drinking a beer and thinking. So please forgive if this rambles on a bit.
I’ve come to a realization that I want to share about the Internet of Things and how what we are doing fits into the term. There are many companies out there that offer some type of connectivity to their products all flocking to the IoT banner. That number is growing every day as evident by the number of new platforms being introduced to HomeAssistant with each release. What strikes me about these is that these companies are understandably focused on their product controlling other devices. I believe this is a backwards way to look at IoT.
Consider yourself a light bulb. All you know how to do is turn on or off. You do not know anything about the rest of the world. The motion sensor across the room sees motion and all he knows to do is tell you to turn on. The temperature sensor in the hall notices that the heat is up, and tells you to turn off. And finally your wife keeps yelling at Alexa telling her to dim the lights for a movie. All you, the light bulb, knows is that you are being told to turn on, turn off, dim so you do. Again and again and agin while the motion sensor, temperature sensor, and your wife fight it out. Ok maybe that’s a bad example, but I think you get the idea. Automations written from the point of view of the sensors, is like having multiple managers telling you to do different things all at the same time. This is the world the IoT vendors are giving us today. Each device knows how to tell you what it’s state is and what other devices should do.
With HomeAssistant and AppDaemon we have the ability to write automations from the perspective of the device being controlled. This lets the device being controlled, lets call it the target, respond to multiple inputs, lets call those triggers. Now our targets listen for any triggers that impact it’s state. Using my office as an example. I have an overhead light mounted in a ceiling fan. They are each controlled independently from wall switches. I have a door sensor, a DVR, and a temperature sensor. My automation for the room used to listen for the door to open/close. If the door was open it turned on the lights. If it was closed, it turned off the lights. It was oblivious to the DVR and motion sensors (granted then I didn’t have the motion sensor yet). This caused some problems when the door was closed and wanted to turn out the lights, but the DVR wanted them on at a dimmed level. I witnessed a few light spasms caused by the door being closed when I wanted to watch a movie. By changing the perspective of my automations to be based on the light, everything made sense. Now I have an automation built around the light. The automation listens for events from the motion detector, the DVR, the door and considers the current state of the light. Based on input from all of those, it decides whether the light should be on/dim or off. My light hasn’t had any spasms since I implemented this about a week ago.
Now how does this all tie back to the Internet of Things. The devices out there today may be smart, but they aren’t wise. I don’t know if individual devices ever will be or should be. But the hubs out there need more attention. This is where HomeAssistant shines. As a hub, it talks with multiple vendors products. It gives us the ability to take into account other devices when making decisions about what a light should do. When coupled with AppDaemon and a little python code, it becomes truly awesome. One place that all hubs I have seen including HomeAssistant fall a little short is in providing a common wrapper of information to interface to. For example, my TV returns a state of ‘on’ when it’s on. My DVR returns a state of ‘playing’. My temperature sensor returns a numeric value and leaves it up to me to decide if that’s considered on or not. My motion sensor returns an 8 to indicate there is motion detected. The list goes on and on. What we need is a common wrapper of information that given some information from us, can return a consistent on/off based on the devices state. Yes we could write templates to give us that information. But wouldn’t it be nice if the hub vendors, or better yet, the device vendors gave that information to us in the interface. I think that common information wrapper is the next step in realizing the true promise of the Internet of Things where devices work together with knowledge of each other.