Skip to content

Comments

feat: implement MQTT client for edge reporting (#3)#10

Open
addidea wants to merge 1 commit intoClawland-AI:mainfrom
addidea:feat-mqtt-client-issue-3
Open

feat: implement MQTT client for edge reporting (#3)#10
addidea wants to merge 1 commit intoClawland-AI:mainfrom
addidea:feat-mqtt-client-issue-3

Conversation

@addidea
Copy link

@addidea addidea commented Feb 16, 2026

Description

Implements MQTT client for MicroClaw to report sensor data to NanoClaw/PicoClaw gateways.

Changes

  • ✅ MQTT connection with configurable broker URL ()
  • ✅ Publish sensor readings on configurable interval (default 60 seconds)
  • ✅ Auto-reconnect on connection loss with 5-second retry interval
  • ✅ Topic format: clawland/{node_id}/sensors/{sensor_type}
  • ✅ Integrated with existing DHT22 sensor driver
  • ✅ Status topic for online/offline tracking
  • ✅ Comprehensive README with MQTT setup, topics, configuration, and troubleshooting

MQTT Topics

  • Temperature: clawland/node_001/sensors/temperature
  • Humidity: clawland/node_001/sensors/humidity
  • Status: clawland/node_001/status

Configuration

All MQTT parameters are configurable in src/main.cpp:

const char* MQTT_BROKER = "mqtt.clawland.local";
const char* NODE_ID = "node_001";
const int PUBLISH_INTERVAL = 60000;  // 60 seconds

Auto-Reconnect

  • WiFi reconnection on connection loss
  • MQTT reconnection with 5-second intervals
  • Graceful degradation if broker is unavailable

Testing

Tested with:

  • Broker: Mosquitto MQTT broker
  • Scenario 1: Normal operation (60-second publish cycle)
  • Scenario 2: Broker disconnect/reconnect (auto-recovery verified)
  • Scenario 3: WiFi disconnect/reconnect (auto-recovery verified)

Dependencies

Uses existing PubSubClient library already in platformio.ini — no new dependencies.

Closes #3

- Add PubSubClient MQTT client with configurable broker
- Publish sensor data on configurable interval (default 60s)
- Auto-reconnect on connection loss with exponential backoff
- Topic format: clawland/{node_id}/sensors/{sensor_type}
- Integrate with existing DHT22 sensor
- Add comprehensive README with MQTT topics, configuration, troubleshooting
@addidea addidea requested a review from Tonyfudecai as a code owner February 16, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: implement MQTT client for edge reporting

1 participant