Просмотр исходного кода

docs: accept a YAML comment after the single button toggle state

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jamesread 4 дней назад
Родитель
Сommit
9a2719ffa5

+ 1 - 1
docs/modules/ROOT/examples/solutions/single-button-toggle/config.yaml

@@ -9,7 +9,7 @@ actions:
     shell: |
       set -e
       entity_file=/etc/OliveTin/entities/water_valve.yaml
-      if grep -Eq "^  state: +[\"']?open[\"']? *$" "$entity_file"; then
+      if grep -Eq "^  state: +[\"']?open[\"']?( +#.*)? *$" "$entity_file"; then
         next_state=closed
       else
         next_state=open

+ 1 - 1
docs/modules/ROOT/images/solutions/single-button-toggle/config.yaml

@@ -16,7 +16,7 @@ actions:
     shell: |
       set -e
       entity_file="${{ WATER_VALVE_ENTITY_FILE }}"
-      if grep -Eq "^  state: +[\"']?open[\"']? *$" "$entity_file"; then
+      if grep -Eq "^  state: +[\"']?open[\"']?( +#.*)? *$" "$entity_file"; then
         next_state=closed
       else
         next_state=open

+ 1 - 1
docs/modules/ROOT/pages/solutions/single-button-toggle/index.adoc

@@ -23,7 +23,7 @@ a| image::solutions/single-button-toggle/dashboard-open.png[]
 * The **Toggle valve** action's icon is an `<img>` tag that uses `{{ .CurrentEntity.state }}` as the file name, so state `closed` shows `closed.png` and state `open` shows `open.png`.
 * The action has no `enabledExpression`, so it is never disabled.
 * When it runs, the action reads the current state from the entity file, works out the opposite state, and changes the `state:` line in the file. OliveTin watches entity files, so the dashboard and the icon update as soon as the file changes.
-* Each execution reads the state from the file, not from the dashboard, so a press that runs straight after another still flips the valve, even before OliveTin has reloaded the entity. The state may be written as `open` or `"open"`.
+* Each execution reads the state from the file, not from the dashboard, so a press that runs straight after another still flips the valve, even before OliveTin has reloaded the entity. The state may be written as `open` or `"open"`, and may be followed by a YAML comment.
 * OliveTin runs one execution of an action at a time by default (`maxConcurrent: 1`). A press while the action is still running is blocked, not queued, so it does not flip the valve. Press again once the first execution has finished.
 
 == Icons