mirror of
https://github.com/anklimov/lighthub
synced 2026-06-13 19:36:23 +03:00
Sprinkler - outlet not blocking sprinkling + docs
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user