Introduction to Automation

Introduction to Automation

A home automation system is a collection of smart devices and a Hubitat ElevationĀ® hub. The objective of the system is to provide automatic control of various devices in the home based on events and conditions. This introduction explains the structure of the system and the way that it operates. Understanding these concepts is essential to being able to design your own home automation system.

Events

An automation system is "event driven". The devices in your home automation system regularly generate events. An event is simply a small message a device or the hub sends out. For example, when you turn on a smart switch, it sends out an event reporting that it was turned on. One way to think of the automation system is that there is a constant stream of events. The role of the hub is to make sense out of this stream of events and to cause things to happen in the system.

An "automation" is a very small computer program that responds to events to cause something to happen. For example, an automation could respond to the event of a door contact opening by turning on a porch light. These "automations", or "rules", make up the brains of the home automation system, making it "smart".

Of all of the events occurring in the system, each automation is only interested in a few specific ones. To avoid having to process every single event, each automation "subscribes" to the ones it is interested in. Our example porch light automation subscribes to the events from the door contact sensor; it doesn't care about any other events. Its job is to turn on a light when that contact opens. Each automation in a system has subscriptions to the events it is concerned with. The hub's job is to send each automation just those events that the automation has subscribed to.

There are four basic types of events: device events, time events, hub events, and network events. Device events are generated by the smart devices in the system, like the door contact sensor reporting 'open'. Time events are generated by a scheduler in the hub for things like sunrise, 5:00 PM, etc. Hub events are special events that the hub generates; for example the hub generates an event when it starts up. Network events are messages that come to the hub from the LAN or internet. Some devices use the LAN to send events, some use Z-Wave or Zigbee radio signals.

For every device event or network event to be processed so that an automation can respond to it, there must be a "driver" in the system. For example, a driver would receive a message from the Zigbee radio network sent by the door contact, and convert it into an event. Each smart device in the system has a corresponding driver installed in the hub. The hub serves as the traffic cop, forwarding device events to automations.

Automations

As mentioned above, an automation is a small app that runs on the hub. It's purpose is to respond to events by causing actions. Every automation has these two elements: the events that provoke it to act, and the actions if performs as a consequence.

Some automations are very simple. The one described where opening a door causes a light to turn on is very simple. We may want it to be more sophisticated. Suppose we only want the porch light to turn on when the door opens at night, not during the day. To accomplish this, the automation will need more than just the events and the actions -- it needs to evaluate conditions. Based on this evaluation of conditions, it may or may not do some action, or perhaps it will do different actions depending on the conditions. For our porch light automation, we want our rule to test what time it is, and decide based on that whether or not to turn on the light.

Now, we have a complete picture of what an automation is: It responds to events, evaluates conditions and then takes actions based on the conditions. All automations have this general form.

Rule Machine 5.1

Rule Machine 5.1 is a built-in app in Hubitat ElevationĀ® that can be used to create automations. Each rule created with it has the described form, with Trigger Events and Actions, and the Actions can have conditions to be evaluated as part of deciding what the automation does.

31 Likes