Skip to main content

blaeckpy 1.0.0

Frames​

B7 — Device List (0xB7)

The board and its sub-devices: library, command length, then per device its ID, parent, flags, state, names and signals.

ElementSizeTypeDescription
LibNamevariablestringLibrary name
LibVersionvariablestringLibrary version (e.g., "1.0.0")
CommandPayloadMax2 bytesuint16Longest command the device can receive: the characters between < and > as sent, the #id: prefix and percent-encoding included. 0 = not advertised
DeviceCount1 byteuint8Number of device entries in the frame: 1–255, the board plus its sub-devices
DeviceID1 byteuint80 = the board; 1–254 = a sub-device. 255 is reserved
ParentID1 byteuint8DeviceID of the device it sits below. 0 for the board itself and for every sub-device (one level)
DeviceFlags2 bytesuint16Which optional fields follow the versions, one bit each. All bits reserved and sent as 0
DeviceState1 byteuint8Bit 0 NotResponding (marked missing now); bit 1 Restarted (a restart not yet reported to a host). Bits 2–7 reserved, 0
DeviceNamevariablestringDevice name. Not empty, no control characters, and unique on the board: no two devices, the board included, share a name
HWVersionvariablestringHardware version
FWVersionvariablestringFirmware version
OptionalFieldsvariablestringOne null-terminated string per bit set in DeviceFlags, in bit order. None are defined yet
SignalCount2 bytesuint16Number of signals the device logs; that many SignalName, SignalUnit and DTYPE groups follow
SignalNamevariablestringSignal name. Not empty, unique among the signals of its device, no control characters
SignalUnitvariablestringUnit of the signal's values, such as V, mA or °C. Empty for none. No control characters. Use the spelling Home Assistant uses, so a host can convert between units
DTYPE1 byteuint8Datatype code (0x00–0x0B). See Datatypes
CRC324 bytesuint32Integrity checksum over the unescaped bytes from the message key to the last field. Every frame ends with it. See CRC32

D3 — Data (0xD3)

Signal values with SchemaHash, 8-byte Timestamp, and CRC32.

ElementSizeTypeDescription
FrameFlags1 byteuint8Bit 0 = first frame after restart. Bit 1 = answers BLAECK.WRITE_DATA. Bit 2 = includes a host-interval report, also when mixed with change reports. Bits 1 and 2 never both set; explicit writes and change reports leave both clear. Bits 3-7 reserved, sent clear. Test the bits; do not compare the byte
SchemaHash2 bytesuint16CRC-16/XMODEM over the signal list of the Device List. See Schema Hash
TimestampMode1 byteuint80 = none. 1 = micros: microseconds since the device started; it never wraps and never goes back, except at a restart, where it begins again near 0 and FrameFlags bit 0 is set. 2 = UNIX: microseconds since 1970-01-01 00:00:00 UTC, without leap seconds, as the device's clock tells it; it may jump when that clock is set
Timestamp648 bytesuint64Conditional: only if TimestampMode > 0
SignalIndex2 bytesuint16Zero-based signal index, counted across all devices in Device List order
DATAvariableraw bytesSignal value, size per DTYPE. Fixed width except DTYPE 0x0A, which is length-prefixed
CRC324 bytesuint32Integrity checksum over the unescaped bytes from the message key to the last field. Every frame ends with it. See CRC32

C1 — Device Notification (0xC1)

A device restarted, stopped responding, or responds again.

ElementSizeTypeDescription
DeviceID1 byteuint80 = the board; 1–254 = a sub-device. 255 is reserved
DeviceEvent1 byteuint80x01 restarted, 0x02 not responding, 0x03 responding again. 0x00 and 0x04–0xFF reserved
CRC324 bytesuint32Integrity checksum over the unescaped bytes from the message key to the last field. Every frame ends with it. See CRC32

A5 — Command Ack (0xA5)

Outcome of a dispatched command. The header MessageID echoes the message id the command carried in its # prefix, or 0 when it carried none; the hashes then say whether the bytes arrived as written.

