From df3be94bf94e6cc557271928ff09b86d83ecafd5 Mon Sep 17 00:00:00 2001 From: Philip Abbey Date: Thu, 29 Aug 2024 23:12:13 +0100 Subject: [PATCH] Documentation for v2.19 --- HISTORY.md | 2 +- examples/Actions.md | 2 +- examples/Switches.md | 11 +++++++++++ examples/Templates.md | 14 ++++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 3cbb31f..ac6f67e 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -31,4 +31,4 @@ | 2.16 | Bug fix for lack of phone connection when starting the application. Includes new activity reporting features from [KPWhiver](https://github.com/KPWhiver) covering steps, heart rate, floors climbed and descended, and respiration rate. | | 2.17 | Bug fix for reporting activity metrics that are not found on some devices. | | 2.18 | Bug fix for reporting activity metrics that might be `null` sometimes. This is unsimulatable situation, so this version is a change based on an informed guess. | -| 2.19 | A template to evaluate is now optionally allowed on both `group` and `toggle` menu items. The template to evaluate is non-optional on a `template` menu item. | +| 2.19 | A template to evaluate is now optionally allowed on both `group` and `toggle` menu items. The template to evaluate is non-optional on a `template` menu item. All updates are performed in a single HTTP GET request for efficiency. Bug fix for negative heading values. Vibration now (optionally) confirms toggle menu items being tapped. | diff --git a/examples/Actions.md b/examples/Actions.md index 68190db..3d840c0 100644 --- a/examples/Actions.md +++ b/examples/Actions.md @@ -2,7 +2,7 @@ # Actions -A simple example using a scene as a `tap`` menu item. +A simple example using a scene as a `tap` menu item. ```json { diff --git a/examples/Switches.md b/examples/Switches.md index fe7e22a..2488316 100644 --- a/examples/Switches.md +++ b/examples/Switches.md @@ -43,6 +43,17 @@ Then you can use the following in your config: } ``` +And you can optionally include a template to reflect some status. See [Templates](Templates.md) for details on hwo to use this JSON field. + +```json +{ + "entity": "switch.", + "name": "", + "type": "toggle", + "content": "..." +} +``` + ## Example - Covers ```yaml diff --git a/examples/Templates.md b/examples/Templates.md index c1ff923..c6ec771 100644 --- a/examples/Templates.md +++ b/examples/Templates.md @@ -118,6 +118,20 @@ Note: Only when you use the `tap_action` field do you also need to include the ` } ``` +## Group and Toggle Menu Items + +Both `group` and `toggle` menu items accept an optional `content` field as of v2.19. This allows the use of templates to present status information. + +```json + { + "name": "Each Lounge Light", + "title": "Lounge", + "type": "group", + "content": "{{'On: %d, Off: %d'|format(expand(state_attr('light.living_room_lights', 'entity_id'))|selectattr('state','eq','on')|map(attribute='entity_id')|list|count, expand(state_attr('light.living_room_lights', 'entity_id'))|selectattr('state','eq','off')|map(attribute='entity_id')|list|count)}}", + "items": [..] + } +``` + ## Advanced Here we generate a bar graph of the battery level. We use the following steps to do this: