pridany skript pre kontrolu zlyhania merani

This commit is contained in:
2026-06-24 11:26:13 +02:00
parent bcf0baf71c
commit 62e78cac45
4 changed files with 85 additions and 1 deletions

View File

@ -6,6 +6,7 @@ This repository contains a small ESP8266/ESP32 Arduino project for monitoring wa
- `arduino/arduino.ino` contains the Arduino sketch and main application logic.
- `server/log.php` accepts measurement POST requests and appends them as JSON Lines.
- `server/data-checker.php` is intended for hourly CRON runs and checks whether recent measurements are still being written.
- `server/functions.inc.php` contains shared PHP helpers, including JSON responses, HTTP requests, and Telegram notifications.
- `data/YYYY.jsonl` is created at runtime for logged measurements and should not be treated as source code.
- `README.md` gives the high-level project purpose.
@ -30,6 +31,7 @@ arduino-cli upload -p COM3 --fqbn esp32:esp32:esp32 arduino
arduino-cli monitor -p COM3 -c baudrate=115200
php -l server/log.php
php -l server/data-checker.php
php -l server/functions.inc.php
```
@ -74,10 +76,13 @@ Before committing firmware changes:
Before committing server changes:
- Run `php -l server/log.php`.
- Run `php -l server/data-checker.php` when the CRON checker changes.
- Run `php -l server/functions.inc.php` when shared helpers change.
- Test that non-POST requests return HTTP 405 with `Allow: POST`.
- Test a form POST such as `level1=1&level2=0&level3=0&level4=1`.
- Verify that a single compact JSON object is appended to `data/YYYY.jsonl`.
- Verify the CRON checker stays silent when `data/YYYY.jsonl` is missing, empty, younger than 45 minutes, or older than 3 hours and 45 minutes.
- Verify the CRON checker walks backward to the nearest valid JSON line when the last line is invalid.
- For notification changes, verify that Telegram messages are sent only when `level1..level4` differ from the previous saved measurement.
- Verify invalid level combinations such as `0100`, `1010`, and `1101` produce the measurement error notification without causing an HTTP error.