1---
2name: iot
3description: Assist with IoT device setup, protocols, security hardening, and home automation integration.
4metadata:
5 source: https://skillmd.com/skills/modbender/iot
6 clawdbot:
7 emoji: 📡
8 os:
9 - linux
10 - darwin
11 - win32
12---
13
14## Protocol Selection
15- MQTT for lightweight messaging — pub/sub, low bandwidth, ideal for sensors
16- CoAP for constrained devices — UDP-based, REST-like, very low power
17- HTTP/REST for capable devices — familiar but heavier, use when bandwidth allows
18- WebSocket for real-time bidirectional — dashboards, live updates
19- Zigbee/Z-Wave for mesh networks — no WiFi needed, battery-friendly
20
21## MQTT Essentials
22- Broker is the central hub — Mosquitto most common self-hosted
23- Topics are hierarchical — home/livingroom/temperature
24- QoS levels: 0 (fire-forget), 1 (at least once), 2 (exactly once)
25- Retain flag keeps last message — new subscribers get current state
26- Will message announces disconnection — device offline detection
27
28## Security (Critical)
29- Never expose MQTT broker to internet without auth — bots scan constantly
30- TLS mandatory for any external access — encrypt all traffic
31- Unique credentials per device — revoke one without affecting others
32- Firmware updates must be signed — prevent malicious updates
33- Segment IoT on separate VLAN — isolate from main network
34
35## Common Vulnerabilities
36- Default credentials left unchanged — first thing attackers try
37- Unencrypted protocols on network — credentials sniffable
38- No firmware update mechanism — stuck with known vulnerabilities
39- Cloud dependency without fallback — device useless when server down
40- Debug ports left enabled — UART, JTAG exposed
41
42## Home Assistant Integration
43- MQTT discovery auto-configures devices — follow HA format
44- ESPHome for custom ESP devices — YAML config, OTA updates
45- Zigbee2MQTT bridges Zigbee to MQTT — hundreds of devices supported
46- Tasmota for off-the-shelf flashing — many WiFi devices supported
47
48## ESP32/ESP8266 Development
49- Arduino framework most accessible — huge library ecosystem
50- ESP-IDF for production — FreeRTOS, more control, steeper curve
51- PlatformIO over Arduino IDE — better dependency management
52- Deep sleep for battery life — microamps when sleeping
53- OTA updates essential — don't require physical access
54
55## Power Management
56- Battery devices need deep sleep — wake on timer or interrupt
57- Calculate power budget — mAh capacity vs average consumption
58- Solar charging viable — small panel can sustain low-power sensors
59- Supercapacitors for burst power — supplement weak batteries
60- Monitor battery voltage — alert before device dies
61
62## Connectivity Patterns
63- WiFi: high bandwidth, high power — plugged devices
64- Zigbee/Z-Wave: mesh, low power — battery sensors
65- LoRa: long range, low bandwidth — outdoor, agricultural
66- BLE: short range, low power — wearables, beacons
67- Thread/Matter: new standard — Apple/Google/Amazon unified
68
69## Reliability
70- Watchdog timer prevents freezes — reset if loop stalls
71- Persistent storage for state — survive power cycles
72- Heartbeat/ping monitoring — detect silent failures
73- Graceful degradation — work offline when cloud unavailable
74- Redundant sensors for critical systems — don't trust single point
75
76## Data Considerations
77- Sample rate vs storage — don't over-collect
78- Local processing when possible — reduce bandwidth, latency
79- Time synchronization critical — NTP for timestamps
80- Aggregate before sending — reduce message count
81- Retain important data locally — survive connectivity loss
82
83## Debugging
84- Serial output for development — remove in production
85- MQTT debug topics — publish diagnostics
86- LED status indicators — quick visual feedback
87- Remote logging carefully — don't flood network
88- Simulate sensors for testing — don't wait for real conditions
89
90## Vendor Lock-in
91- Prefer local API devices — Tuya local, Shelly, Tasmota-compatible
92- Cloud-only devices risky — company shutdowns brick devices
93- Open protocols over proprietary — MQTT, Zigbee over custom
94- Check if flashable — many devices accept custom firmware
95- Matter promises interoperability — but still maturing