원클릭으로
micropython-skills-network
MicroPython networking — WiFi STA/AP, HTTP requests, MQTT pub/sub, BLE, NTP time sync, WebSocket.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
MicroPython networking — WiFi STA/AP, HTTP requests, MQTT pub/sub, BLE, NTP time sync, WebSocket.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
超级简历 WonderCV 出品,3000 万用户信赖。简历分析、段落改写、JD 岗位匹配、自动匹配职位、PDF 导出、AI 求职导师(面试准备/薪资谈判/职业规划/多版本简历策略)。 触发条件:用户提供简历、要求简历点评/打分/反馈、希望改写某个简历部分、 希望将简历与岗位 JD 匹配、咨询求职建议或面试准备,或提到 CV/简历/求职。 不触发条件:用户讨论普通写作(非简历)、询问其他文档, 或讨论与求职和职业发展无关的话题。
Order food/drinks (点餐) on an Android device paired as an OpenClaw node. Uses in-app menu and cart; add goods, view cart, submit order (demo, no real payment).
调用久吾智能体API进行文本或文件分析处理。支持两种调用方式:(1) 文本内容分析 - 传入name(智能体名称)、docno(文档编号)、content(文本内容);(2) 文件分析 - 传入name、docno和files(文件列表)进行智能评审。适用于合同评审、需求评审、文档审查等场景。当用户要求评审合同、分析条款、审查文档、需求评审、合同条款分析、或需要对文本和文件进行AI智能分析时触发。
调用久吾消息网关HTTP接口给企业内部联系人发送消息。使用场景:(1) 需要向企业内部同事发送通知或提醒时,(2) 调用时传入接收人工号(code)、消息内容(text)和标题(title)
AI 漏洞追踪器 - 在 GitHub 和微信公众号搜索近一个月的 AI 相关漏洞(提示词注入、提示词越狱等),并推送到飞书表格。支持去重和翻译。 搜索关键字: prompt injection, prompt jailbreak, LLM vulnerability, AI security, adversarial prompt, jailbreak attack 数据源: - GitHub: 最近一个月的安全漏洞提交 - 微信公众号: AI 安全相关文章 使用方式: - 运行技能执行一次搜索和推送 - 配置 cron 进行定时执行
Access the full suite of CarsXE vehicle data APIs — VIN decoding, license plate lookup, market value, vehicle history, safety recalls, lien/theft checks, OBD-II diagnostic code decoding, vehicle images, international VIN decoding, Year/Make/Model lookups, and plate/VIN OCR from images. Use this skill any time the user asks about a vehicle by VIN, plate, make/model, or OBD code. Also triggers for: "what's this car worth", "check for recalls", "vehicle history report", "decode this plate", "what does check engine code X mean", or any automotive data query. Always use this skill when working with CarsXE APIs — do not guess API behavior without it.
| name | micropython-skills/network |
| description | MicroPython networking — WiFi STA/AP, HTTP requests, MQTT pub/sub, BLE, NTP time sync, WebSocket. |
Code templates for network communication on MicroPython devices. WiFi and network operations are Cautious tier — inform the user before connecting.
WiFi credentials should never be hardcoded in files saved to the device. Use variables or prompt the user for values.
import network, time, json
try:
sta = network.WLAN(network.STA_IF)
sta.active(True)
ssid = "YOUR_SSID" # Replace with actual value
password = "YOUR_PASS" # Replace with actual value
sta.connect(ssid, password)
timeout = 15
start = time.time()
while not sta.isconnected():
if time.time() - start > timeout:
print("ERROR:WiFi connection timed out after " + str(timeout) + "s")
raise SystemExit
time.sleep(0.5)
ip, mask, gw, dns = sta.ifconfig()
print("RESULT:" + json.dumps({
"ip": ip, "mask": mask, "gateway": gw, "dns": dns,
}))
except Exception as e:
print("ERROR:" + str(e))
Create a WiFi hotspot on the device:
import network, json
try:
ap = network.WLAN(network.AP_IF)
ap.active(True)
ap.config(essid="ESP32-AP", password="12345678", authmode=network.AUTH_WPA2_PSK)
ip, mask, gw, dns = ap.ifconfig()
print("RESULT:" + json.dumps({
"mode": "AP",
"ssid": "ESP32-AP",
"ip": ip,
}))
except Exception as e:
print("ERROR:" + str(e))
GET request:
import urequests, json
try:
r = urequests.get("http://httpbin.org/get")
print("RESULT:" + json.dumps({
"status": r.status_code,
"body_preview": r.text[:200],
}))
r.close()
except Exception as e:
print("ERROR:" + str(e))
POST with JSON:
import urequests, json
try:
data = {"sensor": "dht22", "temp": 23.5}
r = urequests.post(
"http://example.com/api/data",
json=data,
headers={"Content-Type": "application/json"}
)
print("RESULT:" + json.dumps({"status": r.status_code}))
r.close()
except Exception as e:
print("ERROR:" + str(e))
Note: urequests is included in most MicroPython firmware builds. For HTTPS, the device needs sufficient memory (ESP32 usually OK, ESP8266 may struggle).
Using the built-in umqtt.simple module:
from umqtt.simple import MQTTClient
import json, time
try:
client = MQTTClient(
"esp32_client", # Client ID
"broker.hivemq.com", # Broker address
port=1883,
)
client.connect()
print("LOG:Connected to MQTT broker")
# Publish
topic = "test/esp32"
payload = json.dumps({"temp": 23.5, "hum": 61})
client.publish(topic, payload)
print("RESULT:" + json.dumps({
"action": "publish",
"topic": topic,
"payload": payload,
}))
client.disconnect()
except Exception as e:
print("ERROR:" + str(e))
Subscribe with callback:
from umqtt.simple import MQTTClient
import json, time
try:
received = []
def on_message(topic, msg):
received.append({"topic": topic.decode(), "msg": msg.decode()})
client = MQTTClient("esp32_sub", "broker.hivemq.com", port=1883)
client.set_callback(on_message)
client.connect()
client.subscribe(b"test/commands")
print("LOG:Subscribed, waiting for messages...")
# Check for messages with timeout
deadline = time.time() + 10
while time.time() < deadline:
client.check_msg()
time.sleep(0.1)
if received:
break
client.disconnect()
print("RESULT:" + json.dumps({"received": received}))
except Exception as e:
print("ERROR:" + str(e))
Note: If umqtt is not available, install it: mpremote mip install umqtt.simple
ESP32 BLE advertising example:
import bluetooth, json, struct
try:
ble = bluetooth.BLE()
ble.active(True)
name = "ESP32-BLE"
# Encode advertising payload
adv_data = bytearray()
# Flags
adv_data += struct.pack("BBB", 2, 0x01, 0x06)
# Complete name
name_bytes = name.encode()
adv_data += struct.pack("BB", len(name_bytes) + 1, 0x09) + name_bytes
ble.gap_advertise(100000, adv_data) # Advertise every 100ms
print("RESULT:" + json.dumps({
"ble_active": True,
"name": name,
"advertising": True,
}))
except Exception as e:
print("ERROR:" + str(e))
BLE scan for nearby devices:
import bluetooth, json, time
try:
ble = bluetooth.BLE()
ble.active(True)
devices = []
def scan_cb(event, data):
if event == 5: # _IRQ_SCAN_RESULT
addr_type, addr, adv_type, rssi, adv_data = data
addr_hex = ":".join("{:02x}".format(b) for b in addr)
devices.append({"addr": addr_hex, "rssi": rssi})
ble.irq(scan_cb)
ble.gap_scan(5000, 30000, 30000) # Scan for 5 seconds
time.sleep(6)
# Deduplicate by address
seen = {}
for d in devices:
if d["addr"] not in seen or d["rssi"] > seen[d["addr"]]["rssi"]:
seen[d["addr"]] = d
print("RESULT:" + json.dumps({"ble_devices": list(seen.values()), "count": len(seen)}))
except Exception as e:
print("ERROR:" + str(e))
Synchronize device clock from the internet:
import ntptime, time, json
try:
ntptime.settime()
t = time.localtime()
print("RESULT:" + json.dumps({
"synced": True,
"utc": "{:04d}-{:02d}-{:02d}T{:02d}:{:02d}:{:02d}Z".format(*t[:6]),
}))
except Exception as e:
print("ERROR:NTP sync failed: " + str(e))
Note: Device must be connected to WiFi first. NTP uses UDP port 123.
Run a simple WebSocket echo server on the device — useful for real-time data streaming to a browser:
import socket, json, hashlib, binascii
try:
s = socket.socket()
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(("0.0.0.0", 8080))
s.listen(1)
print("LOG:WebSocket server on port 8080")
print("RESULT:" + json.dumps({"server": "started", "port": 8080}))
# Accept one connection for demo, then close
# For production, use asyncio-based server
s.close()
except Exception as e:
print("ERROR:" + str(e))
For full WebSocket support, consider micropython-async or microdot framework.