21constexpr uint8_t POSITION_PERCENT_MAX = 100;
24constexpr uint8_t EXECUTE_ORIGINATOR = ORIGINATOR_USER_REMOTE;
38constexpr uint8_t EXECUTE_ACEI =
39 (ACEI_LEVEL_USER_DEFAULT << ACEI_LEVEL_SHIFT) | (1 << ACEI_EXTENDED_SHIFT) | ACEI_VALID_BIT;
55constexpr uint8_t EXECUTE_ACEI_FORCE_OPEN =
56 (ACEI_LEVEL_PROTECTION_HUMAN << ACEI_LEVEL_SHIFT) | (1 << ACEI_EXTENDED_SHIFT) | ACEI_VALID_BIT;
83constexpr uint8_t KEY_EXTRACTION_DISCOVER_RESP_FLAGS = 0xDD;
91constexpr uint16_t KEY_EXTRACTION_DISCOVER_RESP_TIMESTAMP = 0x000E;
101constexpr uint16_t LOW_BYTE_MASK = 0xFF;
103constexpr size_t EXECUTE_PAYLOAD_SIZE = 8;
105constexpr uint8_t EXECUTE_POSITION_LAYOUT_FLAG = 0x80;
107constexpr uint8_t EXECUTE_POSITION_PROFILE = 0x06;
115constexpr uint8_t EXECUTE_PROFILE_SILENT = 0x05;
117constexpr size_t EXECUTE_SPECIAL_PAYLOAD_SIZE = 6;
121constexpr size_t PRIVATE2_LONG_PAYLOAD_SIZE = 6;
126constexpr uint8_t PRIVATE2_EXTENDED_BLOCK_FLAG = 0x80;
128constexpr uint8_t STATUS_UPDATE_ACK_PAYLOAD[] = {0x05, 0x00};
130constexpr uint8_t SET_CONFIG1_STATUS_BROADCAST_PAYLOAD[] = {0xE0, 0x10, 0x0A, 0x08, 0x00};
132constexpr uint8_t IDENTIFY_PARAMETER = 0xFF;
136inline std::array<uint8_t, EXECUTE_PAYLOAD_SIZE> make_position_payload(uint8_t acei, uint8_t position,
137 bool silent =
false) {
140 return {EXECUTE_ORIGINATOR, acei,
static_cast<uint8_t
>(POSITION_WIRE_SCALE * position), 0x00,
141 EXECUTE_POSITION_LAYOUT_FLAG, POS_FAVORITE, silent ? EXECUTE_PROFILE_SILENT : EXECUTE_POSITION_PROFILE, 0x00};
149constexpr uint8_t ONEWAY_EXECUTE_PARAMS_SIZE = 6;
155constexpr uint8_t ONEWAY_SEQUENCE_SIZE = 2;
160constexpr uint8_t ONEWAY_EXECUTE_MAC_SPAN_SIZE = 1 + ONEWAY_EXECUTE_PARAMS_SIZE;
163constexpr uint8_t ONEWAY_EXECUTE_SEQUENCE_OFFSET = ONEWAY_EXECUTE_PARAMS_SIZE;
164constexpr uint8_t ONEWAY_EXECUTE_MAC_OFFSET = ONEWAY_EXECUTE_SEQUENCE_OFFSET + ONEWAY_SEQUENCE_SIZE;
167constexpr uint8_t ONEWAY_EXECUTE_PAYLOAD_SIZE = ONEWAY_EXECUTE_MAC_OFFSET + HMAC_SIZE;
169constexpr uint8_t ONEWAY_EXECUTE_FP1 = 0x00;
170constexpr uint8_t ONEWAY_EXECUTE_FP2 = 0x00;
187void init_1w_broadcast_frame(
IoFrame &f,
const uint8_t src[NODE_ID_SIZE],
DeviceType target_type) {
190 uint8_t dst[NODE_ID_SIZE];
202bool build_1w_execute(
IoFrame &f,
const uint8_t src[NODE_ID_SIZE],
DeviceType target_type, uint8_t main0, uint8_t main1,
203 uint16_t sequence,
const uint8_t controller_key[AES_KEY_SIZE], uint8_t acei,
bool broadcast_all) {
204 uint8_t payload[ONEWAY_EXECUTE_PAYLOAD_SIZE] = {EXECUTE_ORIGINATOR, acei, main0, main1, ONEWAY_EXECUTE_FP1,
210 uint8_t mac_span[ONEWAY_EXECUTE_MAC_SPAN_SIZE];
211 mac_span[0] = CMD_EXECUTE;
212 memcpy(&mac_span[1], payload, ONEWAY_EXECUTE_PARAMS_SIZE);
218 &payload[ONEWAY_EXECUTE_MAC_OFFSET]))
221 payload[ONEWAY_EXECUTE_SEQUENCE_OFFSET] =
static_cast<uint8_t
>(sequence >> BITS_PER_BYTE);
222 payload[ONEWAY_EXECUTE_SEQUENCE_OFFSET + 1] =
static_cast<uint8_t
>(sequence);
229 return set_cmd(f, CMD_EXECUTE, payload,
sizeof(payload));
237constexpr uint8_t ONEWAY_ADD_ENC_KEY_OFFSET = 0;
238constexpr uint8_t ONEWAY_ADD_MANUFACTURER_OFFSET = AES_KEY_SIZE;
239constexpr uint8_t ONEWAY_ADD_DATA_OFFSET = AES_KEY_SIZE + 1;
240constexpr uint8_t ONEWAY_ADD_SEQUENCE_OFFSET = AES_KEY_SIZE + 2;
241constexpr uint8_t ONEWAY_ADD_PAYLOAD_SIZE = AES_KEY_SIZE + 4;
244constexpr uint8_t ONEWAY_ADD_DATA_VALUE = 0x01;
247constexpr uint8_t ONEWAY_ADD_MAC_SPAN_SIZE = 1 + AES_KEY_SIZE;
251constexpr uint8_t ONEWAY_REMOVE_DATA_OFFSET = 0;
252constexpr uint8_t ONEWAY_REMOVE_SEQUENCE_OFFSET = 1;
253constexpr uint8_t ONEWAY_REMOVE_MAC_OFFSET = 3;
254constexpr uint8_t ONEWAY_REMOVE_PAYLOAD_SIZE = 9;
256constexpr uint8_t ONEWAY_REMOVE_DATA_VALUE = 0x00;
259constexpr uint8_t ONEWAY_REMOVE_MAC_SPAN_SIZE = 2;
263bool create_no_payload_request(
IoFrame &f,
const uint8_t *own,
const uint8_t *dst,
bool low_power, uint8_t cmd) {
275 if (position > POSITION_PERCENT_MAX)
280 const auto payload = make_position_payload(EXECUTE_ACEI, position, silent);
281 return set_cmd(f, CMD_EXECUTE, payload.
data(), payload.size());
292 uint8_t main_byte = 0;
293 uint8_t modifier_byte = 0;
296 main_byte = POS_STOP;
297 modifier_byte = 0x00;
300 main_byte = POS_FAVORITE;
301 modifier_byte = 0x00;
304 main_byte = POS_FAVORITE;
305 modifier_byte = POS_VENT_MODIFIER;
319 const uint8_t extended[EXECUTE_PAYLOAD_SIZE] = {
320 EXECUTE_ORIGINATOR, EXECUTE_ACEI, main_byte, modifier_byte, EXECUTE_POSITION_LAYOUT_FLAG,
321 POS_FAVORITE, EXECUTE_PROFILE_SILENT, 0x00};
322 return set_cmd(f, CMD_EXECUTE, extended,
sizeof(extended));
324 const uint8_t payload[EXECUTE_SPECIAL_PAYLOAD_SIZE] = {EXECUTE_ORIGINATOR, EXECUTE_ACEI, main_byte,
325 modifier_byte, 0x00, 0x00};
326 return set_cmd(f, CMD_EXECUTE, payload,
sizeof(payload));
342 const auto payload = make_position_payload(EXECUTE_ACEI_FORCE_OPEN, open_position);
343 return set_cmd(f, CMD_EXECUTE, payload.
data(), payload.size());
349 uint16_t sequence,
const uint8_t controller_key[AES_KEY_SIZE], uint8_t acei,
350 bool broadcast_all) {
351 if (position > POSITION_PERCENT_MAX)
353 return build_1w_execute(f, src, target_type,
static_cast<uint8_t
>(POSITION_WIRE_SCALE * position), 0x00, sequence,
354 controller_key, acei, broadcast_all);
364 uint16_t sequence,
const uint8_t controller_key[AES_KEY_SIZE], uint8_t acei,
365 bool broadcast_all) {
373 main0 = POS_FAVORITE;
376 main0 = POS_FAVORITE;
377 main1 = POS_VENT_MODIFIER;
382 return build_1w_execute(f, src, target_type, main0, main1, sequence, controller_key, acei, broadcast_all);
390 uint16_t sequence,
const uint8_t controller_key[AES_KEY_SIZE],
bool with_mac) {
391 uint8_t payload[ONEWAY_ADD_PAYLOAD_SIZE] = {0};
398 payload[ONEWAY_ADD_MANUFACTURER_OFFSET] = manufacturer;
399 payload[ONEWAY_ADD_DATA_OFFSET] = ONEWAY_ADD_DATA_VALUE;
400 payload[ONEWAY_ADD_SEQUENCE_OFFSET] =
static_cast<uint8_t
>(sequence >> BITS_PER_BYTE);
401 payload[ONEWAY_ADD_SEQUENCE_OFFSET + 1] =
static_cast<uint8_t
>(sequence);
408 uint8_t mac_span[ONEWAY_ADD_MAC_SPAN_SIZE];
409 mac_span[0] = CMD_ONEWAY_ADD_CONTROLLER;
410 memcpy(&mac_span[1], &payload[ONEWAY_ADD_ENC_KEY_OFFSET], AES_KEY_SIZE);
412 uint8_t mac[HMAC_SIZE];
418 init_1w_broadcast_frame(f, src, target_type);
420 if (!
set_cmd(f, CMD_ONEWAY_ADD_CONTROLLER, payload,
sizeof(payload)))
428 memcpy(f.
mac, mac, HMAC_SIZE);
436 const uint8_t controller_key[AES_KEY_SIZE]) {
437 uint8_t payload[ONEWAY_REMOVE_PAYLOAD_SIZE] = {0};
438 payload[ONEWAY_REMOVE_DATA_OFFSET] = ONEWAY_REMOVE_DATA_VALUE;
439 payload[ONEWAY_REMOVE_SEQUENCE_OFFSET] =
static_cast<uint8_t
>(sequence >> BITS_PER_BYTE);
440 payload[ONEWAY_REMOVE_SEQUENCE_OFFSET + 1] =
static_cast<uint8_t
>(sequence);
444 uint8_t mac_span[ONEWAY_REMOVE_MAC_SPAN_SIZE] = {CMD_ONEWAY_REMOVE, payload[ONEWAY_REMOVE_DATA_OFFSET]};
447 if (!
crypto::create_1w_hmac(mac_span,
sizeof(mac_span), sequence, controller_key, &payload[ONEWAY_REMOVE_MAC_OFFSET]))
450 init_1w_broadcast_frame(f, src, target_type);
452 return set_cmd(f, CMD_ONEWAY_REMOVE, payload,
sizeof(payload));
464 uint8_t d[3] = {function_id, sub_index, 0x00};
465 return set_cmd(f, CMD_PRIVATE, d,
sizeof(d));
474 return create_no_payload_request(f, own, dst, low_power, CMD_GET_NAME);
480 return create_no_payload_request(f, own, dst, low_power, CMD_GET_GENERAL_INFO3);
485 return create_no_payload_request(f, own, dst, low_power, CMD_GET_INFO1);
490 return create_no_payload_request(f, own, dst, low_power, CMD_GET_INFO2);
494 const uint8_t payload[DEVICE_NAME_WRITE_PAYLOAD_SIZE]) {
498 return set_cmd(f, CMD_SET_NAME, payload, DEVICE_NAME_WRITE_PAYLOAD_SIZE);
506 const uint8_t payload[2] = {ORIGINATOR_USER_REMOTE, IDENTIFY_PARAMETER};
507 return set_cmd(f, CMD_IDENTIFY, payload,
sizeof(payload));
515 size_t payload_len) {
516 if (payload ==
nullptr || payload_len == 0 || payload_len > FRAME_MAX_DATA_SIZE)
521 return set_cmd(f, CMD_WRITE_PRIVATE, payload,
static_cast<uint8_t
>(payload_len));
530 auto const tilt_value =
531 static_cast<uint16_t
>((POSITION_PERCENT_MAX - tilt_percent) * STATUS_POS_MAX / POSITION_PERCENT_MAX);
532 uint8_t d[EXECUTE_PAYLOAD_SIZE] = {EXECUTE_ORIGINATOR,
536 STATUS_TILT_SELECTOR,
537 static_cast<uint8_t
>(tilt_value >> BITS_PER_BYTE),
538 static_cast<uint8_t
>(tilt_value),
540 return set_cmd(f, CMD_EXECUTE, d,
sizeof(d));
545 uint8_t position, uint8_t tilt_percent) {
546 if (position > POSITION_PERCENT_MAX)
552 auto const tilt_value =
553 static_cast<uint16_t
>((POSITION_PERCENT_MAX - tilt_percent) * STATUS_POS_MAX / POSITION_PERCENT_MAX);
554 uint8_t d[EXECUTE_PAYLOAD_SIZE] = {EXECUTE_ORIGINATOR,
556 static_cast<uint8_t
>(2 * position),
558 STATUS_TILT_SELECTOR,
559 static_cast<uint8_t
>(tilt_value >> BITS_PER_BYTE),
560 static_cast<uint8_t
>(tilt_value),
562 return set_cmd(f, CMD_EXECUTE, d,
sizeof(d));
574 uint8_t block, uint8_t function_id) {
578 uint8_t d[4] = {function_id, selector, block, 0x00};
579 return set_cmd(f, CMD_PRIVATE, d,
sizeof(d));
604 uint8_t d[PRIVATE2_LONG_PAYLOAD_SIZE] = {POS_UNKNOWN, 0x00, PRIVATE2_EXTENDED_BLOCK_FLAG,
605 POS_FAVORITE, modifier, 0x00};
606 return set_cmd(f, CMD_PRIVATE2, d,
sizeof(d));
608 uint8_t d[4] = {POS_FAVORITE, modifier, 0x00, 0x00};
609 return set_cmd(f, CMD_PRIVATE2, d,
sizeof(d));
617 set_dst(f, BROADCAST_DISCOVER);
619 return set_cmd(f, CMD_DISCOVER_REQ);
630 bool ack_capable,
bool payload_enabled, uint8_t payload,
const uint8_t *system_key) {
635 f.
ctrl1 |= CTRL1_ACK;
640 case CMD_DISCOVER_REQ:
641 return set_cmd(f, CMD_DISCOVER_REQ);
643 case CMD_DISCOVER_SPE_REQ: {
644 if (system_key ==
nullptr)
646 uint8_t nonce[HMAC_SIZE];
653 uint8_t hmac[HMAC_SIZE];
656 uint8_t payload_buf[HMAC_SIZE * 2];
657 memcpy(payload_buf, nonce, HMAC_SIZE);
658 memcpy(payload_buf + HMAC_SIZE, hmac, HMAC_SIZE);
659 return set_cmd(f, CMD_DISCOVER_SPE_REQ, payload_buf,
sizeof(payload_buf));
662 case CMD_DISCOVER_ALT_REQ: {
665 return set_cmd(f, CMD_DISCOVER_ALT_REQ, &payload, 1);
666 return set_cmd(f, CMD_DISCOVER_ALT_REQ);
677 uint8_t manufacturer_id) {
682 uint8_t payload[DISCOVERY_RESP_FULL_SIZE] = {0};
686 memcpy(&payload[DISCOVERY_RESP_BACKBONE_OFFSET], own, NODE_ID_SIZE);
687 payload[DISCOVERY_RESP_MANUFACTURER_OFFSET] = manufacturer_id;
689 payload[DISCOVERY_RESP_FLAGS_OFFSET] = KEY_EXTRACTION_DISCOVER_RESP_FLAGS;
690 payload[DISCOVERY_RESP_TIMESTAMP_OFFSET] =
691 static_cast<uint8_t
>(KEY_EXTRACTION_DISCOVER_RESP_TIMESTAMP >> BITS_PER_BYTE);
692 payload[DISCOVERY_RESP_TIMESTAMP_OFFSET + 1] =
693 static_cast<uint8_t
>(KEY_EXTRACTION_DISCOVER_RESP_TIMESTAMP & LOW_BYTE_MASK);
694 return set_cmd(f, CMD_DISCOVER_RESP, payload,
sizeof(payload));
725 bool low_power,
bool ack) {
731 f.
ctrl1 |= CTRL1_ACK;
754 uint8_t out_key[AES_KEY_SIZE]) {
755 const uint8_t key_init_cmd = CMD_KEY_INIT;
756 return crypto::crypt_key(&key_init_cmd, 1, challenge, transfer_payload, out_key);
768 const uint8_t key[AES_KEY_SIZE],
const uint8_t challenge[HMAC_SIZE]) {
776 uint8_t enc_key[AES_KEY_SIZE];
779 return set_cmd(f, CMD_KEY_TRANSFER, enc_key, AES_KEY_SIZE);
785 const uint8_t challenge[HMAC_SIZE],
bool start,
bool low_power) {
789 return set_cmd(f, CMD_CHALLENGE_REQ, challenge, HMAC_SIZE);
806 uint8_t challenge[HMAC_SIZE];
815 const uint8_t challenge[HMAC_SIZE]) {
823 const uint8_t challenge[HMAC_SIZE],
const IoFrame &origin,
const uint8_t *key,
824 bool end,
bool low_power) {
830 uint8_t frame_data[FRAME_MAX_SIZE];
831 frame_data[0] = origin.
cmd;
833 uint8_t hmac[HMAC_SIZE];
836 return set_cmd(f, CMD_CHALLENGE_RESP, hmac, HMAC_SIZE);
842 const IoFrame &origin,
const uint8_t *key) {
865 return set_cmd(f, CMD_NODE_VERIFY_RESP, own, NODE_ID_SIZE);
872 const uint8_t challenge[HMAC_SIZE],
const IoFrame &origin,
const uint8_t *key) {
885 return set_cmd(f, CMD_STATUS_UPDATE_RESP, STATUS_UPDATE_ACK_PAYLOAD,
sizeof(STATUS_UPDATE_ACK_PAYLOAD));
898 return set_cmd(f, CMD_SET_CONFIG1, SET_CONFIG1_STATUS_BROADCAST_PAYLOAD,
899 sizeof(SET_CONFIG1_STATUS_BROADCAST_PAYLOAD));
void generate_challenge(uint8_t out[HMAC_SIZE])
Generate 6 random bytes for a challenge using the ESP32 hardware RNG.
bool create_hmac(const uint8_t *data, uint8_t len, const uint8_t challenge[HMAC_SIZE], const uint8_t key[AES_KEY_SIZE], uint8_t hmac[HMAC_SIZE])
Create a 6-byte HMAC for authentication (proprietary IO-Homecontrol scheme).
bool crypt_1w_key(const uint8_t node[NODE_ID_SIZE], const uint8_t in[AES_KEY_SIZE], uint8_t out[AES_KEY_SIZE])
Encrypt or decrypt a 1W controller key during add-controller key adoption (CMD 0x30).
bool crypt_key(const uint8_t *data, uint8_t len, const uint8_t challenge[HMAC_SIZE], const uint8_t in[AES_KEY_SIZE], uint8_t out[AES_KEY_SIZE])
Encrypt or decrypt a system key during pairing.
bool create_1w_hmac(const uint8_t *data, uint8_t len, uint16_t sequence, const uint8_t controller_key[AES_KEY_SIZE], uint8_t hmac[HMAC_SIZE])
Create the 6-byte authenticator for a 1W frame.
bool create_force_open(IoFrame &f, const uint8_t *own, const uint8_t *dst, bool low_power, uint8_t open_position)
Build a force-open execute frame (0x00): an ordinary position command to the device's wire-scale "ful...
bool set_cmd(IoFrame &f, uint8_t cmd, const uint8_t *params, uint8_t params_len)
Set command and payload.
bool create_identify(IoFrame &f, const uint8_t *own, const uint8_t *dst, bool low_power)
Build an authenticated device-identify request (0x1E).
bool create_get_name(IoFrame &f, const uint8_t *own, const uint8_t *dst, bool low_power)
Build a get-name request (0x50).
void encode_packed_device_type(DeviceType type, uint8_t subtype, uint8_t &type_msb, uint8_t &type_subtype)
Encode a DeviceType/subtype pair into the two-byte packed metadata format used by discovery responses...
static bool create_device_terminal_ack(IoFrame &f, const uint8_t *own, const uint8_t *dst, uint8_t cmd)
Build a bare device→hub terminal acknowledgement: no payload, END set, START and LOW_POWER clear.
bool create_get_status(IoFrame &f, const uint8_t *own, const uint8_t *dst, bool low_power)
Build a get-status request (0x03). The device responds with its current position.
bool create_set_name(IoFrame &f, const uint8_t *own, const uint8_t *dst, bool low_power, const uint8_t payload[DEVICE_NAME_WRITE_PAYLOAD_SIZE])
Build an authenticated set-name request (0x52) using a fixed zero-padded Latin-1 payload.
bool create_write_private(IoFrame &f, const uint8_t *own, const uint8_t *dst, bool low_power, const uint8_t *payload, size_t payload_len)
Build a generic CMD_WRITE_PRIVATE (0x20) frame around a caller-supplied payload — the one builder beh...
DeviceType
Device type identifiers reported by IO‑Homecontrol products.
@ UNKNOWN
Unknown/unspecified device.
void encode_broadcast_address(DeviceType type, uint8_t out[NODE_ID_SIZE])
Encode a device type into its typed-broadcast destination address — the exact inverse of broadcast_ta...
bool create_node_verify_resp_device_role(IoFrame &f, const uint8_t *own, const uint8_t *dst)
Build an address response (0x37) — device side, used only by the key-extraction responder.
bool create_private2_read(IoFrame &f, const uint8_t *own, const uint8_t *dst, uint8_t modifier, bool long_form, bool low_power)
Build a CMD_PRIVATE2 (0x0C) request in either of the two field-observed shapes.
bool create_discover_resp(IoFrame &f, const uint8_t *own, const uint8_t *dst, DeviceType type, uint8_t subtype, uint8_t manufacturer_id)
Build a discovery response (0x29) — device side, used only by the key-extraction responder.
CoverCommand
Named device commands for cover-type actuators.
@ FAVORITE
Move to stored favorite/"My" position.
@ STOP
Stop movement immediately.
@ VENT
Move to ventilation position (window-type devices).
bool create_1w_remove_controller(IoFrame &f, const uint8_t src[NODE_ID_SIZE], DeviceType target_type, uint16_t sequence, const uint8_t controller_key[AES_KEY_SIZE])
Build a 1W remove-controller frame (CMD 0x39).
static bool create_challenge_req_framed(IoFrame &f, const uint8_t *dst, const uint8_t *src, const uint8_t challenge[HMAC_SIZE], bool start, bool low_power)
Build a challenge request (0x3C) with caller-chosen framing bits.
bool recover_system_key_from_transfer(const uint8_t transfer_payload[AES_KEY_SIZE], const uint8_t challenge[HMAC_SIZE], uint8_t out_key[AES_KEY_SIZE])
Recover the system key from a CMD_KEY_TRANSFER payload.
bool create_discover_confirm(IoFrame &f, const uint8_t *own, const uint8_t *dst, bool low_power, bool ack)
Build a discovery-confirm request (0x2C) — controller side, sent directly to a freshly-discovered dev...
bool create_get_info1(IoFrame &f, const uint8_t *own, const uint8_t *dst, bool low_power)
Build a CMD_GET_INFO1 (0x54) request. No payload. See proto_commands.h for the evidence note.
bool create_execute_position_and_tilt(IoFrame &f, const uint8_t *own, const uint8_t *dst, bool low_power, uint8_t position, uint8_t tilt_percent)
Build a combined position-and-tilt execute command (0x00) — setClosureAndOrientation.
bool create_1w_execute_command(IoFrame &f, const uint8_t src[NODE_ID_SIZE], DeviceType target_type, CoverCommand cmd, uint16_t sequence, const uint8_t controller_key[AES_KEY_SIZE], uint8_t acei, bool broadcast_all)
Build a 1W named-command execute frame (CMD 0x00) targeting a device class.
void init_frame(IoFrame &f, bool is_2w, bool start, bool end, bool low_power)
Initialize an IoFrame header (ctrl0/ctrl1) with flags.
bool create_key_confirm(IoFrame &f, const uint8_t *own, const uint8_t *dst)
Build a key-confirm frame (0x33) — device side, used only by the key-extraction responder.
bool create_execute_tilt(IoFrame &f, const uint8_t *own, const uint8_t *dst, bool low_power, uint8_t tilt_percent)
Build a tilt execute command (0x00) for devices that support slat angle control.
bool create_set_config1(IoFrame &f, const uint8_t *own, const uint8_t *dst)
Build a set-config command (0x6F) to tell the device to automatically send status updates when contro...
bool create_challenge_resp(IoFrame &f, const uint8_t *dst, const uint8_t *src, const uint8_t challenge[HMAC_SIZE], const IoFrame &origin, const uint8_t *key)
Build a challenge response (0x3D) proving we know the system key.
void set_dst(IoFrame &f, const uint8_t id[NODE_ID_SIZE])
Set destination node ID.
bool create_key_init(IoFrame &f, const uint8_t *own, const uint8_t *dst)
Build a key-init request (0x31) to start the pairing key exchange with a discovered device.
bool create_execute_position(IoFrame &f, const uint8_t *own, const uint8_t *dst, bool low_power, uint8_t position, bool silent)
Build a position execute command (0x00) to move a device to a numeric position.
bool create_general_info3(IoFrame &f, const uint8_t *own, const uint8_t *dst, bool low_power)
Build a CMD_GET_GENERAL_INFO3 (0x58) request.
bool create_get_info2(IoFrame &f, const uint8_t *own, const uint8_t *dst, bool low_power)
Build a CMD_GET_INFO2 (0x56) request. No payload. See proto_commands.h for the evidence note.
bool create_execute_command(IoFrame &f, const uint8_t *own, const uint8_t *dst, bool low_power, CoverCommand cmd, bool silent)
Build a named-command execute frame (0x00) for STOP, FAVORITE, or VENT.
bool create_discover_confirm_ack(IoFrame &f, const uint8_t *own, const uint8_t *dst)
Build a discovery-confirm acknowledgement (0x2D) — device side, used only by the key-extraction respo...
bool create_challenge_req_device_role(IoFrame &f, const uint8_t *dst, const uint8_t *src, const uint8_t challenge[HMAC_SIZE])
Build a device-role challenge request (0x3C) — device side, used only by the key-extraction responder...
static bool create_challenge_resp_framed(IoFrame &f, const uint8_t *dst, const uint8_t *src, const uint8_t challenge[HMAC_SIZE], const IoFrame &origin, const uint8_t *key, bool end, bool low_power)
Build a challenge response (0x3D) with caller-chosen framing bits.
bool create_discover(IoFrame &f, const uint8_t *own)
Build a discovery broadcast (0x28).
bool create_private_function(IoFrame &f, const uint8_t *own, const uint8_t *dst, bool low_power, uint8_t function_id, uint8_t sub_index)
Build a CMD_PRIVATE (0x03) request for an arbitrary function ID.
bool create_discovery_request(IoFrame &f, const uint8_t *own, uint8_t command, const uint8_t *dst, bool low_power, bool ack_capable, bool payload_enabled, uint8_t payload, const uint8_t *system_key)
Build a configurable discovery request command (0x28, 0x2A, or 0x2E).
bool create_get_status_tilt(IoFrame &f, const uint8_t *own, const uint8_t *dst, bool low_power)
Build a tilt-aware get-status request (0x03) that returns the extended 16-byte tilt payload.
bool create_get_status_extended(IoFrame &f, const uint8_t *own, const uint8_t *dst, bool low_power, uint8_t selector, uint8_t block, uint8_t function_id)
Build an extended CMD_PRIVATE (0x03) request with a selector/block pair — the shape real hubs use for...
bool create_challenge_resp_device_role(IoFrame &f, const uint8_t *dst, const uint8_t *src, const uint8_t challenge[HMAC_SIZE], const IoFrame &origin, const uint8_t *key)
Build a device-role challenge response (0x3D) — device side, used only by the key-extraction responde...
bool create_1w_execute_position(IoFrame &f, const uint8_t src[NODE_ID_SIZE], DeviceType target_type, uint8_t position, uint16_t sequence, const uint8_t controller_key[AES_KEY_SIZE], uint8_t acei, bool broadcast_all)
Build a 1W position execute frame (CMD 0x00) targeting a device class.
bool create_challenge_req(IoFrame &f, const uint8_t *dst, const uint8_t *src, const uint8_t challenge[HMAC_SIZE])
Build a challenge request (0x3C) using a caller-supplied challenge.
bool create_status_update_resp(IoFrame &f, const uint8_t *own, const uint8_t *dst)
Build a status-update acknowledgment (0x72).
bool create_1w_add_controller(IoFrame &f, const uint8_t src[NODE_ID_SIZE], DeviceType target_type, uint8_t manufacturer, uint16_t sequence, const uint8_t controller_key[AES_KEY_SIZE], bool with_mac)
Build a 1W add-controller frame (CMD 0x30).
static bool create_controller_start_frame(IoFrame &f, const uint8_t *own, const uint8_t *dst, uint8_t cmd, bool low_power, bool ack)
Build a bare controller→device start frame: no payload, START set, END clear, LOW_POWER and ACK as th...
bool create_key_transfer(IoFrame &f, IoFrame &old_frame, const uint8_t *dst, const uint8_t *src, const uint8_t key[AES_KEY_SIZE], const uint8_t challenge[HMAC_SIZE])
Build a key-transfer frame (0x32) containing the system key encrypted with the transfer key.
void set_src(IoFrame &f, const uint8_t id[NODE_ID_SIZE])
Set source node ID.
Command builders for the IO‑Homecontrol protocol.
IO-Homecontrol command IDs, result codes and protocol enumerations.
Cryptographic helpers for the IO‑Homecontrol protocol.
Parsed IO‑Homecontrol frame (CTRL0/1 + addresses + command + data).
uint8_t data[FRAME_MAX_DATA_SIZE]
Command parameters (0–23 bytes). Never includes mac.
uint8_t mac[HMAC_SIZE]
Out-of-length authenticator trailer; meaningful only when has_mac.
bool has_mac
True if this frame carries the mac trailer (see struct doc).
uint8_t data_len
Actual length of data.
uint8_t ctrl1
Control byte 1: low power, beacon, etc.