Skip to content

Commit 03232db

Browse files
committed
Added Conditional Gate logic (reduces the need for variables and virtual switches)
1 parent b9c25b6 commit 03232db

8 files changed

Lines changed: 616 additions & 61 deletions

File tree

docs/docs/conditional-gates.html

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,23 @@ <h4 class="font-semibold mb-2 text-gray-900">Parameters:</h4>
8484
</div>
8585
</div>
8686

87+
<!-- Check Card -->
88+
<div class="bg-white rounded-lg p-6 border border-gray-200 shadow-sm">
89+
<h3 class="text-xl font-semibold mb-2 text-yellow-600">Check Gate State</h3>
90+
<p class="text-sm text-gray-500 mb-3">Type: <span class="bg-blue-100 text-blue-800 px-2 py-1 rounded text-xs font-semibold">CONDITION</span></p>
91+
<p class="mb-4 text-gray-700">Instantly checks if a gate is currently <strong>GO</strong> or <strong>NO GO</strong> without waiting.</p>
92+
93+
<h4 class="font-semibold mb-2 text-gray-900">Parameters:</h4>
94+
<ul class="space-y-2 text-sm text-gray-600 mb-4">
95+
<li><strong>Gate Name / ID:</strong> Select the gate to check.</li>
96+
<li><strong>State:</strong> The state to check for (GO or NO GO).</li>
97+
</ul>
98+
99+
<div class="bg-green-50 p-4 rounded text-sm text-green-800">
100+
<strong>Use case:</strong> Use this card when you need to branch your flow based on current gate state without waiting. Perfect for "if gate is open, do X, otherwise do Y" scenarios.
101+
</div>
102+
</div>
103+
87104
<!-- Modify Card -->
88105
<div class="bg-white rounded-lg p-6 border border-gray-200 shadow-sm">
89106
<h3 class="text-xl font-semibold mb-2 text-blue-600">Modify Conditional Gate</h3>
@@ -93,9 +110,18 @@ <h3 class="text-xl font-semibold mb-2 text-blue-600">Modify Conditional Gate</h3
93110
<h4 class="font-semibold mb-2 text-gray-900">Parameters:</h4>
94111
<ul class="space-y-2 text-sm text-gray-600 mb-4">
95112
<li><strong>Gate Name / ID:</strong> Select the gate to modify.</li>
96-
<li><strong>New State:</strong> Set to GO (releases waiting flows), NO GO (stops future flows), or Toggle.</li>
113+
<li><strong>New State:</strong> Set to GO (releases waiting flows), NO GO (stops future flows), Toggle, or Don't change.</li>
97114
<li><strong>New Timeout:</strong> Update the timeout for currently waiting flows. Set to -1 to leave unchanged.</li>
98115
</ul>
116+
117+
<h4 class="font-semibold mb-2 text-gray-900">Output Tag:</h4>
118+
<ul class="space-y-2 text-sm text-gray-600 mb-4">
119+
<li><strong>Gate State (GO):</strong> Boolean - <code>true</code> if the gate is GO after the action, <code>false</code> if NO GO.</li>
120+
</ul>
121+
122+
<div class="bg-purple-50 p-4 rounded text-sm text-purple-800">
123+
<strong>Tip:</strong> To read the current gate state without changing it, use "Don't change" for New State and -1 for New Timeout. The output tag will give you the current state.
124+
</div>
99125
</div>
100126
</div>
101127
</section>

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ <h1 class="text-4xl md:text-5xl font-bold mb-4">Smart (Components) Toolkit for H
5656
</a>
5757
</div>
5858
<div class="flex justify-center gap-2">
59-
<span class="bg-purple-800 text-white text-sm px-3 py-1 rounded">v1.9.0</span>
59+
<span class="bg-purple-800 text-white text-sm px-3 py-1 rounded">v1.9.1</span>
6060
<span class="bg-green-600 text-white text-sm px-3 py-1 rounded">Homey 5.0+</span>
6161
</div>
6262
</div>

no.tiwas.booleantoolbox/.homeychangelog.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,8 @@
4040
},
4141
"1.9.0": {
4242
"en": "Added conditional gates for better flow control without variables"
43+
},
44+
"1.9.1": {
45+
"en": "Minor fixes"
4346
}
4447
}

no.tiwas.booleantoolbox/.homeycompose/flow/actions/conditional_gate_modify.json

