Sprinkler - outlet not blocking sprinkling + docs

This commit is contained in:
2026-05-23 16:04:21 +03:00
parent 985d058c50
commit 898dca260c
2 changed files with 29 additions and 3 deletions

View File

@@ -222,7 +222,19 @@ sensor:
state_topic: "root/s_out/sprinkler/nord/val" state_topic: "root/s_out/sprinkler/nord/val"
- name: "Полив капельный выполнено" - 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: "Полив блокировки" - name: "Полив блокировки"
state_topic: "root/s_out/sprinkler/ctrl" state_topic: "root/s_out/sprinkler/ctrl"

View File

@@ -372,7 +372,8 @@ inline aJsonObject * out_sprinkler::findNextZone()
{ {
if (zone->name && *zone->name && zone->type == aJson_Object) 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; zone = zone->next;
} }
@@ -385,10 +386,23 @@ inline aJsonObject * out_sprinkler::findNextZone()
int cmd = getIntFromJson(zone, "cmd", CMD_OFF); int cmd = getIntFromJson(zone, "cmd", CMD_OFF);
long setVal = getIntFromJson(zone, "set", 0); long setVal = getIntFromJson(zone, "set", 0);
long valVal = getIntFromJson(zone, "val", 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 = 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; return NULL;
} }