ElementSizeTypeDescription
CmdHash4 bytesuint32FNV-1a 32 hash of the command after its message id, identifying which command is acknowledged
CmdNameHash4 bytesuint32FNV-1a 32 hash of the command name alone (up to the first comma), or 0 if no name was parsed
AckStatus1 byteuint80 = accepted, 1 = rejected
AckReason1 byteuint8Reason code. See Ack Reasons
CRC324 bytesuint32Integrity checksum over the unescaped bytes from the message key to the last field. Every frame ends with it. See CRC32

90 — Entity List (0x90)

What a host shows and controls: properties, events and buttons, each entry with its DeviceID, kind and length.

ElementSizeTypeDescription
DeviceID1 byteuint80 = the board; 1–254 = a sub-device. 255 is reserved
EntryKind1 byteuint80 property, 1 event, 2 button. 3–255 reserved: a host skips an entry of a kind it does not know
EntryLength2 bytesuint16Number of bytes that follow in this entry, from its name to its last field, before escaping. DeviceID, EntryKind and EntryLength are not counted. The next entry starts right after them
EntryFieldsvariableraw bytesThe fields of the entry's kind. See Entities
CRC324 bytesuint32Integrity checksum over the unescaped bytes from the message key to the last field. Every frame ends with it. See CRC32

Property entry (EntryKind 0)

A value a host shows (a sensor) or shows and sets (an input). Kind-bound fields follow the value; optional fields follow in flag-bit order.

ElementSizeTypeDescription
NamevariablestringProperty name, as a host sends it in <Name,value>. ASCII letters, digits, _, - and . only. Unique on the board among properties, buttons and plain commands
ValueKind1 byteuint80 number, 1 bool, 2 enum, 3 text. 4–255 reserved. With the access, it is what the sketch declared: a READ number is a sensor, a READWRITE one a number input, a READ bool an on/off indicator, a READWRITE one a switch, a READ enum an enum sensor, a READWRITE one a select, a READ text a text sensor, a READWRITE one a text input
Flags4 bytesuint32Bits 0–1 = access: 01 READ, 11 READWRITE; 10 (write only) and 00 reserved. Bit 2 = hasRange, 3 = hasStep, 4 = hasUnit, 5 = hasDisplayName, 6 = hasIcon, 7 = hasDeviceClass, 8–10 = state class (0 none, 1 measurement, 2 total, 3 total\_increasing, 4 measurement\_angle), 11 = hasDisplayPrecision, 12–13 = entity category (0 none, 1 config, 2 diagnostic, 3 reserved), 14 = disabledByDefault, 15 = forceUpdate, 16–17 = input mode (number: 0 auto, 1 box, 2 slider; text: 0 plain, 1 password; 3 reserved). Bits 18–31 reserved, sent clear
DTYPE1 byteuint8Datatype code (0x00–0x0B). See Datatypes
Valuevariableraw bytesThe property's value, size per DTYPE. Fixed width except 0x0A, which is a 1-byte length followed by that many UTF-8 bytes, at most 255, as in DATA. An enum's value is its index
OptionsvariablestringEnum only, always present. Comma-separated options in index order; at least one, none blank, none with leading or trailing spaces. Each option is percent-encoded (%2C a comma, %25 a percent sign; %00 is not an escape): a host splits on the commas, then decodes, then drops outer spaces. An input accepts an index or a decoded option name, matched exactly with case
TextMaxLen1 byteuint8Text only, always present. Longest value, in bytes after percent-decoding: 0–255
RangeMinvariableraw bytesConditional: only if Flags bit 2. Lowest value an input accepts, inclusive. In the property's own type and at its width, size per DTYPE, exactly as Value. A device declares no range rather than one its variable cannot hold, so both limits always fit the DTYPE. Without bit 2 both limits are absent; do not read them as 0
RangeMaxvariableraw bytesConditional: only if Flags bit 2. Highest value an input accepts, inclusive, and above RangeMin. In the property's own type and at its width, size per DTYPE, exactly as Value
RangeStepvariableraw bytesConditional: only if Flags bit 3. The step a number input stores on, counted from RangeMin. A value within a thousandth of a step of one is snapped to it; a value further off is kept as sent. In the property's own type and at its width, size per DTYPE, exactly as Value - not widened to a float64. Widening keeps the value and loses the decimal it was written as: a step of 0.01 on a board whose double is a float is held as 0.00999999977, and a float64 carrying that exactly reads as 0.009999999776482582, from which a host counting RangeMin + n * RangeStep cannot land on 0.05. At its own width the same step reads back as the shortest decimal that names it, which is the 0.01 the sketch declared
UnitvariablestringConditional: only if Flags bit 4
DisplayNamevariablestringConditional: only if the entry's display-name bit is set. Label a host shows in place of the name. Presentation only: the name stays what a host sends and what any identity it derives is built from
IconvariablestringConditional: only if the entry's icon bit is set. Material Design Icons name (e.g. "mdi:tune")
DeviceClassvariablestringConditional: only if the entry's device-class bit is set. What the value, event or button is, in the host's vocabulary ("temperature", "door", "restart"). A name the host does not know costs that one entity, so a device declares nothing rather than guessing
DisplayPrecision1 byteuint8Conditional: only if Flags bit 11. Decimal places to display

