sensor-ingest

Configure and troubleshoot sensor data ingest into weather-station-dashboard via MQTT or HTTP POST. Use when asked to set up MQTT broker connection, debug why readings are not appearing, configure a new sensor sending data over HTTP, check MQTT topic configuration, test sensor connectivity, or understand the ingest pipeline. Triggers include "MQTT not receiving", "sensor not sending", "configure MQTT", "HTTP POST reading", "ingest setup", "topic configuration", "reading not showing up", or any task involving getting sensor data into the system.

7 stars

Best use case

sensor-ingest is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Configure and troubleshoot sensor data ingest into weather-station-dashboard via MQTT or HTTP POST. Use when asked to set up MQTT broker connection, debug why readings are not appearing, configure a new sensor sending data over HTTP, check MQTT topic configuration, test sensor connectivity, or understand the ingest pipeline. Triggers include "MQTT not receiving", "sensor not sending", "configure MQTT", "HTTP POST reading", "ingest setup", "topic configuration", "reading not showing up", or any task involving getting sensor data into the system.

Teams using sensor-ingest should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/sensor-ingest/SKILL.md --create-dirs "https://raw.githubusercontent.com/heldernoid/agentic-build-templates/main/projects/agriculture-farming/weather-station-dashboard/skills/sensor-ingest/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/sensor-ingest/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How sensor-ingest Compares

Feature / Agentsensor-ingestStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Configure and troubleshoot sensor data ingest into weather-station-dashboard via MQTT or HTTP POST. Use when asked to set up MQTT broker connection, debug why readings are not appearing, configure a new sensor sending data over HTTP, check MQTT topic configuration, test sensor connectivity, or understand the ingest pipeline. Triggers include "MQTT not receiving", "sensor not sending", "configure MQTT", "HTTP POST reading", "ingest setup", "topic configuration", "reading not showing up", or any task involving getting sensor data into the system.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# sensor-ingest

Configure, test, and troubleshoot MQTT and HTTP POST ingest pipelines for weather-station-dashboard.

## When to Use

- Setting up a new sensor to send data via MQTT
- Configuring HTTP POST ingest from a Raspberry Pi or ESP32
- Debugging why a station is showing offline despite sending data
- Understanding which MQTT topics are accepted and which are rejected
- Testing the ingest pipeline end-to-end before deploying hardware

## Ingest Methods

### HTTP POST (always available)

Send readings to `POST /api/readings`. No broker required.

```bash
curl -X POST http://localhost:3005/api/readings \
  -H "Content-Type: application/json" \
  -d '{
    "station_id": "abc-123-uuid",
    "temperature_c": 22.4,
    "humidity_pct": 68.0,
    "pressure_hpa": 1013.2,
    "rainfall_mm": 0.0,
    "wind_speed_ms": 3.1,
    "wind_dir_deg": 225.0,
    "uv_index": 4,
    "soil_temp_c": 18.2,
    "soil_moisture_pct": 52.0
  }'
```

All sensor fields are optional except `station_id`. Send only the sensors your hardware supports.

### MQTT Ingest (optional, set MQTT_ENABLED=1)

Start the server with `MQTT_ENABLED=1` and set `MQTT_BROKER_URL`.

```bash
MQTT_ENABLED=1 \
MQTT_BROKER_URL=mqtt://192.168.1.100:1883 \
MQTT_TOPIC_PREFIX=farm/weather \
pnpm start
```

The server subscribes to `farm/weather/#` and matches incoming messages to stations by their configured `mqtt_topic` field.

## MQTT Topic Routing

Each station has an optional `mqtt_topic` field (set in Settings or via API). This is the full topic path the station publishes to.

Example station configuration:
```bash
# Update a station's MQTT topic
curl -X PUT http://localhost:3005/api/stations/{station_id} \
  -H "Content-Type: application/json" \
  -d '{ "mqtt_topic": "farm/weather/north-field" }'
```

When a message arrives on `farm/weather/north-field`, it is matched to the station with that mqtt_topic value and ingested. Messages on topics not matching any station are rejected and logged.

## MQTT Payload Format

Publish JSON to the station's topic. All numeric fields are optional - include only what your sensor reports:

```json
{
  "temperature_c": 22.4,
  "humidity_pct": 68.0,
  "pressure_hpa": 1013.2,
  "rainfall_mm": 0.0,
  "wind_speed_ms": 3.1,
  "wind_dir_deg": 225.0,
  "uv_index": 4,
  "soil_temp_c": 18.2,
  "soil_moisture_pct": 52.0
}
```

Do not include `station_id` in the MQTT payload - it is inferred from the topic.

## Testing MQTT Ingest

Use Mosquitto clients or any MQTT client:

