Changes required for 2-tap-or-toggle-dont-work-on-venu-2

Made the 'service' field for taps mandatory.
This makes scripts work for both the emulator and real devices.
Provide a response for automations started with a tap, and now they can be used for both tap and toggle.
This commit is contained in:
Philip Abbey
2023-11-14 08:35:38 +00:00
parent c57324f7ad
commit 2ccd2bfbff
3 changed files with 47 additions and 29 deletions

View File

@ -34,7 +34,8 @@ Example schema as shown in the images:
{
"entity": "script.food_on_table",
"name": "Food is Ready!",
"type": "tap"
"type": "tap",
"service" : "script.turn_on"
},
{
"entity": "light.bedside_light_switch",
@ -79,6 +80,12 @@ Example schema as shown in the images:
"name": "Garage Door Check",
"type": "toggle"
},
{
"entity": "automation.turn_off_usb_chargers",
"name": "Turn off USBs",
"type": "tap",
"service" : "automation.trigger"
},
{
"entity": "scene.tv_light",
"name": "TV Lights Scene",
@ -99,6 +106,18 @@ The example above illustrates how to configure:
* Service invocation, e.g. Scene setting, (tap)
* A sub-menu to open (tap)
The example JSON shows an example usage of each of these Home Assistance entity types. Presently, an automation is the only one that can be either a 'tap' or a 'toggle'.
| HA Type | Tap | Toggle |
|------------|:---:|:------:|
| Switch | N | Y |
| Light | N | Y |
| Automation | Y | Y |
| Script | Y | N |
| Scene | Y | N |
NB. All 'tap' items must specify a 'service' tag.
Possible future extensions might include specifying the alternative texts to use instead of "On" and "Off", e.g. "Locked" and "Unlocked" (but wouldn't having locks operated from your watch be a security concern ;-))
The [schema](https://raw.githubusercontent.com/house-of-abbey/GarminHomeAssistant/main/config.schema.json) is checked by using a URL directly back to this GitHub source repository, so you do not need to install that file. You can just copy & paste your entity names from the YAML configuration files used to configure Home Assistant. With a submenu, there's a difference between "title" and "name". The "name" goes on the menu item, and the "title" at the head of the submenu. If your dashboard definition fails to meet the schema, the application will simply drop items with the wrong field names without warning.