Skip to content

Commit 5d24735

Browse files
committed
Fixed some issues with waiter gates
1 parent 24c4281 commit 5d24735

19 files changed

Lines changed: 1500 additions & 205 deletions

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"Bash(xargs ls:*)",
88
"Bash(git add:*)",
99
"Bash(git commit:*)",
10-
"Bash(git push:*)"
10+
"Bash(git push:*)",
11+
"Bash(homey app build:*)"
1112
]
1213
}
1314
}

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,7 @@ codebase-manifest.*
3232
.codebaseignore
3333
*.rar
3434
*.tar.gz
35-
*.old
35+
*.old
36+
37+
# Project Documentation (AI-generated, kept local)
38+
PROJECT_DOCUMENTATION.md

no.tiwas.booleantoolbox/.homeychangelog.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,8 @@
3434
},
3535
"1.8.1": {
3636
"en": "Bug fix + better hints"
37+
},
38+
"1.8.2": {
39+
"en": "Fixed some errors with IDs in waiter gates."
3740
}
3841
}

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
"args": [
4545
{
46-
"type": "text",
46+
"type": "autocomplete",
4747
"name": "waiter_id",
4848
"title": {
4949
"en": "Waiter ID",
@@ -60,18 +60,18 @@
6060
"ru": "ID Waiter"
6161
},
6262
"placeholder": {
63-
"en": "my-waiter",
64-
"no": "min-waiter",
65-
"da": "min-waiter",
66-
"de": "mein-waiter",
67-
"es": "mi-waiter",
68-
"fr": "mon-waiter",
69-
"it": "mio-waiter",
70-
"nl": "mijn-waiter",
71-
"sv": "min-waiter",
72-
"pl": "moj-waiter",
73-
"fi": "oma-waiter",
74-
"ru": "мой-waiter"
63+
"en": "Select waiter ID",
64+
"no": "Velg waiter ID",
65+
"da": "Vælg waiter ID",
66+
"de": "Waiter ID auswählen",
67+
"es": "Seleccionar ID del Waiter",
68+
"fr": "Sélectionner ID du Waiter",
69+
"it": "Seleziona ID Waiter",
70+
"nl": "Selecteer Waiter ID",
71+
"sv": "Välj Waiter ID",
72+
"pl": "Wybierz ID Waiter",
73+
"fi": "Valitse Waiter ID",
74+
"ru": "Выбрать ID Waiter"
7575
}
7676
},
7777
{

no.tiwas.booleantoolbox/.homeycompose/flow/conditions/wait_until_becomes_true.json

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@
2828
"ru": "Ждать пока [[device]] [[capability]] станет [[target_value]] (timeout: [[timeout_value]] [[timeout_unit]], id: [[waiter_id]])"
2929
},
3030
"hint": {
31-
"en": "This card waits until a device capability reaches a specific value. If the value is already correct, it proceeds immediately (YES). If timeout expires before the value matches, it takes the NO path. Leave Waiter ID empty for auto-generation.",
32-
"no": "Dette kortet venter til en enhets capability når en bestemt verdi. Hvis verdien allerede er riktig, fortsetter det umiddelbart (JA). Hvis timeout utløper før verdien matcher, tar det NEI-stien. La Waiter ID stå tom for auto-generering.",
33-
"da": "Dette kort venter indtil en enheds capability når en bestemt værdi. Hvis værdien allerede er korrekt, fortsætter det straks (JA). Hvis timeout udløber før værdien matcher, tager det NEJ-vejen. Lad Waiter ID være tom for auto-generering.",
34-
"de": "Diese Karte wartet bis eine Geräte-Capability einen bestimmten Wert erreicht. Wenn der Wert bereits korrekt ist, wird sofort fortgesetzt (JA). Wenn Timeout abläuft bevor der Wert übereinstimmt, wird der NEIN-Pfad genommen. Lassen Sie Waiter ID leer für Auto-Generierung.",
35-
"es": "Esta tarjeta espera hasta que una capability del dispositivo alcance un valor específico. Si el valor ya es correcto, procede inmediatamente (SÍ). Si el timeout expira antes de que el valor coincida, toma el camino NO. Deje el ID del Waiter vacío para auto-generación.",
36-
"fr": "Cette carte attend qu'une capability d'appareil atteigne une valeur spécifique. Si la valeur est déjà correcte, elle continue immédiatement (OUI). Si le timeout expire avant que la valeur corresponde, elle prend le chemin NON. Laissez l'ID Waiter vide pour la génération automatique.",
37-
"it": "Questa scheda attende fino a quando una capability del dispositivo raggiunge un valore specifico. Se il valore è già corretto, procede immediatamente (SÌ). Se il timeout scade prima che il valore corrisponda, prende il percorso NO. Lascia l'ID Waiter vuoto per la generazione automatica.",
38-
"nl": "Deze kaart wacht tot een apparaat capability een specifieke waarde bereikt. Als de waarde al correct is, gaat het onmiddellijk verder (JA). Als timeout verloopt voordat de waarde overeenkomt, neemt het het NEE-pad. Laat Waiter ID leeg voor auto-generatie.",
39-
"sv": "Detta kort väntar tills en enhets capability når ett specifikt värde. Om värdet redan är korrekt, fortsätter det omedelbart (JA). Om timeout löper ut innan värdet matchar, tar det NEJ-vägen. Lämna Waiter ID tomt för auto-generering.",
40-
"pl": "Ta karta czeka aż capability urządzenia osiągnie określoną wartość. Jeśli wartość jest już prawidłowa, kontynuuje natychmiast (TAK). Jeśli timeout wygaśnie zanim wartość będzie się zgadzać, przechodzi ścieżką NIE. Pozostaw ID Waiter puste dla auto-generacji.",
41-
"fi": "Tämä kortti odottaa kunnes laitteen capability saavuttaa tietyn arvon. Jos arvo on jo oikea, se jatkaa välittömästi (KYLLÄ). Jos timeout vanhenee ennen kuin arvo täsmää, se ottaa EI-polun. Jätä Waiter ID tyhjäksi automaattista luontia varten.",
42-
"ru": "Эта карта ждет пока capability устройства достигнет определенного значения. Если значение уже правильное, она продолжает немедленно (ДА). Если timeout истекает до того как значение совпадет, она выбирает путь НЕТ. Оставьте ID Waiter пустым для автогенерации."
31+
"en": "Waits until a device capability reaches a specific value. YES if value matches (or already correct), NO if timeout expires. A unique Waiter ID is auto-generated, or select an existing one to reuse.",
32+
"no": "Venter til en enhets capability når en bestemt verdi. JA hvis verdien matcher (eller allerede er riktig), NEI hvis timeout utløper. En unik Waiter ID genereres automatisk, eller velg en eksisterende for å gjenbruke.",
33+
"da": "Venter indtil en enheds capability når en bestemt værdi. JA hvis værdien matcher (eller allerede er korrekt), NEJ hvis timeout udløber. Et unikt Waiter ID genereres automatisk, eller vælg et eksisterende for at genbruge.",
34+
"de": "Wartet bis eine Geräte-Capability einen bestimmten Wert erreicht. JA wenn Wert übereinstimmt (oder bereits korrekt), NEIN wenn Timeout abläuft. Eine eindeutige Waiter ID wird automatisch generiert, oder wählen Sie eine vorhandene zur Wiederverwendung.",
35+
"es": "Espera hasta que una capability del dispositivo alcance un valor específico. SÍ si el valor coincide (o ya es correcto), NO si el timeout expira. Se genera automáticamente un ID de Waiter único, o seleccione uno existente para reutilizar.",
36+
"fr": "Attend qu'une capability d'appareil atteigne une valeur spécifique. OUI si la valeur correspond (ou est déjà correcte), NON si le timeout expire. Un ID Waiter unique est généré automatiquement, ou sélectionnez-en un existant pour réutiliser.",
37+
"it": "Attende fino a quando una capability del dispositivo raggiunge un valore specifico. SÌ se il valore corrisponde (o è già corretto), NO se il timeout scade. Un ID Waiter unico viene generato automaticamente, oppure selezionane uno esistente per riutilizzare.",
38+
"nl": "Wacht tot een apparaat capability een specifieke waarde bereikt. JA als waarde overeenkomt (of al correct is), NEE als timeout verloopt. Een unieke Waiter ID wordt automatisch gegenereerd, of selecteer een bestaande om te hergebruiken.",
39+
"sv": "Väntar tills en enhets capability når ett specifikt värde. JA om värdet matchar (eller redan är korrekt), NEJ om timeout löper ut. Ett unikt Waiter ID genereras automatiskt, eller välj ett befintligt för att återanvända.",
40+
"pl": "Czeka aż capability urządzenia osiągnie określoną wartość. TAK jeśli wartość pasuje (lub już jest prawidłowa), NIE jeśli timeout wygaśnie. Unikalny ID Waiter jest generowany automatycznie, lub wybierz istniejący do ponownego użycia.",
41+
"fi": "Odottaa kunnes laitteen capability saavuttaa tietyn arvon. KYLLÄ jos arvo täsmää (tai on jo oikea), EI jos timeout vanhenee. Uniikki Waiter ID luodaan automaattisesti, tai valitse olemassa oleva uudelleenkäyttöön.",
42+
"ru": "Ждет пока capability устройства достигнет определенного значения. ДА если значение совпадает (или уже правильное), НЕТ если timeout истекает. Уникальный ID Waiter генерируется автоматически, или выберите существующий для повторного использования."
4343
},
4444
"args": [
4545
{
@@ -244,35 +244,35 @@
244244
]
245245
},
246246
{
247-
"type": "text",
247+
"type": "autocomplete",
248248
"name": "waiter_id",
249249
"title": {
250-
"en": "Waiter ID (optional)",
251-
"no": "Waiter ID (valgfri)",
252-
"da": "Waiter ID (valgfri)",
253-
"de": "Waiter ID (optional)",
254-
"es": "ID del Waiter (opcional)",
255-
"fr": "ID du Waiter (optionnel)",
256-
"it": "ID Waiter (opzionale)",
257-
"nl": "Waiter ID (optioneel)",
258-
"sv": "Waiter ID (valfritt)",
259-
"pl": "ID Waiter (opcjonalne)",
260-
"fi": "Waiter ID (valinnainen)",
261-
"ru": "ID Waiter (необязательно)"
250+
"en": "Waiter ID",
251+
"no": "Waiter ID",
252+
"da": "Waiter ID",
253+
"de": "Waiter ID",
254+
"es": "ID del Waiter",
255+
"fr": "ID du Waiter",
256+
"it": "ID Waiter",
257+
"nl": "Waiter ID",
258+
"sv": "Waiter ID",
259+
"pl": "ID Waiter",
260+
"fi": "Waiter ID",
261+
"ru": "ID Waiter"
262262
},
263263
"placeholder": {
264-
"en": "Leave empty for auto-generation",
265-
"no": "La stå tom for auto-generering",
266-
"da": "Lad stå tom for auto-generering",
267-
"de": "Leer lassen für Auto-Generierung",
268-
"es": "Dejar vacío para auto-generación",
269-
"fr": "Laisser vide pour génération automatique",
270-
"it": "Lascia vuoto per generazione automatica",
271-
"nl": "Leeg laten voor auto-generatie",
272-
"sv": "Lämna tomt för auto-generering",
273-
"pl": "Pozostaw puste dla auto-generacji",
274-
"fi": "Jätä tyhjäksi automaattista luontia varten",
275-
"ru": "Оставьте пустым для автогенерации"
264+
"en": "Select or type custom ID",
265+
"no": "Velg eller skriv egen ID",
266+
"da": "Vælg eller skriv brugerdefineret ID",
267+
"de": "Auswählen oder eigene ID eingeben",
268+
"es": "Seleccionar o escribir ID personalizado",
269+
"fr": "Sélectionner ou saisir un ID personnalisé",
270+
"it": "Seleziona o digita ID personalizzato",
271+
"nl": "Selecteer of typ aangepaste ID",
272+
"sv": "Välj eller skriv anpassat ID",
273+
"pl": "Wybierz lub wpisz własne ID",
274+
"fi": "Valitse tai kirjoita mukautettu ID",
275+
"ru": "Выберите или введите пользовательский ID"
276276
}
277277
}
278278
]
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Documentation Prompt Template
2+
3+
## Purpose
4+
This prompt template is designed to be reused across projects to establish consistent documentation standards and AI assistant behavior guidelines.
5+
6+
## The Prompt
7+
8+
---
9+
10+
I need to get this project documented. Therefore, I want you to go through all code files and:
11+
12+
1. Explain each function and place this as a comment before the function itself
13+
14+
2. Together with the explanation, list all functions that directly and indirectly call this function
15+
16+
3. Create a separate file that explains the project as a whole, what each file in the project does. There must also be a dependency map for the project.
17+
18+
4. Add instructions to robots.md (or CLAUDE.md / CONTRIBUTING.md) for keeping this updated for each session.
19+
20+
5. All comments and documentation must be in English.
21+
22+
6. Add to robots.md that all code must compile before being presented as a solution.
23+
24+
7. Add to robots.md that existing code must not be modified.
25+
26+
8. Add to robots.md that breaking changes must ALWAYS be avoided, and where not possible, must be thoroughly discussed with the user before being made - even when permission to write freely without code approval has been given.
27+
28+
9. Save this prompt for later use in a suitable file for future use in other projects.
29+
30+
---
31+
32+
## Expected Output
33+
34+
When this prompt is executed, the AI should:
35+
36+
### 1. Function Documentation
37+
Add JSDoc-style comments before each function including:
38+
- Description of what the function does
39+
- @param tags for parameters
40+
- @returns tag for return value
41+
- "Called by:" section listing all callers
42+
- "Calls:" section listing all functions called
43+
44+
Example:
45+
```javascript
46+
/**
47+
* Calculates the total price including tax.
48+
*
49+
* Takes a base price and applies the configured tax rate to calculate
50+
* the final price the customer will pay.
51+
*
52+
* @param {number} basePrice - The price before tax
53+
* @param {number} taxRate - The tax rate as a decimal (e.g., 0.25 for 25%)
54+
* @returns {number} The total price including tax
55+
*
56+
* Called by:
57+
* - checkout() in cart.js - When finalizing an order
58+
* - displayCart() in display.js - When showing cart totals
59+
*
60+
* Calls:
61+
* - roundToTwoDecimals() in utils.js - For currency formatting
62+
*/
63+
function calculateTotalPrice(basePrice, taxRate) {
64+
// implementation
65+
}
66+
```
67+
68+
### 2. Project Documentation File
69+
Create PROJECT_DOCUMENTATION.md containing:
70+
- High-level architecture overview
71+
- ASCII diagram of component relationships
72+
- File structure with descriptions
73+
- Detailed module descriptions
74+
- Dependency map (what imports what)
75+
- Data structures/schemas
76+
- Communication flows (for extensions/APIs)
77+
- Build process
78+
- Security considerations
79+
- Critical findings shall be reported to the user
80+
- This file shall be included in the .gitignore file
81+
- Orphaned functions shall be reported to the user
82+
- Ensure documentation is not pushed to git
83+
84+
### 3. AI Instructions File
85+
Update robots.md (or create CLAUDE.md) with:
86+
- Core principles (complete code, no breaking changes, etc.)
87+
- Documentation maintenance instructions
88+
- Code quality guidelines
89+
- Session workflow (start/end procedures)
90+
91+
## Files Created
92+
93+
When this template is executed on a project, the following files are created:
94+
95+
1. **robots.md** (or CLAUDE.md)
96+
- AI assistant behavioral guidelines
97+
- Documentation maintenance procedures
98+
- Code quality requirements
99+
100+
2. **PROJECT_DOCUMENTATION.md**
101+
- Architecture overview
102+
- File descriptions
103+
- Dependency map
104+
- Data structures
105+
106+
3. **DOCUMENTATION_PROMPT_TEMPLATE.md** (this file)
107+
- Reusable prompt for other projects
108+
109+
4. Updated **.gitignore**
110+
- Excludes PROJECT_DOCUMENTATION.md from version control
111+
112+
## Usage
113+
114+
To use this template on a new project:
115+
116+
1. Copy this file to your new project
117+
2. Open a conversation with your AI assistant
118+
3. Paste the prompt from "The Prompt" section above
119+
4. The AI will analyze your codebase and create the documentation
120+
121+
## Customization
122+
123+
Feel free to modify this template to suit your specific needs:
124+
- Add project-specific guidelines to robots.md
125+
- Adjust the documentation format
126+
- Add additional sections to PROJECT_DOCUMENTATION.md
127+
- Modify the function documentation style
128+
129+
---
130+
131+
*Template version: 1.0*
132+
*Created: December 2024*

