Skip to main content

Overview

Device state is organized into named containers called buckets. Each bucket has an object_key, object_revision, and object_timestamp. All communication between device and server is framed in terms of buckets.

Object Key Format

{type}.{identifier}
Examples:
  • device.09AA01AB12345678 — device bucket for serial 09AA01AB12345678
  • shared.09AA01AB12345678 — shared bucket for the same device
  • structure.abc123 — structure bucket for a home
  • user.homeassistant — user bucket for pairing
The type prefix determines how the device processes the data. The identifier is usually the device serial number but varies by bucket type (e.g., structure IDs, user IDs).

Revision and Timestamp

Every bucket tracks two versioning fields:
FieldTypePurpose
object_revisionint32Monotonically increasing write counter
object_timestampint64Milliseconds since Unix epoch — primary sync authority

Sync Rules

Timestamp is the sole authority for determining which data is newer:
ConditionResult
server_timestamp > device_timestampAccept server data
device_timestamp > server_timestampKeep local data (server data is stale)
Timestamps equal, server_revision > device_revisionAccept server data
Timestamps equal, server_revision ≤ device_revisionKeep local data
server_timestamp = 0Sentinel: server has no data — device should upload its state

Zero Timestamp Sentinel

A timestamp of 0 signals “no data exists.” When the device receives object_timestamp: 0, it treats this as an invitation to upload its current local state via PUT. This happens after device reset or server-side data deletion.

Conditional Writes

Most buckets use base_object_revision in PUT requests — informational only, no validation. One exception: The shared bucket uses if_object_revision — a conditional write guard. If the revision doesn’t match the server’s current revision, the server should reject the write. This prevents the device from overwriting a temperature change the server pushed while the device was preparing its PUT.

All 28 Bucket Types

BucketObject KeyDirectionPriority
devicedevice.{serial}Bidirectional (restricted)Essential
sharedshared.{serial}BidirectionalEssential
structurestructure.{structureId}Server → deviceEssential
useruser.{userId}Server → deviceEssential
scheduleschedule.{serial}Bidirectional (guarded)Essential
wherewhere.{whereId}BidirectionalSecondary
messagemessage.{messageId}BidirectionalSecondary
linklink.{linkId}Server → deviceSecondary
custom_schedulecustom_schedule.{id}BidirectionalSecondary
device_alert_dialogdevice_alert_dialog.{id}Server → deviceSecondary
hvac_partnerhvac_partner.{partnerId}BidirectionalSpecialized
topaztopaz.{topazId}Server → deviceSpecialized
kryptonitekryptonite.{sensorId}BidirectionalSpecialized
servicegroupservicegroup.{id}Server → deviceSpecialized
occupancyoccupancy.{serial}Device → serverSpecialized
demand_responsedemand_response.{id}BidirectionalSpecialized
demand_response_eventdemand_response_event.{eventId}BidirectionalSpecialized
utilityutility.{id}Server → deviceSpecialized
diamond_sensor_configdiamond_sensor_config.{id}Server → deviceSpecialized
diamond_sensor_eventdiamond_sensor_event.{id}BidirectionalSpecialized
rate_planrate_plan.{id}Server → deviceSpecialized
toutou.{id}BidirectionalSpecialized
demand_chargedemand_charge.{id}Server → deviceSpecialized
demand_charge_eventdemand_charge_event.{eventId}BidirectionalSpecialized
rcs_settingsrcs_settings.{id}BidirectionalSpecialized
cloud_algocloud_algo.{id}BidirectionalSpecialized
diagnosticsdiagnostics.{id}BidirectionalSpecialized
tuneupstuneups.{id}BidirectionalSpecialized
Direction key:
DirectionMeaning
Server → deviceServer pushes on subscribe; device never sends in PUT
Device → serverDevice sends via PUT; server stores
BidirectionalBoth sides read and write (some have per-field restrictions)
For most home server implementations, only the essential buckets need active handling: device, shared, structure, user, and schedule.

Write Protection

The device bucket has 113 device-only fields that the server cannot write. If you push a value for one of these fields, the device compares it against its local value and if different, re-sends its own value in the next PUT — actively overwriting your change. Accept these re-PUTs normally. Do not try to fight them. See device bucket for the full list.

Merge Strategy

  • Subscribe responses (server → device): Shallow merge — device applies the fields in value to its local state
  • Schedule bucket: Full replacement — always push the complete schedule JSON
  • PUT requests (device → server): Inline merge — data fields mixed with metadata at the top level