Lines changed: 211 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,96 @@
22
"title": {
33
"en": "Modify Conditional Gate",
44
"no": "Endre Betinget Port",
5+
"da": "Ændr Betinget Port",
56
"nl": "Wijzig Voorwaardelijke Poort",
6-
"de": "Bedingtes Tor Ändern"
7+
"de": "Bedingtes Tor Ändern",
8+
"es": "Modificar Puerta Condicional",
9+
"fr": "Modifier Porte Conditionnelle",
10+
"it": "Modifica Porta Condizionale",
11+
"sv": "Ändra Villkorlig Port",
12+
"pl": "Modyfikuj Bramę Warunkową",
13+
"fi": "Muokkaa Ehdollista Porttia",
14+
"ru": "Изменить Условный Шлюз"
715
},
816
"titleFormatted": {
917
"en": "Modify gate [[gate_name]] (Set state: [[new_state]], Set timeout: [[new_timeout_value]] [[new_timeout_unit]])",
1018
"no": "Endre port [[gate_name]] (Sett status: [[new_state]], Sett timeout: [[new_timeout_value]] [[new_timeout_unit]])",
19+
"da": "Ændr port [[gate_name]] (Sæt status: [[new_state]], Sæt timeout: [[new_timeout_value]] [[new_timeout_unit]])",
1120
"nl": "Wijzig poort [[gate_name]] (Zet status: [[new_state]], Zet timeout: [[new_timeout_value]] [[new_timeout_unit]])",
12-
"de": "Tor [[gate_name]] ändern (Status setzen: [[new_state]], Timeout setzen: [[new_timeout_value]] [[new_timeout_unit]])"
21+
"de": "Tor [[gate_name]] ändern (Status setzen: [[new_state]], Timeout setzen: [[new_timeout_value]] [[new_timeout_unit]])",
22+
"es": "Modificar puerta [[gate_name]] (Establecer estado: [[new_state]], Establecer timeout: [[new_timeout_value]] [[new_timeout_unit]])",
23+
"fr": "Modifier porte [[gate_name]] (Définir état: [[new_state]], Définir timeout: [[new_timeout_value]] [[new_timeout_unit]])",
24+
"it": "Modifica porta [[gate_name]] (Imposta stato: [[new_state]], Imposta timeout: [[new_timeout_value]] [[new_timeout_unit]])",
25+
"sv": "Ändra port [[gate_name]] (Ställ in status: [[new_state]], Ställ in timeout: [[new_timeout_value]] [[new_timeout_unit]])",
26+
"pl": "Modyfikuj bramę [[gate_name]] (Ustaw stan: [[new_state]], Ustaw timeout: [[new_timeout_value]] [[new_timeout_unit]])",
27+
"fi": "Muokkaa porttia [[gate_name]] (Aseta tila: [[new_state]], Aseta timeout: [[new_timeout_value]] [[new_timeout_unit]])",
28+
"ru": "Изменить шлюз [[gate_name]] (Установить состояние: [[new_state]], Установить timeout: [[new_timeout_value]] [[new_timeout_unit]])"
1329
},
1430
"hint": {
1531
"en": "Modifies a Conditional Gate. Set Timeout to -1 for no change.",
1632
"no": "Endrer en Betinget Port. Sett Timeout til -1 for ingen endring.",
33+
"da": "Ændrer en Betinget Port. Sæt Timeout til -1 for ingen ændring.",
1734
"nl": "Wijzigt een Voorwaardelijke Poort. Zet Timeout op -1 voor geen wijziging.",
18-
"de": "Ändert ein Bedingtes Tor. Setze Timeout auf -1 für keine Änderung."
35+
"de": "Ändert ein Bedingtes Tor. Setze Timeout auf -1 für keine Änderung.",
36+
"es": "Modifica una Puerta Condicional. Establezca Timeout en -1 para no cambiar.",
37+
"fr": "Modifie une Porte Conditionnelle. Définissez Timeout sur -1 pour ne pas changer.",
38+
"it": "Modifica una Porta Condizionale. Imposta Timeout su -1 per nessuna modifica.",
39+
"sv": "Ändrar en Villkorlig Port. Sätt Timeout till -1 för ingen ändring.",
40+
"pl": "Modyfikuje Bramę Warunkową. Ustaw Timeout na -1 aby nie zmieniać.",
41+
"fi": "Muokkaa Ehdollista Porttia. Aseta Timeout arvoon -1 jos ei muutosta.",
42+
"ru": "Изменяет Условный Шлюз. Установите Timeout на -1 для без изменений."
1943
},
44+
"tokens": [
45+
{
46+
"name": "gate_state",
47+
"type": "boolean",
48+
"title": {
49+
"en": "New Gate State (GO)",
50+
"no": "Ny Portstatus (GO)",
51+
"da": "Ny Portstatus (GO)",
52+
"nl": "Nieuwe Poortstatus (GO)",
53+
"de": "Neuer Torstatus (GO)",
54+
"es": "Nuevo Estado de Puerta (GO)",
55+
"fr": "Nouvel État de Porte (GO)",
56+
"it": "Nuovo Stato Porta (GO)",
57+
"sv": "Ny Portstatus (GO)",
58+
"pl": "Nowy Stan Bramy (GO)",
59+
"fi": "Uusi Portin Tila (GO)",
60+
"ru": "Новое Состояние Шлюза (GO)"
61+
}
62+
}
63+
],
2064
"args": [
2165
{
2266
"type": "autocomplete",
2367
"name": "gate_name",
2468
"title": {
2569
"en": "Gate Name / ID",
2670
"no": "Port Navn / ID",
71+
"da": "Port Navn / ID",
2772
"nl": "Poort Naam / ID",
28-
"de": "Tor Name / ID"
73+
"de": "Tor Name / ID",
74+
"es": "Nombre / ID de Puerta",
75+
"fr": "Nom / ID de Porte",
76+
"it": "Nome / ID Porta",
77+
"sv": "Port Namn / ID",
78+
"pl": "Nazwa / ID Bramy",
79+
"fi": "Portin Nimi / ID",
80+
"ru": "Имя / ID Шлюза"
2981
},
3082
"placeholder": {
3183
"en": "Select Gate Name",
3284
"no": "Velg Port Navn",
85+
"da": "Vælg Port Navn",
3386
"nl": "Selecteer Poort Naam",
34-
"de": "Wähle Tor Name"
87+
"de": "Wähle Tor Name",
88+
"es": "Seleccionar Nombre de Puerta",
89+
"fr": "Sélectionner Nom de Porte",
90+
"it": "Seleziona Nome Porta",
91+
"sv": "Välj Port Namn",
92+
"pl": "Wybierz Nazwę Bramy",
93+
"fi": "Valitse Portin Nimi",
94+
"ru": "Выберите Имя Шлюза"
3595
}
3696
},
3797
{
@@ -40,14 +100,86 @@
40100
"title": {
41101
"en": "New State",
42102
"no": "Ny Status",
103+
"da": "Ny Status",
43104
"nl": "Nieuwe Status",
44-
"de": "Neuer Status"
105+
"de": "Neuer Status",
106+
"es": "Nuevo Estado",
107+
"fr": "Nouvel État",
108+
"it": "Nuovo Stato",
109+
"sv": "Ny Status",
110+
"pl": "Nowy Stan",
111+
"fi": "Uusi Tila",
112+
"ru": "Новое Состояние"
45113
},
46114
"values": [
47-
{ "id": "NO_CHANGE", "title": { "en": "Don't change", "no": "Ikke endre", "nl": "Niet wijzigen", "de": "Nicht ändern" } },
48-
{ "id": "GO", "title": { "en": "Set to GO", "no": "Sett til GO", "nl": "Zet op GO", "de": "Setze auf GO" } },
49-
{ "id": "NO_GO", "title": { "en": "Set to NO GO", "no": "Sett til NO GO", "nl": "Zet op NO GO", "de": "Setze auf NO GO" } },
50-
{ "id": "TOGGLE", "title": { "en": "Toggle", "no": "Veksle", "nl": "Omschakelen", "de": "Umschalten" } }
115+
{
116+
"id": "NO_CHANGE",
117+
"title": {
118+
"en": "Don't change",
119+
"no": "Ikke endre",
120+
"da": "Ændr ikke",
121+
"nl": "Niet wijzigen",
122+
"de": "Nicht ändern",
123+
"es": "No cambiar",
124+
"fr": "Ne pas changer",
125+
"it": "Non modificare",
126+
"sv": "Ändra inte",
127+
"pl": "Nie zmieniaj",
128+
"fi": "Älä muuta",
129+
"ru": "Не менять"
130+
}
131+
},
132+
{
133+
"id": "GO",
134+
"title": {
135+
"en": "Set to GO",
136+
"no": "Sett til GO",
137+
"da": "Sæt til GO",
138+
"nl": "Zet op GO",
139+
"de": "Setze auf GO",
140+
"es": "Establecer en GO",
141+
"fr": "Définir sur GO",
142+
"it": "Imposta su GO",
143+
"sv": "Ställ in på GO",
144+
"pl": "Ustaw na GO",
145+
"fi": "Aseta GO",
146+
"ru": "Установить GO"
147+
}
148+
},
149+
{
150+
"id": "NO_GO",
151+
"title": {
152+
"en": "Set to NO GO",
153+
"no": "Sett til NO GO",
154+
"da": "Sæt til NO GO",
155+
"nl": "Zet op NO GO",
156+
"de": "Setze auf NO GO",
157+
"es": "Establecer en NO GO",
158+
"fr": "Définir sur NO GO",
159+
"it": "Imposta su NO GO",
160+
"sv": "Ställ in på NO GO",
161+
"pl": "Ustaw na NO GO",
162+
"fi": "Aseta NO GO",
163+
"ru": "Установить NO GO"
164+
}
165+
},
166+
{
167+
"id": "TOGGLE",
168+
"title": {
169+
"en": "Toggle",
170+
"no": "Veksle",
171+
"da": "Skift",
172+
"nl": "Omschakelen",
173+
"de": "Umschalten",
174+
"es": "Alternar",
175+
"fr": "Basculer",
176+
"it": "Commuta",
177+
"sv": "Växla",
178+
"pl": "Przełącz",
179+
"fi": "Vaihda",
180+
"ru": "Переключить"
181+
}
182+
}
51183
],
52184
"defaultValue": "NO_CHANGE"
53185
},
@@ -57,8 +189,16 @@
57189
"title": {
58190
"en": "New Timeout (-1 = no change)",
59191
"no": "Ny Timeout (-1 = ingen endring)",
192+
"da": "Ny Timeout (-1 = ingen ændring)",
60193
"nl": "Nieuwe Timeout (-1 = geen wijziging)",
61-
"de": "Neuer Timeout (-1 = keine Änderung)"
194+
"de": "Neuer Timeout (-1 = keine Änderung)",
195+
"es": "Nuevo Timeout (-1 = sin cambio)",
196+
"fr": "Nouveau Timeout (-1 = pas de changement)",
197+
"it": "Nuovo Timeout (-1 = nessuna modifica)",
198+
"sv": "Ny Timeout (-1 = ingen ändring)",
199+
"pl": "Nowy Timeout (-1 = bez zmian)",
200+
"fi": "Uusi Timeout (-1 = ei muutosta)",
201+
"ru": "Новый Timeout (-1 = без изменений)"
62202
},
63203
"min": -1,
64204
"step": 1,
@@ -70,13 +210,69 @@
70210
"title": {
71211
"en": "Timeout unit",
72212
"no": "Timeout enhet",
213+
"da": "Timeout enhed",
73214
"nl": "Timeout eenheid",
74-
"de": "Timeout Einheit"
215+
"de": "Timeout Einheit",
216+
"es": "Unidad de timeout",
217+
"fr": "Unité de timeout",
218+
"it": "Unità timeout",
219+
"sv": "Timeout enhet",
220+
"pl": "Jednostka timeout",
221+
"fi": "Timeout yksikkö",
222+
"ru": "Единица timeout"
75223
},
76224
"values": [
77-
{ "id": "s", "title": { "en": "Seconds", "no": "Sekunder", "nl": "Seconden", "de": "Sekunden" } },
78-
{ "id": "m", "title": { "en": "Minutes", "no": "Minutter", "nl": "Minuten", "de": "Minuten" } },
79-
{ "id": "h", "title": { "en": "Hours", "no": "Timer", "nl": "Uren", "de": "Stunden" } }
225+
{
226+
"id": "s",
227+
"title": {
228+
"en": "Seconds",
229+
"no": "Sekunder",
230+
"da": "Sekunder",
231+
"nl": "Seconden",
232+
"de": "Sekunden",
233+
"es": "Segundos",
234+
"fr": "Secondes",
235+
"it": "Secondi",
236+
"sv": "Sekunder",
237+
"pl": "Sekundy",
238+
"fi": "Sekuntia",
239+
"ru": "Секунды"
240+
}
241+
},
242+
{
243+
"id": "m",
244+
"title": {
245+
"en": "Minutes",
246+
"no": "Minutter",
247+
"da": "Minutter",
248+
"nl": "Minuten",
249+
"de": "Minuten",
250+
"es": "Minutos",
251+
"fr": "Minutes",
252+
"it": "Minuti",
253+
"sv": "Minuter",
254+
"pl": "Minuty",
255+
"fi": "Minuuttia",
256+
"ru": "Минуты"
257+
}
258+
},
259+
{
260+
"id": "h",
261+
"title": {
262+
"en": "Hours",
263+
"no": "Timer",
264+
"da": "Timer",
265+
"nl": "Uren",
266+
"de": "Stunden",
267+
"es": "Horas",
268+
"fr": "Heures",
269+
"it": "Ore",
270+
"sv": "Timmar",
271+
"pl": "Godziny",
272+
"fi": "Tuntia",
273+
"ru": "Часы"
274+
}
275+
}
80276
],
81277
"defaultValue": "s"
82278
}

0 commit comments

Comments
 (0)