From 898dca260cdb9d2da17275c0e7f4d00861d5dcdc Mon Sep 17 00:00:00 2001 From: "anklimov@gmail.com" Date: Sat, 23 May 2026 16:04:21 +0300 Subject: [PATCH] Sprinkler - outlet not blocking sprinkling + docs --- documentation/Sprinkler_module.md | 14 +++++++++++++- lighthub/modules/out_sprinkler.cpp | 18 ++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/documentation/Sprinkler_module.md b/documentation/Sprinkler_module.md index 978e7cb..7e398c4 100644 --- a/documentation/Sprinkler_module.md +++ b/documentation/Sprinkler_module.md @@ -222,7 +222,19 @@ sensor: state_topic: "root/s_out/sprinkler/nord/val" - name: "Полив капельный выполнено" - state_topic: "root/s_out/sprinkler/trees/val" + state_topic: "edem/s_out/sprinkler/trees/val" + + - name: "Поливаем юг" + state_topic: "edem/s_out/sprinkler/south/$state" + + - name: "Поливаем север" + state_topic: "edem/s_out/sprinkler/nord/$state" + + - name: "Поливаем капельно" + state_topic: "edem/s_out/sprinkler/trees/$state" + + - name: "Полив розетка статус" + state_topic: "edem/s_out/sprinkler/outlets/$state" - name: "Полив блокировки" state_topic: "root/s_out/sprinkler/ctrl" diff --git a/lighthub/modules/out_sprinkler.cpp b/lighthub/modules/out_sprinkler.cpp index e39ddaa..1b25ad5 100644 --- a/lighthub/modules/out_sprinkler.cpp +++ b/lighthub/modules/out_sprinkler.cpp @@ -372,7 +372,8 @@ inline aJsonObject * out_sprinkler::findNextZone() { if (zone->name && *zone->name && zone->type == aJson_Object) { - if (getIntFromJson(zone, "@active", 0)) return zone; + long setVal = getIntFromJson(zone, "set", 0); + if (getIntFromJson(zone, "@active", 0) && setVal) return zone; } zone = zone->next; } @@ -385,10 +386,23 @@ inline aJsonObject * out_sprinkler::findNextZone() int cmd = getIntFromJson(zone, "cmd", CMD_OFF); long setVal = getIntFromJson(zone, "set", 0); long valVal = getIntFromJson(zone, "val", 0); - if (cmd == CMD_ON && (!setVal || valVal < setVal)) return zone; + if (cmd == CMD_ON && (setVal && valVal < setVal)) return zone; } zone = zone->next; } + + zone = gatesObj->child; + while (zone) + { + if (zone->name && *zone->name && zone->type == aJson_Object) + { + int cmd = getIntFromJson(zone, "cmd", CMD_OFF); + long setVal = getIntFromJson(zone, "set", 0); + if (cmd == CMD_ON && (!setVal )) return zone; + } + zone = zone->next; + } + return NULL; }