Skip to content

Commit b6f0020

Browse files
committed
Document gradient map heat pump example
1 parent 9873652 commit b6f0020

7 files changed

Lines changed: 128 additions & 15 deletions

File tree

HOMEY_COMMUNITY_LISTING.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
URL: https://community.homey.app/t/app-smart-components-toolkit-was-boolean-toolbox-create-advanced-logic-with-simple-formulas/143906
22

3-
Title: [APP] Smart (Components) Toolkit (was: Boolean Toolbox) - Create advanced logic with simple formulas [v1.10.16 store / v1.10.17 test - Math Compare and Gradient Map]
3+
Title: [APP] Smart (Components) Toolkit (was: Boolean Toolbox) - Create advanced logic with simple formulas [v1.10.16 store / v1.10.18 test - Math Compare and Gradient Map]
44

55
Content:
66
![xlarge|690x483](upload://iSxhJPUltgcgPQ7gy4z5iisCv5F.jpeg)
77

8-
# Smart (Components) Toolkit — store v1.10.16 / test v1.10.17
8+
# Smart (Components) Toolkit — store v1.10.16 / test v1.10.18
99

1010
> **📚 Full Documentation:** https://tiwas.github.io/SmartComponentsToolkit/
1111
@@ -17,16 +17,29 @@ Replace complex flow networks with powerful logic devices controlled by dynamic
1717

1818
## What's new
1919

20-
### v1.10.17 (test channel)
20+
### v1.10.18 (test channel)
2121

2222
- **Math Compare (And card).** Calculate one value with `+`, `-`, `*` or `/`, then compare the result with another value. Useful for rules like `temperature + 3 is greater than high_threshold`.
23-
- **Gradient Map (Then card).** Map an input value from one range to another and expose the result as a `Mapped value` tag for the next card. Supports range offsets and configurable rounding, for example mapping `18-23` degrees into fan speed `100-500`.
23+
- **Gradient Map (Then card).** Map an input value from one range to another and expose the result as a `Mapped value` tag for the next card. Supports range offsets and configurable rounding, for example mapping a room temperature into a heat pump / aircondition fan speed.
24+
- **Token fix (v1.10.18).** The Gradient Map token now has a distinct `Mapped value` tag, so it is easier to pick the token from the specific map card that actually ran.
25+
26+
**Heat pump / aircondition example:**
27+
```
28+
WHEN: Temperature changes
29+
AND: Temperature is less than low_threshold_livingroom
30+
THEN: Set fan speed to 0%
31+
32+
WHEN: Temperature changes
33+
AND: Temperature is greater than or equal to low_threshold_livingroom
34+
THEN: Map Temperature in range low_threshold_livingroom to high_threshold_livingroom into 100-500, round to 1
35+
THEN: Set fan speed to Mapped value
36+
```
2437

2538
---
2639

2740
## ✨ Circadian Light Group — now on stable
2841

29-
A virtual **light device** that adjusts brightness and color temperature for a group of real lights — automatically following a circadian rhythm. Store is currently v1.10.16; v1.10.17 is available on the test channel.
42+
A virtual **light device** that adjusts brightness and color temperature for a group of real lights — automatically following a circadian rhythm. Store is currently v1.10.16; v1.10.18 is available on the test channel.
3043

3144
### Circadian Light Group highlights
3245

@@ -78,7 +91,7 @@ Choose how the device knows how bright it is outside:
7891

7992
<a href="https://homey.app/en-no/app/no.tiwas.booleantoolbox/" target="_blank">→ Install store v1.10.16</a>
8093
<br>
81-
<a href="https://homey.app/a/no.tiwas.booleantoolbox/test/" target="_blank">→ Install test v1.10.17</a>
94+
<a href="https://homey.app/a/no.tiwas.booleantoolbox/test/" target="_blank">→ Install test v1.10.18</a>
8295

8396
---
8497

@@ -96,6 +109,8 @@ Choose how the device knows how bright it is outside:
96109
| **Conditional Gates** | Simple GO/NO GO flow control without variables or devices. |
97110
| **Waiter Gates** | Pause flow until a device capability reaches a target value. |
98111
| **Evaluate Expression** | Range checking and value mapping with AND/OR logic. |
112+
| **Math Compare** | Compare a calculated number, e.g. `Temperature + 3` against a threshold. |
113+
| **Gradient Map** | Map a number from one range to another and pass the `Mapped value` tag to the next card. |
99114

100115
<a href="https://tiwas.github.io/SmartComponentsToolkit/docs/devices.html" target="_blank">→ Complete Device Guide</a>
101116

@@ -147,7 +162,7 @@ THEN: Wait until coffee machine temperature ≥ 90°C (timeout 5 min)
147162
## Installation and Links
148163

149164
* **Homey App Store (v1.10.16):** <a href="https://homey.app/en-no/app/no.tiwas.booleantoolbox/" target="_blank">Install Smart (Components) Toolkit</a>
150-
* **Test channel (v1.10.17):** <a href="https://homey.app/a/no.tiwas.booleantoolbox/test/" target="_blank">Install test version</a>
165+
* **Test channel (v1.10.18):** <a href="https://homey.app/a/no.tiwas.booleantoolbox/test/" target="_blank">Install test version</a>
151166
* **GitHub Repo:** <a href="https://github.com/tiwas/SmartComponentsToolkit" target="_blank">github.com/tiwas/SmartComponentsToolkit</a>
152167
* **Online Emulator:** <a href="https://tiwas.github.io/SmartComponentsToolkit/tools/emulator.html" target="_blank">Boolean Logic Emulator</a>
153168
* **Formula Builder:** <a href="https://tiwas.github.io/SmartComponentsToolkit/tools/formula-builder.html" target="_blank">Formula Builder</a>

docs/docs/circadian-light-group.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@
7373
<main class="max-w-3xl mx-auto px-6 py-8 flex-grow">
7474
<div class="flex items-center gap-3 mb-2">
7575
<h1 class="text-4xl font-bold text-gray-900">Circadian Light Group</h1>
76-
<span class="bg-purple-100 text-purple-700 text-xs font-semibold px-2 py-1 rounded">v1.10.16 test</span>
76+
<span class="bg-purple-100 text-purple-700 text-xs font-semibold px-2 py-1 rounded">v1.10.18 test</span>
7777
</div>
7878
<p class="text-gray-600 mb-8">A virtual light device that automatically adjusts brightness and color temperature throughout the day based on time, sun position or ambient light, with an optional red mode for night use.</p>
7979

8080
<div class="card">
8181
<h2 class="text-xl font-semibold mb-2 text-purple-600">What's new in 1.10.x</h2>
8282
<ul class="list-disc ml-6 text-gray-700 space-y-1 text-sm">
83-
<li><strong>1.10.16 test</strong><a href="../tools/flow-doctor.html" class="text-purple-600 hover:text-purple-800">Flow Doctor</a> can now resolve previously captured Homey device IDs when deleted devices only appear by ID in broken flows.</li>
83+
<li><strong>1.10.16</strong><a href="../tools/flow-doctor.html" class="text-purple-600 hover:text-purple-800">Flow Doctor</a> can now resolve previously captured Homey device IDs when deleted devices only appear by ID in broken flows.</li>
8484
<li><strong>1.10.7</strong> — Multi-device flow cards and the scheduler now write to up to 5 lights in parallel and retry transient mesh timeouts. Conflicting commands (e.g. an "all off" arriving mid-"all on") supersede the running one instead of fighting it.</li>
8585
<li><strong>1.10.7</strong> — Group-level actions <em>Turn on all members</em> and <em>Turn off all members</em>.</li>
8686
<li><strong>1.10.6</strong> — On/off state is now respected correctly under all paths.</li>

docs/docs/flow-cards.html

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ <h3 class="font-semibold mb-2 text-yellow-600">AND (Conditions)</h3>
8686
<li><a href="#condition-formula-result" class="hover:text-purple-600">→ Formula result is...</a></li>
8787
<li><a href="#condition-device-turned" class="hover:text-purple-600">→ Device is turned...</a></li>
8888
<li><a href="#condition-has-error" class="hover:text-purple-600">→ Has error</a></li>
89+
<li><a href="#condition-math-compare" class="hover:text-purple-600">→ Math Compare</a></li>
8990
<li><a href="#condition-gate-check" class="hover:text-purple-600">→ Gate is GO/NO GO</a></li>
9091
<li><a href="#condition-gate-wait" class="hover:text-purple-600">→ Conditional Gate (Wait for GO)</a></li>
9192
<li><a href="#condition-wait-until" class="hover:text-purple-600">→ Wait until becomes</a></li>
@@ -97,6 +98,7 @@ <h3 class="font-semibold mb-2 text-blue-600">THEN (Actions)</h3>
9798
<li><a href="#action-set-input" class="hover:text-purple-600">→ Set input</a></li>
9899
<li><a href="#action-evaluate" class="hover:text-purple-600">→ Evaluate formula</a></li>
99100
<li><a href="#action-evaluate-expression" class="hover:text-purple-600">→ Evaluate expression</a></li>
101+
<li><a href="#action-gradient-map" class="hover:text-purple-600">→ Gradient Map</a></li>
100102
<li><a href="#action-modify-gate" class="hover:text-purple-600">→ Modify Conditional Gate</a></li>
101103
<li><a href="#action-wait" class="hover:text-purple-600">→ Wait</a></li>
102104
<li><a href="#action-control-waiter" class="hover:text-purple-600">→ Control Waiter Gate</a></li>
@@ -257,6 +259,29 @@ <h3 class="text-xl font-semibold mb-3 text-purple-700">Has error / Has any error
257259
</div>
258260
</div>
259261

262+
<!-- Math Compare -->
263+
<div id="condition-math-compare" class="bg-white rounded-lg p-6 mb-6 shadow-sm border border-gray-200">
264+
<h3 class="text-xl font-semibold mb-3 text-purple-700">Math Compare: [left] [operator] [operand] is [comparison] [right]</h3>
265+
<p class="text-gray-700 mb-4">Compares a calculated numeric value without creating a separate Logic variable. The left value can be a tag, then the card applies <code>+</code>, <code>-</code>, <code>*</code> or <code>/</code> before comparing against the right value.</p>
266+
267+
<div class="flow-card">
268+
<p class="text-sm text-gray-600 mb-2">Parameters:</p>
269+
<ul class="space-y-2 text-gray-800">
270+
<li><span class="code-inline">left_value</span> - Source value, for example a temperature tag</li>
271+
<li><span class="code-inline">math_operator</span> - Add, subtract, multiply or divide</li>
272+
<li><span class="code-inline">operand_value</span> - Number used by the math operator</li>
273+
<li><span class="code-inline">comparison_operator</span> - Greater than, less than, equal, etc.</li>
274+
<li><span class="code-inline">right_value</span> - Value or tag to compare against</li>
275+
</ul>
276+
</div>
277+
278+
<div class="bg-gray-50 border border-gray-200 rounded p-4 mt-4">
279+
<p class="font-semibold text-purple-700 mb-2">Heat pump / aircondition example:</p>
280+
<p class="text-gray-700"><strong>AND</strong> Temperature + 0 is greater than or equal to low_threshold_livingroom</p>
281+
<p class="text-gray-700"><strong>THEN</strong> Run the Gradient Map branch and set fan speed from the mapped result</p>
282+
</div>
283+
</div>
284+
260285
<!-- Conditional Gate: Check State -->
261286
<div id="condition-gate-check" class="bg-white rounded-lg p-6 mb-6 shadow-sm border border-gray-200">
262287
<h3 class="text-xl font-semibold mb-3 text-purple-700">Gate [gate_name] is [GO/NO GO]</h3>
@@ -435,6 +460,42 @@ <h3 class="text-xl font-semibold mb-3 text-purple-700">Evaluate [[input]] [[op1]
435460
</div>
436461
</div>
437462

463+
<!-- Gradient Map -->
464+
<div id="action-gradient-map" class="bg-white rounded-lg p-6 mb-6 shadow-sm border border-gray-200">
465+
<h3 class="text-xl font-semibold mb-3 text-purple-700">Map [input] in range [from] to [to] into [output from] - [output to]</h3>
466+
<p class="text-gray-700 mb-4">Maps a numeric input from one range into another and returns the result as a <code>Mapped value</code> tag for the next Advanced Flow card. Values outside the input range are clamped, and the result can be rounded to a selected step.</p>
467+
468+
<div class="flow-card">
469+
<p class="text-sm text-gray-600 mb-2">Parameters:</p>
470+
<ul class="space-y-2 text-gray-800">
471+
<li><span class="code-inline">input_value</span> - Current value, for example a temperature tag</li>
472+
<li><span class="code-inline">from_num</span> / <span class="code-inline">to_num</span> - Input range start and end</li>
473+
<li><span class="code-inline">from_num_offset</span> / <span class="code-inline">to_num_offset</span> - Optional offsets, default 0</li>
474+
<li><span class="code-inline">from_out</span> / <span class="code-inline">to_out</span> - Output range start and end</li>
475+
<li><span class="code-inline">round_to</span> - Rounding step, default 1. Examples: 1, 0.5, 0.05, 10</li>
476+
</ul>
477+
<p class="text-sm text-gray-600 mt-3 mb-2">Output token:</p>
478+
<ul class="space-y-2 text-gray-800">
479+
<li><span class="code-inline">Mapped value</span> - The mapped and rounded number. Use this tag from the same Map card branch.</li>
480+
</ul>
481+
</div>
482+
483+
<div class="bg-gray-50 border border-gray-200 rounded p-4 mt-4">
484+
<p class="font-semibold text-purple-700 mb-2">Heat pump / aircondition fan example:</p>
485+
<p class="text-gray-700"><strong>WHEN</strong> Temperature changes</p>
486+
<p class="text-gray-700"><strong>AND</strong> Temperature is less than low_threshold_livingroom</p>
487+
<p class="text-gray-700"><strong>THEN</strong> Set fan speed to 0%</p>
488+
<p class="text-gray-700 mt-3"><strong>WHEN</strong> Temperature changes</p>
489+
<p class="text-gray-700"><strong>AND</strong> Temperature is greater than or equal to low_threshold_livingroom</p>
490+
<p class="text-gray-700"><strong>THEN</strong> Map Temperature in range low_threshold_livingroom to high_threshold_livingroom into 100-500, round to 1</p>
491+
<p class="text-gray-700"><strong>THEN</strong> Set the heat pump fan speed to <span class="code-inline">Mapped value</span></p>
492+
</div>
493+
494+
<div class="bg-blue-50 border-l-4 border-blue-500 p-3 mt-4 rounded">
495+
<p class="text-blue-800 text-sm">If a flow has more than one Map card, choose the <code>Mapped value</code> tag from the Map card on the same branch as the fan-speed action.</p>
496+
</div>
497+
</div>
498+
438499
<!-- Modify Conditional Gate -->
439500
<div id="action-modify-gate" class="bg-white rounded-lg p-6 mb-6 shadow-sm border border-gray-200">
440501
<h3 class="text-xl font-semibold mb-3 text-purple-700">Modify Conditional Gate [gate_name] &rarr; [new_state]</h3>
@@ -647,6 +708,7 @@ <h2 class="text-2xl font-semibold mb-4 text-blue-300">💡 Pro Tips</h2>
647708
<li><strong>Use descriptive formula names:</strong> Makes flow cards more readable (e.g., "security_active" vs "formula1")</li>
648709
<li><strong>Leverage State changed trigger:</strong> Logic Device's state changed trigger is perfect for toggle actions</li>
649710
<li><strong>Test with Evaluate action:</strong> Manually trigger evaluation to test formulas without changing inputs</li>
711+
<li><strong>Use Gradient Map for proportional control:</strong> Map temperatures, humidity, lux or other measurements into a device setting, then pass the <code>Mapped value</code> tag to the next card</li>
650712
<li><strong>Monitor timeouts:</strong> Use timeout triggers to detect sensor failures or missing inputs</li>
651713
</ul>
652714
</div>
@@ -661,4 +723,4 @@ <h2 class="text-2xl font-semibold mb-4 text-blue-300">💡 Pro Tips</h2>
661723
<p>Smart (Components) Toolkit for Homey | <a href="https://github.com/Tiwas/SmartComponentsToolkit" class="text-purple-400 hover:text-purple-300">GitHub</a></p>
662724
</footer>
663725
</body>
664-
</html>
726+
</html>

0 commit comments

Comments
 (0)