no.tiwas.booleantoolbox/README.txt

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -24,55 +24,8 @@ State Capture Device
2424
State Device
2525
Pre-define device states and apply them via flows. Configure states at setup time rather than capturing them dynamically.
2626

27-
== FLOW CARDS ==
28-
29-
Actions:
30-
Logic Unit/Device:
31-
- Evaluate formula / Evaluate all formulas
32-
- Set input value (single or all via JSON)
33-
- Clear error state
34-
- Validate configuration
35-
36-
State Capture Device:
37-
- Capture state (save to named slot)
38-
- Apply captured state
39-
- Delete captured state
40-
- Push state (to stack)
41-
- Pop state (from stack and apply)
42-
- Peek and apply (view top without removing)
43-
- Clear stack
44-
- Export named states (JSON backup)
45-
- Import named states (restore from JSON)
46-
47-
State Device:
48-
- Apply state
49-
50-
Utilities:
51-
- Wait (delay execution)
52-
- Control waiter (pause/resume gates)
53-
- Evaluate expression (inline logic)
54-
55-
Conditions:
56-
- Formula result is true/false
57-
- Formula has timed out
58-
- Device has error
59-
- Captured state exists
60-
- Stack is empty / Stack depth is X
61-
- Wait until becomes true
62-
63-
Triggers:
64-
- Formula changed to true/false
65-
- Formula timed out
66-
- State changed
67-
- State captured/applied
68-
- Configuration alarm changed
69-
- Error occurred
70-
7127
== DOCUMENTATION ==
7228

73-
Full documentation available at: https://tiwas.github.io/SmartComponentsToolkit/
29+
Full documentation available on GitHub
7430

75-
== SUPPORT ==
7631

77-
Community forum: https://community.homey.app/t/app-boolean-toolbox-create-advanced-logic-with-simple-formulas/143906
78-
Issues: https://github.com/Tiwas/SmartComponentsToolkit/issues

0 commit comments

Comments
 (0)