“What are you Syncing about?”

Greg Cooper
Dwelo Research and Development
4 min readMar 17, 2020

This is Part 1 of a series about how Dwelo software uses Twilio Sync as its IoT communications platform.

Large-scale, distributed IoT systems produce copious amounts of state data from the things that they connect together, and the task of managing that state and making it available to interested parties can be overwhelming.

As a leading provider of smart device systems for apartment communities, Dwelo needed a solution for managing the state data from its ever-growing fleet of smart hubs and the IoT devices in each apartment. In case you’re not familiar with Dwelo, Dwelo’s mission is to make living and working in rental housing more magical, efficient, and connected.

For example, with each apartment installed there are tenants who want to know if they remembered to turn off the lights, and there are property managers who need to know if the painters left the air conditioner running in a vacant unit.

To complicate this state-management picture, not every device that apartment dwellers interact with is part of the same IoT ecosystem. For instance, besides the typical array of Z-Wave devices in a residence, there are Google Nest thermostats that communicate directly with Google’s cloud, and the door that leads to the community weight room might be controlled by an access system like pdk.io. These other devices need to present themselves to end users as a cohesive whole.

Finally, the Dwelo data lake is another important consumer of IoT state. Knowing how users interact with our system allows us to design product offerings that better cater to their needs. For example, our data lake tells us if commands to control devices are executing quickly, if everything is staying online, and whether or not we have door locks that are draining batteries too quickly.

So What’s the Problem?

In the past month alone, over 15,000 American renters interacted with 200,000 smart devices in ~30,000 Dwelo-installed apartments in over 100 cities.

With so many devices communicating using different protocols, the great challenge is to manage what state each device should be in at any given time, and what state it actually is in. Furthermore, what happens if a device is temporarily offline when a command is sent to it, or there is some communication disruption getting a response? How do we make the state for a Z-Wave thermostat look like the state for a Nest thermostat so that end users don’t have to think about them differently? And how do we change the state of each device when we control them with so many different protocols

Enter Twilio Sync

At Dwelo, as we researched offerings that would help us manage system state, we found that the Sync platform, created by cloud communications provider Twilio, provided the kind of cloud-based, state-synchronization tools that we needed.

Twilio Sync is a communications platform that provides real-time, millisecond-level state synchronization between IoT devices, and mobile or browser apps. State is persisted in the form of documents in the Sync cloud, and updates to those documents are automatically synchronized between clients.

For security, the platform provides fine-grained access control for each document. This allows us to place precise controls on what our end users have access to.

Photo by Jonas Leupe on Unsplash

A Single Source of Truth

With Sync in our arsenal, the Sync cloud becomes our single source of truth for every device.

Each Z-Wave device produces state data that is first passed to the Dwelo hub, and then is ingested by the Twilio Sync cloud. Third-party IoT devices pass state to their respective clouds, and then that state data is ingested by the Sync cloud.

On the other side of the Twilio Sync cloud lie the Dwelo cloud and clients. Our cloud services use the reported state to update user interface elements, raise alerts, trigger new events, and analyze data patterns and customer usage behavior. All of these capabilities are fueled by the Sync engine’s rapid notification system.

All told, the IoT devices in Dwelo communities send millions of events to the Sync cloud every single day from a cloud managed entirely by Twilio. We’ve tested their claim of “millisecond-level state synchronization” and can happily report that their cloud backs-up that claim. We generally see round-trip times from our cloud to a hub, and then the hub response back to our cloud take between 300–500 milliseconds.

In part 2 of this series, we’ll share details of the interaction between our IoT devices and Twilio Sync, and the interaction between the Dwelo Cloud and Twilio Sync.

For a more expansive introduction of the Dwelo solution, please watch this recent presentation by Dwelo CTO, Karen Sun, at Twilio’s Signal conference.

To read more about our hub Rust software stack, check out our series on migrating to and deploying Rust!

--

--