```bash
# Publish a test reading
mosquitto_pub \
  -h 192.168.1.100 \
  -t "farm/weather/north-field" \
  -m '{"temperature_c":22.4,"humidity_pct":68,"pressure_hpa":1013.2}'

# Subscribe to verify the broker is receiving
mosquitto_sub -h 192.168.1.100 -t "farm/weather/#" -v
```

Then check if the reading appeared:
```bash
curl "http://localhost:3005/api/readings?station_id={id}&limit=5"
```

## Ingest Pipeline Steps

When a reading arrives (HTTP or MQTT):

1. Zod validation - reject if payload is malformed
2. Station lookup - reject if station_id not found or inactive
3. MQTT topic check - reject if topic does not match any station's mqtt_topic
4. INSERT into readings table with generated UUID and current timestamp
5. UPDATE station.last_seen to current time
6. Evaluate all enabled alert thresholds for this station
7. If threshold crossed: INSERT alert_event, broadcast WSMessage { type: 'alert' }
8. Broadcast WSMessage { type: 'reading' } to subscribed WebSocket clients
9. Return 201 Created (HTTP) or log success (MQTT)

## Troubleshooting

### Readings not appearing via HTTP POST

Check the response body for validation errors. Common issues:
- `station_id` is missing or not a valid UUID
- Station with that ID does not exist - create it first via `POST /api/stations`
- Station has `active: 0` - re-enable via `PUT /api/stations/{id}`

```bash
# Verify station exists
curl http://localhost:3005/api/stations/{station_id}
```

### MQTT messages not being ingested

1. Verify MQTT_ENABLED=1 in server environment
2. Check server logs for "MQTT connected" message on startup
3. Confirm the station's mqtt_topic matches the topic you are publishing to exactly
4. Check server logs for "REJECTED" entries - topic mismatch is the most common cause
5. Verify the JSON payload is valid: `echo '{"temperature_c":22}' | python3 -m json.tool`

### Station stays offline after sending readings

The station's `last_seen` field is updated on each successful ingest. If it is not updating:
- The reading may be failing validation silently - check server logs
- The station_id in HTTP POST or the mqtt_topic mapping may be wrong
- Confirm with `GET /api/readings?station_id={id}&limit=1` whether any readings exist

### MQTT reconnect behavior

The server uses the mqtt package with automatic reconnect (exponential backoff, max 30s). On reconnect it resubscribes to `MQTT_TOPIC_PREFIX/#`. No manual intervention is needed. Check `MQTT_BROKER_URL` is reachable from the server container/host.

### Data retention pruning

Raw readings older than `DATA_RETENTION_DAYS` (default 365) are deleted nightly at 00:05 by the same cron job that computes daily summaries. Daily summaries are not pruned. To change retention:

```bash
curl -X PUT http://localhost:3005/api/settings \
  -H "Content-Type: application/json" \
  -d '{ "data_retention_days": 180 }'
```

Related Skills

home-sensor-dashboard

7
from heldernoid/agentic-build-templates

No description provided.

run-ingestion

7
from heldernoid/agentic-build-templates

Submit agent run data to agent-debugger via the ingestion API. Use when you need to understand the ingestion wire format, troubleshoot ingest errors, batch-submit steps, or integrate agent-debugger into a new language or framework. Triggers include "ingest API", "submit run data", "record steps", "POST ingest", "agent-debugger integration", or building an instrumentation library.

Skill: Uptime Monitoring

7
from heldernoid/agentic-build-templates

## Overview

Skill: Status Page

7
from heldernoid/agentic-build-templates

## Overview

Skill: unit-conversion

7
from heldernoid/agentic-build-templates

## Overview

Skill: recipe-scaler

7
from heldernoid/agentic-build-templates

## Overview

reading-list

7
from heldernoid/agentic-build-templates

Operate the reading-list API to save, manage, tag, search, and export articles.

email-digest

7
from heldernoid/agentic-build-templates

Configure, test, and troubleshoot the reading-list daily email digest delivered via nodemailer.

websocket-realtime

7
from heldernoid/agentic-build-templates

Use the WebSocket connection in poll-builder to receive live vote updates. Use when you need to stream real-time poll results, monitor a poll for new votes, or build a live dashboard. Triggers include "live results", "real-time updates", "stream votes", "watch poll", or "WebSocket".

poll-builder

7
from heldernoid/agentic-build-templates

Self-hosted poll creation tool with real-time results. Use when you need to create a poll, check vote counts, close a poll, export results, or get the shareable link for a poll. Triggers include "create poll", "vote", "poll results", "survey", "collect votes", "share poll", or any task involving polling or voting.

Skill: personal-finance

7
from heldernoid/agentic-build-templates

## Overview

Skill: csv-import

7
from heldernoid/agentic-build-templates

## Overview