asopi tech
asopi techIndie Developer

Asopitech With · Smart home hub

SmartThings with Alopex DB & Alopex Skulk

SmartThings is a smart home service that connects lights, sensors and appliances in one app. What would it look like built on Alopex DB and Alopex Skulk?

Updated: Oct 12, 2026

What the service does

A SmartThings-like smart home service connects, controls and automates lights, sensors, smart plugs, cameras, thermostats and appliances from one app. A hub connects the devices in the home and runs automations such as turning on lights when motion is detected. The data is the layout of devices and rooms, automation rules, and time series of device states and sensor readings.

Where the data lives

  • Alopex DB on the hub: homes, rooms, devices, scenes and automation rules live in tables. Rule conditions go in a JSON column.
  • Skulk on the hub: sensor readings such as temperature, power and motion are appended to Skulk, tagged by device and room. The recent average room temperature comes from time-bucketed aggregation.
  • Alopex DB cluster in the cloud: the device layout of each home and usage summaries are gathered in the cloud.

Evaluating automation rules and operating devices is app code on the hub.

Deployment

Alopex DB and Skulk are embedded in the hub. When the internet drops, automations and sensor logging in the home keep running. In the cloud, an Alopex DB cluster receives data from many homes. Nodes join and leave by agreement across the cluster, and reads are routed to the node that holds the data. The hub and the cloud handle the same shape of data with the same SQL.

Why Alopex DB and Alopex Skulk fit

Smart home data is born in the home, used there right away, and gathered in the cloud. Alopex DB and Skulk connect the small form embedded in a hub to an Alopex DB cluster in the cloud, with the same shape of data.

See it in code

Home, rooms, devices and automations live in Alopex DB (sensor time series in Skulk). Just the core of counting devices per room.

import alopex

# 家・部屋・機器・自動化は Alopex DB(センサーの時系列は Skulk)
db = alopex.Database.open("smartthings.alopex")

db.execute_sql("CREATE TABLE IF NOT EXISTS rooms (id INTEGER PRIMARY KEY, name TEXT)")
db.execute_sql("""
    CREATE TABLE IF NOT EXISTS devices (
        id INTEGER PRIMARY KEY,
        room_id INTEGER,
        kind TEXT,
        state TEXT
    )
""")

for rid, name in [(1, "居間"), (2, "玄関")]:
    db.execute_sql("INSERT INTO rooms (id, name) VALUES (?, ?)", [rid, name])
for did, room_id, kind, state in [(1, 1, "light", "on"), (2, 1, "sensor", "idle"), (3, 2, "lock", "locked")]:
    db.execute_sql("INSERT INTO devices (id, room_id, kind, state) VALUES (?, ?, ?, ?)", [did, room_id, kind, state])

# 部屋ごとの機器の数を集計する
for row in db.execute_sql("""
    SELECT r.name, COUNT(d.id) AS devices
    FROM rooms AS r
    JOIN devices AS d ON d.room_id = r.id
    GROUP BY r.id, r.name
    ORDER BY devices DESC
"""):
    print(row["name"], row["devices"])

The layout is aggregated and filtered with SQL. The sensor-value time series is appended by Skulk with tags, and the hub and the cloud cluster share the same SQL.

Alopex DB and Alopex Skulk in the hub, with an Alopex DB cluster in the cloud, connect the smart home through the same SQL. Give it a try starting from a single hub.