add CLAUDE.md and fix MQTT empty message handling

- CLAUDE.md: document project architecture, resilience constraint,
  workflow and all helper scripts
- pool.js: guard against empty MQTT messages before JSON.parse
  (prevents crash when msg is "")
- pool.js: remove stale TODO about force off when duration==0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-15 17:26:46 +01:00
parent 531acd4d05
commit e1ab96db76
2 changed files with 143 additions and 1 deletions

10
pool.js
View File

@@ -299,14 +299,22 @@ MQTT.subscribe(
function (topic, msg) {
status.tick_mqtt++;
print("[POOL] mqtt", topic, msg);
<<<<<<< HEAD
if (msg == "") {
return;
}
let obj = JSON.parse(msg);
if (obj.temperature === undefined) {
return;
=======
if (msg != "") {
let obj = JSON.parse(msg);
if (obj.temperature === undefined) {
return;
}
update_temp(obj.temperature);
>>>>>>> 2d0d8cb (add CLAUDE.md and fix MQTT empty message handling)
}
update_temp(obj.temperature);
}
)