nx_iot_local_magic_home.nx
buildroot/runtime/nx_iot_local_magic_home.nx
about
nx_iot_local_magic_home.nx -- Magic Home / Flux LED LAN protocol.
Roadmap: NISHI_IOT_HUB_ROADMAP.md Epoch 2 (SPEAK).
S-class invariants: S0 (bit-equal frame encode), S6 (no cloud), S7
(sealed-enum verdicts), S8 (kind-isolated — does not import any
other nx_iot_local_* primitive).
Kind generator (one of N per cardinal
feedback-kind-specific-generators-not-broad-noise). Sibling
kind generators: nx_iot_local_tuya_v33, nx_iot_local_wiz (next),
nx_iot_local_yeelight (queued).
Wire format (observed via flux_led / Saberlight RE notes,
INDEPENDENT_REDERIVE per iot-hub-research.toml):
Transport: TCP/5577 (control), UDP/48899 (discovery)
Crypto: none
Frame: <cmd_byte> <args...> [<persist=0x0F or no-persist=0x00>] <checksum>
checksum = sum of all preceding bytes mod 256
Discovery (UDP/48899 broadcast): ASCII "HF-A11ASSISTHREAD"
Discovery reply: ASCII "<ip>,<mac>,<model>"
Common commands (controller variants v8/v9/v10+):
0x71 0x23 0x0F <chk> Power ON
0x71 0x24 0x0F <chk> Power OFF
0x31 R G B W 0xF0 0x0F <chk> Set RGBW (persist)
0x31 R G B W 0xF0 0x00 <chk> Set RGBW (no persist)
0x31 R G B 0x00 0xF0 0x0F <chk> Set RGB only
0x31 0x00 0x00 0x00 W 0x0F 0x0F <chk> Set warm-white only
0x81 0x8A 0x8B <chk> Query status
0x61 <preset> <speed> 0x0F <chk> Set preset mode
Status reply (14 bytes for v8/v9, 16 bytes for v10+):
[0] 0x81 (response sentinel)
[1] model byte
[2] power: 0x23=ON, 0x24=OFF
[3] mode (0x61=custom RGB, 0x62=preset, ...)
[4] speed (preset only)
[5] R
dependencies 0 imports · 1 importers
imports: none
imported by: nx_iot_local_magic_home_test.nx
structs
| 150 | struct IotMhStatus |
consts
| 111 | const NX_IOT_MH_VERDICT_UNKNOWN: i64 = 0 |
| 112 | const NX_IOT_MH_VERDICT_OK: i64 = 1 |
| 113 | const NX_IOT_MH_VERDICT_BAD_LEN: i64 = 2 |
| 114 | const NX_IOT_MH_VERDICT_BAD_SENTINEL: i64 = 3 |
| 115 | const NX_IOT_MH_VERDICT_BAD_CHECKSUM: i64 = 4 |
| 116 | const NX_IOT_MH_VERDICT_BUF_TOO_SMALL: i64 = 5 |
| 117 | const NX_IOT_MH_VERDICT_BAD_ARG: i64 = 6 |
| 118 | const NX_IOT_MH_VERDICT_N: i64 = 7 |
| 128 | const NX_IOT_MH_POWER_UNKNOWN: i64 = 0 |
| 129 | const NX_IOT_MH_POWER_ON: i64 = 1 |
| 130 | const NX_IOT_MH_POWER_OFF: i64 = 2 |
| 131 | const NX_IOT_MH_POWER_N: i64 = 3 |
| 133 | const NX_IOT_MH_POWER_BYTE_ON: i64 = 0x23 |
| 134 | const NX_IOT_MH_POWER_BYTE_OFF: i64 = 0x24 |
| 138 | const NX_IOT_MH_PORT_CONTROL: i64 = 5577 |
| 139 | const NX_IOT_MH_PORT_DISCOVERY: i64 = 48899 |
| 141 | const NX_IOT_MH_RESPONSE_SENTINEL: i64 = 0x81 |
| 142 | const NX_IOT_MH_PERSIST: i64 = 0x0F |
| 143 | const NX_IOT_MH_NO_PERSIST: i64 = 0x00 |
| 145 | const NX_IOT_MH_STATUS_LEN_V9: i64 = 14 |
| 146 | const NX_IOT_MH_STATUS_LEN_V10: i64 = 16 |
functions
| 120 | func nx_iot_mh_verdict_is_valid(v: i64) -> i64 called by 1: main |
| 164 | func nx_iot_mh_checksum(buf: *u8, len: i64) -> i64 |
| 179 | func nx_iot_mh_build_power(out: *u8, out_cap: i64, on: i64) -> i64 |
| 191 | func nx_iot_mh_build_rgbw(out: *u8, out_cap: i64, |
| 208 | func nx_iot_mh_build_rgb(out: *u8, out_cap: i64, |
| 223 | func nx_iot_mh_build_warm_white(out: *u8, out_cap: i64, w: i64) -> i64 |
| 237 | func nx_iot_mh_build_query(out: *u8, out_cap: i64) -> i64 |
| 247 | func nx_iot_mh_build_preset(out: *u8, out_cap: i64, |
| 265 | func nx_iot_mh_build_discovery(out: *u8, out_cap: i64) -> i64 called by 1: main |
| 288 | func nx_iot_mh_find_byte(buf: *u8, len: i64, c: i64) -> i64 called by 1: nx_iot_mh_parse_discovery_reply |
| 300 | func nx_iot_mh_parse_discovery_reply(buf: *u8, len: i64, |
| 332 | func nx_iot_mh_parse_status(buf: *u8, len: i64, |