Skip to content

Navigation Menu

Sign in
Sign up

Communication Details

Max Isom edited this page Feb 5, 2019 · 3 revisions

Properties

Every devices has a devId as well as a gwId. The devId is usually the same as the gwId, but may not be in some cases (when a controller acts as a hub for multiple devices).

Every devices has a JSON interface for getting and setting properties. These properties are represented as an object with string keys. The object is named dps. For example:

{
 dps: {
 '1': true,
 '2': 0 
 }
}

Get State

To get the state of a device, send a payload of { gwId: '<gwId>', devId: '<devId>' } to the device with the appropriate command byte.

Set State

To set the state, send a payload with the following structure (where the dps key contains the intended state):

{
 devId: '<devId>',
 uid: '',
 t: '<seconds since epoch>',
 dps: {
 '1': true
 }
}

Again, use the correct command byte.

Broadcasts

Devices send a UDP packet at a regular interval to the network's broadcast address on port 6666. The packet contains their devId as well as their IP.

Packet Details

Get requests are not encoded. Set requests, however, are required to be encoded.

  • Prefix: 0x000055aa00000000000000
  • Command byte (32 bits): refer to table
  • Payload length (32 bits): length of (encoded) payload
  • Payload: the actual data
  • CRC (32 bits): the payload checksum. Devices don't seem to care about this, so it's possible to just use 0x00000000.
  • Suffix: 0x0000aa55
{
 int32_t prefix
 int32_t version // reasonable assumption
 int32_t command // probably, though likely multiple fields here
 int32_t payloadSize // a 32bit payload is potentially huge, so there could be other fields here
 char[] payload
 int32_t crc // everything through the payload, be sure to include the prefix
 int32_t suffix // essentially the marker to know that we can consider parsing another message
}

Clone this wiki locally

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /