Replies: 6 comments
-
Anyway, I've been practicing with this and the C module. I think I've got it, something works. I need to saw more. The only thing I haven't tried yet is that the send command and the fetch requests work too. I wanted a small thing that could monitor 3-4 Zigbee devices and control over MQTT.
Features
asyncioIt can work in asynchronous mode, with asyncio, too. async def reader():
while True:
if zig.any():
try:
addr, ep, cluster, data = zig.recv()
print(f"Получено сообщение от {addr:04x}")
except OSError:
pass
await asyncio.sleep(0.01)
loop = asyncio.get_event_loop()
loop.run_until_complete(reader()) Callback example.msg_types = {getattr(ZIG, attr): attr for attr in dir(ZIG) if attr.startswith("MSG_")}
def on_msg(_):
msg_type, src, ep, cid, data = zig.recv()
msg_type_name = msg_types.get(msg_type, f"UNKNOWN({msg_type})")
print(f"Type: {msg_type_name} ({msg_type})")
print(f"From: 0x{src:04X}, Endpoint: {ep}, Cluster: 0x{cid:04X}")
print(f"Data: {data.hex() if data else 'None'}")
print("-" * 50)
zig = ZIG(start=False)
zig.set_recv_callback(on_msg)
zig.start_network() Output: REPL with a lot logs.
|
Beta Was this translation helpful? Give feedback.
-
Some update. ![]() |
Beta Was this translation helpful? Give feedback.
-
Log work: zig_run.mp4 |
Beta Was this translation helpful? Give feedback.
-
Raw commnad test to Ikea Tradfri Led 806lm |
Beta Was this translation helpful? Give feedback.
-
![]() |
Beta Was this translation helpful? Give feedback.
-
Nice, thank you for sharing! Gateways like this is a great application for MicroPython, and this looks pretty good for those using Zigbee :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Bundle Overview
Repo: https://github.com/straga/scrivo_zig
ESP32-S3
• Runs MicroPython as the main controller.
• Responsible for application logic and API.
• Based on: esp_zigbee_gateway example
• Goal is to reproduce the same base functionality, but expose it through MicroPython (and eventually extend it).
ESP32-H2
• Flashed with OpenThread RCP (OP-RCP) firmware.
• Based on: OT-RCP example
• Connected to ESP32-S3 via UART, acting as the Zigbee/Thread radio module.
Idea of integrating the ZIG module as a USER_C_MODULE in MicroPython to simplify Zigbee control from Python.
Has anyone tried building a Zigbee gateway using MicroPython + RCP approach?
Beta Was this translation helpful? Give feedback.
All reactions