|
|
@@ -1,9 +1,9 @@
|
|
|
[#single-button-toggle]
|
|
|
= Single Button Toggle
|
|
|
|
|
|
-A single button toggle controls something that has two states, using just one action. Each press flips the state, and the button's icon changes to show the current state - a "closed" icon when the state is `closed`, and an "open" icon when the state is `open`.
|
|
|
+A single button toggle controls something that has two states, using just one action. Each press flips the state (unless the action is still running from a previous press, see <<how-it-works>>), and the button's icon changes to show the current state - a "closed" icon when the state is `closed`, and an "open" icon when the state is `open`.
|
|
|
|
|
|
-Unlike the xref:solutions/latching-toggle/index.adoc[Latching Toggle], which uses two interlocked actions, the button here is never disabled. It can always be pressed, and it always does the opposite of the current state.
|
|
|
+Unlike the xref:solutions/latching-toggle/index.adoc[Latching Toggle], which uses two interlocked actions, the button here is never disabled. It can always be pressed, and each completed execution does the opposite of the current state.
|
|
|
|
|
|
In OliveTin, the state is stored in an xref:entities/intro.adoc[entity file], which the action updates itself, and the icon is chosen with an xref:action_customization/icons.adoc[image icon] whose file name comes from the entity's state.
|
|
|
|
|
|
@@ -17,6 +17,7 @@ a| image::solutions/single-button-toggle/dashboard-closed.png[]
|
|
|
a| image::solutions/single-button-toggle/dashboard-open.png[]
|
|
|
|===
|
|
|
|
|
|
+[#how-it-works]
|
|
|
== How it works
|
|
|
|
|
|
* The entity file `/etc/OliveTin/entities/water_valve.yaml` holds the state of the valve (`open` or `closed`). It is the single source of truth for the dashboard.
|