Adding MQTT Features #108
Replies: 3 comments 1 reply
|
Hi Nazmi, I dug into both points. Short version: MQTT is doable, BLE-for-provisioning is not realistic on your specific module. Bluetooth on your TYZS4Your module is a TYZS4-IPEX, built around the EFR32MG1B232F256GM48 (Series 1, 256 kB flash / 32 kB RAM) — the same radio chip family this project uses, documented with @lornys in discussion #85. The silicon does support Bluetooth LE. The problem is the use case you have in mind — provisioning over BLE while keeping Zigbee running — needs Dynamic Multiprotocol (DMP, BLE + Zigbee concurrently), and Silabs requires at least 512 kB of flash for DMP (docs.silabs.com, AN1133). Your chip has only 256 kB — below that floor. The GSDK 4.5.0 DMP examples confirm it: they target MG13/MG12, never MG1. So your options are:
My recommendation: don't provision over BLE. Do network/MQTT-endpoint config on the Linux (RTL8196E) side — a small local web page or a config file over SSH. No extra radio firmware, no contention with Zigbee. MQTTRunning an MQTT broker on the RTL8196E is fine: Eclipse Mosquitto is open source (EPL 1.0 / EDL 1.0), lightweight, has an OpenWrt package, and cross-compiles for MIPS — so it builds with this project's Lexra-MIPS toolchain (same path as BusyBox/OTBR), and easily fits in the ~20 MB free. Just note what you'd carry over MQTT: the Zigbee→MQTT translation is Zigbee2MQTT's job, and Z2M (Node.js) is far too heavy for this SoC — that's why the project bridges the radio over TCP:8888 to a remote Z2M/ZHA. So Mosquitto here makes sense for gateway telemetry/admin, not as an on-device Z2M replacement. |
|
Hi Nazmi, Yes, your goal — Zigbee data to a cloud MQTT broker, with commands coming back — is absolutely achievable. But before you write an EZSP host yourself, it's worth knowing where the real work is: EZSP framing is the easy part; the hard part is the ZCL / device-interview / pairing / attribute-reporting layer on top of it. That upper layer is exactly what Zigbee2MQTT and ZHA already implement. So you have two routes. Route A — let an existing stack do it (recommended, no Zigbee code to write)Keep the NCP-UART-HW firmware on the EFR32 and the in-kernel UART↔TCP bridge (port 8888). Then run Zigbee2MQTT in your cloud, pointed at your gateway: serial:
port: tcp://<gateway-ip>:8888
adapter: ezspZ2M already publishes every Zigbee device/event to MQTT and subscribes for commands — which is exactly your bullet list, with zero code on the gateway. It also handles coordinator pairing, interview, ZCL parsing, OTA, etc. One thing to fix: the TCP:8888 bridge is plaintext and meant for a trusted LAN. Exposing it to the internet would expose your Zigbee network, so tunnel it — WireGuard/VPN, an SSH tunnel, or a TLS wrapper (e.g. stunnel) between the gateway and your cloud. Route B — on-device EZSP host + MQTT bridge (what you described)This works too, and the individual pieces are light:
The catch is everything above EZSP — coordinator management, device join/interview, ZCL attribute reads/reports — which you'd be reimplementing from scratch. That's the bulk of a Zigbee host stack, and it's a lot of work for a 200 MHz / 32 MB device. If you only need a few fixed device types and simple commands, a minimal custom host is feasible; for a general-purpose coordinator it's a large project. My recommendationRun the Zigbee stack where you have CPU (your cloud, via Route A) and let the gateway be the radio bridge it's designed to be. You get cloud MQTT in both directions immediately, and you keep the door open to ZHA/Matter later. Reach for Route B only if you have a specific reason to keep everything on-device. Could you also have a look at #104 (comment) ? Thanks ! |
|
Thank you for your explanation @jnilo1 ! |
Uh oh!
There was an error while loading. Please reload this page.
Hi All,
I'm just curious the possibility to add MQTT features inside Realtek linux environments.
I want to get your opinion related to implementing bluetooth features to configure ethernet setting, wifi ssid and mqtt endpoint.
So we can communicate with device via MQTT.
is that possible?
if yes, I want to explore more about this.
Thanks,
Nazmi
All reactions