🎁 Get the FREE AI Skills Starter Guide β€” Subscribe β†’
BytesAgainBytesAgain
πŸ¦€ ClawHub

IoT

by @ivangdavila

Assist with IoT device setup, protocols, security hardening, and home automation integration.

Versionv1.0.0
Downloads2,173
Stars⭐ 3
TERMINAL
clawhub install iot

πŸ“– About This Skill


name: IoT description: Assist with IoT device setup, protocols, security hardening, and home automation integration. metadata: {"clawdbot":{"emoji":"πŸ“‘","os":["linux","darwin","win32"]}}

Protocol Selection

  • MQTT for lightweight messaging β€” pub/sub, low bandwidth, ideal for sensors
  • CoAP for constrained devices β€” UDP-based, REST-like, very low power
  • HTTP/REST for capable devices β€” familiar but heavier, use when bandwidth allows
  • WebSocket for real-time bidirectional β€” dashboards, live updates
  • Zigbee/Z-Wave for mesh networks β€” no WiFi needed, battery-friendly
  • MQTT Essentials

  • Broker is the central hub β€” Mosquitto most common self-hosted
  • Topics are hierarchical β€” home/livingroom/temperature
  • QoS levels: 0 (fire-forget), 1 (at least once), 2 (exactly once)
  • Retain flag keeps last message β€” new subscribers get current state
  • Will message announces disconnection β€” device offline detection
  • Security (Critical)

  • Never expose MQTT broker to internet without auth β€” bots scan constantly
  • TLS mandatory for any external access β€” encrypt all traffic
  • Unique credentials per device β€” revoke one without affecting others
  • Firmware updates must be signed β€” prevent malicious updates
  • Segment IoT on separate VLAN β€” isolate from main network
  • Common Vulnerabilities

  • Default credentials left unchanged β€” first thing attackers try
  • Unencrypted protocols on network β€” credentials sniffable
  • No firmware update mechanism β€” stuck with known vulnerabilities
  • Cloud dependency without fallback β€” device useless when server down
  • Debug ports left enabled β€” UART, JTAG exposed
  • Home Assistant Integration

  • MQTT discovery auto-configures devices β€” follow HA format
  • ESPHome for custom ESP devices β€” YAML config, OTA updates
  • Zigbee2MQTT bridges Zigbee to MQTT β€” hundreds of devices supported
  • Tasmota for off-the-shelf flashing β€” many WiFi devices supported
  • ESP32/ESP8266 Development

  • Arduino framework most accessible β€” huge library ecosystem
  • ESP-IDF for production β€” FreeRTOS, more control, steeper curve
  • PlatformIO over Arduino IDE β€” better dependency management
  • Deep sleep for battery life β€” microamps when sleeping
  • OTA updates essential β€” don't require physical access
  • Power Management

  • Battery devices need deep sleep β€” wake on timer or interrupt
  • Calculate power budget β€” mAh capacity vs average consumption
  • Solar charging viable β€” small panel can sustain low-power sensors
  • Supercapacitors for burst power β€” supplement weak batteries
  • Monitor battery voltage β€” alert before device dies
  • Connectivity Patterns

  • WiFi: high bandwidth, high power β€” plugged devices
  • Zigbee/Z-Wave: mesh, low power β€” battery sensors
  • LoRa: long range, low bandwidth β€” outdoor, agricultural
  • BLE: short range, low power β€” wearables, beacons
  • Thread/Matter: new standard β€” Apple/Google/Amazon unified
  • Reliability

  • Watchdog timer prevents freezes β€” reset if loop stalls
  • Persistent storage for state β€” survive power cycles
  • Heartbeat/ping monitoring β€” detect silent failures
  • Graceful degradation β€” work offline when cloud unavailable
  • Redundant sensors for critical systems β€” don't trust single point
  • Data Considerations

  • Sample rate vs storage β€” don't over-collect
  • Local processing when possible β€” reduce bandwidth, latency
  • Time synchronization critical β€” NTP for timestamps
  • Aggregate before sending β€” reduce message count
  • Retain important data locally β€” survive connectivity loss
  • Debugging

  • Serial output for development β€” remove in production
  • MQTT debug topics β€” publish diagnostics
  • LED status indicators β€” quick visual feedback
  • Remote logging carefully β€” don't flood network
  • Simulate sensors for testing β€” don't wait for real conditions
  • Vendor Lock-in

  • Prefer local API devices β€” Tuya local, Shelly, Tasmota-compatible
  • Cloud-only devices risky β€” company shutdowns brick devices
  • Open protocols over proprietary β€” MQTT, Zigbee over custom
  • Check if flashable β€” many devices accept custom firmware
  • Matter promises interoperability β€” but still maturing