Files
froling_modbus2mqtt/PROMPT.md
2025-12-24 16:21:23 +01:00

38 lines
1.2 KiB
Markdown

# Prompt - Modbus to MQTT App
Use these development guidelines for this repository.
## Goals
- Keep the app config-driven and backward compatible.
- Avoid breaking MQTT topics or HA discovery behavior.
- Prefer readable logs and safe defaults.
## Core behavior
- Read Modbus registers and publish to MQTT.
- Support per-entity refresh intervals (seconds or minutes).
- Use batching for contiguous Modbus reads.
- Publish only on change by default (configurable).
- Publish availability (LWT) and metrics.
## Configuration rules
- `src/config.yaml` is the active config file.
- Validate config on startup (required fields, unique_id).
- Support `state_topic` override per entity.
- Support `value_map` for text mapping.
- Allow computed entities (`input_type: computed`).
## Reliability
- Reconnect Modbus with exponential backoff.
- Backoff per entity after read errors.
- Keep MQTT connection stable and log failures.
## Observability
- Log at INFO by default, allow DEBUG via config.
- Optional file logging via `log_file`.
- Metrics to `<topic_prefix>/metrics`.
## Changes checklist
- Update README and CHANGELOG when behavior changes.
- Keep ASCII where possible (avoid accents in new files).
- Add minimal comments only when logic is not obvious.