Network health monitoring script with MQTT reporting for Home Assistant. - Ping, HTTP, and SNMP checkers - MQTT Discovery for automatic entity creation - Configurable check intervals Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
40 lines
1.1 KiB
Markdown
40 lines
1.1 KiB
Markdown
# CLAUDE.md
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
|
## Project Overview
|
|
|
|
LAN Checker is a Python script that monitors network services and devices, publishing status via MQTT to Home Assistant using MQTT Discovery.
|
|
|
|
## Commands
|
|
|
|
```bash
|
|
# Install dependencies
|
|
pip install -r requirements.txt
|
|
|
|
# Setup config
|
|
cp config.yaml.example config.yaml
|
|
|
|
# Run
|
|
python lan_checker.py
|
|
```
|
|
|
|
## Architecture
|
|
|
|
- `lan_checker.py` - Main script: config loading, MQTT client, check scheduler
|
|
- `checkers/` - Modular check implementations
|
|
- `base.py` - `BaseChecker` abstract class and `CheckResult` dataclass
|
|
- `ping.py`, `http.py`, `snmp.py` - Concrete checker implementations
|
|
- `config.yaml.example` - Configuration template (copy to `config.yaml`)
|
|
|
|
## Adding a New Checker
|
|
|
|
1. Create `checkers/newtype.py` inheriting from `BaseChecker`
|
|
2. Implement `check()` method returning `CheckResult`
|
|
3. Register in `checkers/__init__.py` CHECKERS dict
|
|
|
|
## MQTT Topics
|
|
|
|
- Discovery: `homeassistant/binary_sensor/lan_checker_{id}/config`
|
|
- State: `lan_checker/{id}/state` (JSON with state, message, response_time, last_check)
|