Event entry (EntryKind 1)

A moment the device reports, with the closed list of its types.

ElementSizeTypeDescription
NamevariablestringEvent name. Not empty, unique among the events of its device, no control characters
Flags2 bytesuint16Bit 0 = hasDisplayName, 1 = hasIcon, 2 = hasDeviceClass, 3–4 = entity category (0 none, 1 config, 2 diagnostic, 3 reserved), 5 = disabledByDefault. Bits 6–15 reserved
DisplayNamevariablestringConditional: only if the entry's display-name bit is set. Label a host shows in place of the name. Presentation only: the name stays what a host sends and what any identity it derives is built from
IconvariablestringConditional: only if the entry's icon bit is set. Material Design Icons name (e.g. "mdi:tune")
DeviceClassvariablestringConditional: only if the entry's device-class bit is set. What the value, event or button is, in the host's vocabulary ("temperature", "door", "restart"). A name the host does not know costs that one entity, so a device declares nothing rather than guessing
EventTypeCount2 bytesuint16Number of EventType entries that follow; at least one
EventTypevariablestringDeclared event type, plain text (not percent-encoded), not blank, no leading or trailing spaces. Position defines its index

Button entry (EntryKind 2)

A moment a host triggers by sending the button's name.

ElementSizeTypeDescription
NamevariablestringButton name, as a host sends it in <Name>. ASCII letters, digits, _, - and . only. Unique on the board among properties, buttons and plain commands
Flags2 bytesuint16Bit 0 = hasDisplayName, 1 = hasIcon, 2 = hasDeviceClass, 3–4 = entity category (0 none, 1 config, 2 diagnostic, 3 reserved), 5 = disabledByDefault. Bits 6–15 reserved
DisplayNamevariablestringConditional: only if the entry's display-name bit is set. Label a host shows in place of the name. Presentation only: the name stays what a host sends and what any identity it derives is built from
IconvariablestringConditional: only if the entry's icon bit is set. Material Design Icons name (e.g. "mdi:tune")
DeviceClassvariablestringConditional: only if the entry's device-class bit is set. What the value, event or button is, in the host's vocabulary ("temperature", "door", "restart"). A name the host does not know costs that one entity, so a device declares nothing rather than guessing

95 — Property (0x95)

Current value of a property, written when it changes and after a host sets it. Not logged.

ElementSizeTypeDescription
PropertyIndex2 bytesuint16Zero-based position of the property among the properties of the Entity List
DTYPE1 byteuint8Datatype code (0x00–0x0B). See Datatypes
Valuevariableraw bytesThe property's value, size per DTYPE. Fixed width except 0x0A, which is a 1-byte length followed by that many UTF-8 bytes, at most 255, as in DATA. An enum's value is its index
CRC324 bytesuint32Integrity checksum over the unescaped bytes from the message key to the last field. Every frame ends with it. See CRC32

85 — Event (0x85)

One occurrence of an event, identified by its index among the events and the index of its type.

ElementSizeTypeDescription
EventIndex2 bytesuint16Zero-based position of the event among the events of the Entity List
EventTypeIndex2 bytesuint16Zero-based index into the event's EventType list
CRC324 bytesuint32Integrity checksum over the unescaped bytes from the message key to the last field. Every frame ends with it. See CRC32