Merge branch 'main' into 315-add-screenshots-to-numericmd

Signed-off-by: Philip Abbey <philipabbey@users.noreply.github.com>
This commit is contained in:
Philip Abbey
2025-11-04 20:50:24 +00:00
committed by GitHub
24 changed files with 563 additions and 234 deletions

View File

@@ -11,7 +11,7 @@ A simple example using a scene as a `tap` menu item.
"name": "Telly Scene",
"type": "tap",
"tap_action": {
"service": "scene.turn_on"
"action": "scene.turn_on"
}
},
```
@@ -70,7 +70,7 @@ Note that for notify events, you _must_ not supply an `entity_id` or the API cal
"name": "Message",
"type": "tap",
"tap_action": {
"service": "notify.mobile_app_on_phone",
"action": "notify.mobile_app_on_phone",
"data": {
"title": "This is a title",
"message": "This is the message"
@@ -81,9 +81,9 @@ Note that for notify events, you _must_ not supply an `entity_id` or the API cal
```
> [!IMPORTANT]
> Be careful with the value of the `service` field.
> Be careful with the value of the `action` field.
Note that the `service` field will need to be a locally custom `script.<something>` as soon as any `data` fields are populated and not something more generic like `script.turn_on`. If the `service` field is wrong, the application will fail with a [`Communications.INVALID_HTTP_BODY_IN_NETWORK_RESPONSE`](https://developer.garmin.com/connect-iq/api-docs/Toybox/Communications.html) error in the response from your HomeAssistant and show the error message as _"No JSON returned from HTTP request"_ on your device. In the [web-based editor](https://house-of-abbey.github.io/GarminHomeAssistant/web/) you can use the standard developer tools to observe an `HTTP 400` error which the application does not see. Here we are limited by the [Garmin Connect IQ](https://developer.garmin.com/connect-iq/overview/) software development kit (SDK). We do not have enough information at the point of execution in the application to determine the cause of the error. Nor is there an immediately obvious way of identifying this issue using the JSON schema checks.
Note that the `action` field will need to be a locally custom `script.<something>` as soon as any `data` fields are populated and not something more generic like `script.turn_on`. If the `action` field is wrong, the application will fail with a [`Communications.INVALID_HTTP_BODY_IN_NETWORK_RESPONSE`](https://developer.garmin.com/connect-iq/api-docs/Toybox/Communications.html) error in the response from your HomeAssistant and show the error message as _"No JSON returned from HTTP request"_ on your device. In the [web-based editor](https://house-of-abbey.github.io/GarminHomeAssistant/web/) you can use the standard developer tools to observe an `HTTP 400` error which the application does not see. Here we are limited by the [Garmin Connect IQ](https://developer.garmin.com/connect-iq/overview/) software development kit (SDK). We do not have enough information at the point of execution in the application to determine the cause of the error. Nor is there an immediately obvious way of identifying this issue using the JSON schema checks.
## Exit on Tap
@@ -95,9 +95,9 @@ You can choose individual items that will quit after they have completed their a
"name": "Turn off Stuff",
"type": "tap",
"tap_action": {
"service": "automation.trigger"
"action": "automation.trigger",
"exit": true
},
"exit": true
}
```
@@ -111,7 +111,7 @@ If you would like to temporarily disable an item in your menu, e.g. for seasonal
"name": "Turn off Stuff",
"type": "tap",
"tap_action": {
"service": "automation.trigger"
"action": "automation.trigger"
},
"enabled": false
}

View File

@@ -75,6 +75,6 @@ The following shows the default glance when the menu file is not available at th
<img src="../images/Venu2_glance_no_menu.png" width="200" title="Venu 2 Glance showing errors"/>
Once the custom glance template has been retrieved and evaluated the display will change. Should the connectivity to your Home Assistant then be lost, e.g. you move out of range of your phone, the glance reflects this in the colour of the residual two rectangles. The top one remains an indicator for the API, and the bottom rectangle remains an indicator for the menu availability, reflecting the original placement in the default glance view that has now been replaced.
Once the custom glance template has been retrieved and evaluated the display will change. Should the connectivity to your HomeAssistant then be lost, e.g. you move out of range of your phone, the glance reflects this in the colour of the residual two rectangles. The top one remains an indicator for the API, and the bottom rectangle remains an indicator for the menu availability, reflecting the original placement in the default glance view that has now been replaced.
<img src="../images/Venu2_glance_no_bt.png" width="200" title="Venu 2 Glance showing lost connectivity"/>

View File

@@ -41,9 +41,9 @@ It may well be the case that often `attribute` and `data_attribute` are the same
## Helper
You might define a "helper" entity as follows in Home Assistant:
You might define a "helper" entity as follows in HomeAssistant:
<img src="../images/my_float.png" width="400" title="Home Assistant Helper definition for an 'input_number'." style="margin:5px"/>
<img src="../images/my_float.png" width="400" title="HomeAssistant Helper definition for an 'input_number'." style="margin:5px"/>
In this case, the state is the actual value, so the template uses `states(..)` instead of `state_attr(..)`, you must not set the optional `attribute` value in the JSON definition so that the application uses the correct template internally for querying the HA server for its present value. Your own template definition in the `content` field will need to follow suit too. The `data_attribute` must be set to `value` for the service call that sets the chosen value from the number carousel.
@@ -92,7 +92,7 @@ The complication here is this amplifier uses one scale for changing the value, a
The above is a little awkward to change the volume as the picker's scale is unfamiliar. To make life easier you might choose to implement a "Template number" in HomeAssistant as defined in the following dialogue box.
<img src="../images/template_number.png" width="500" title="Home Assistant Helper definition for an 'input_number'." style="margin:5px"/>
<img src="../images/template_number.png" width="500" title="HomeAssistant Helper definition for an 'input_number'." style="margin:5px"/>
For copy and paste, the Jinja2 fields are as follows:
@@ -164,4 +164,4 @@ The JSON menu definition can now use dB with the new template number as follows.
Specific to this menu item:
1. If the number picker does not initialise with the correct value, amend the `attribute` field. Just because your template renders does not mean the application has extracted the numeric value as the `content` template is rendered on the Home Assistant server.
1. If the number picker does not initialise with the correct value, amend the `attribute` field. Just because your template renders does not mean the application has extracted the numeric value as the `content` template is rendered on the HomeAssistant server.

View File

@@ -48,12 +48,12 @@ switch:
friendly_name: <name>
value_template: <value>
turn_on:
service: <service>
action: <action>
data:
entity_id: <entity>
<attribute>: <value>
turn_off:
service: <service>
action: <action>
data:
entity_id: <entity>
<attribute>: <value>
@@ -90,11 +90,11 @@ switch:
friendly_name: Cover
value_template: "{{ is_state('cover.cover', 'open') }}"
turn_on:
service: cover.open_cover
action: cover.open_cover
data:
entity_id: cover.cover
turn_off:
service: cover.close_cover
action: cover.close_cover
data:
entity_id: cover.cover
```
@@ -118,7 +118,9 @@ You can choose individual items that will quit after they have completed their a
"entity": "light.hall_light",
"name": "Hall Light & Quit",
"type": "toggle",
"exit": true
"tap_action" {
"exit": true
}
}
```

View File

@@ -116,7 +116,7 @@ Note: Only when you use the `tap_action` field do you also need to include the `
"type": "tap",
"content": "{% if is_state('binary_sensor.garage_connected', 'on') %}{{state_translated('cover.garage_door')}} - {{state_attr('cover.garage_door', 'current_position')}}%{%else%}Unconnected{% endif %}",
"tap_action": {
"service": "cover.toggle",
"action": "cover.toggle",
"pin": true
}
}
@@ -173,7 +173,7 @@ An example of a dimmer light with 4 brightness settings 0..3. Here our light wor
"type": "tap",
"content": "{% if not (is_state('light.green_house', 'off') or is_state('light.green_house', 'unavailable')) %}{{ (((state_attr('light.green_house', 'brightness') | float) / 255 * 100) | round(0)) | int }}%{% else %}Off{% endif %}",
"tap_action": {
"service": "light.turn_on",
"action": "light.turn_on",
"data": {
"brightness_pct": 12
}
@@ -184,7 +184,7 @@ An example of a dimmer light with 4 brightness settings 0..3. Here our light wor
"name": "LEDs 1",
"type": "tap",
"tap_action": {
"service": "light.turn_on",
"action": "light.turn_on",
"data": {
"brightness_pct": 37
}
@@ -196,7 +196,7 @@ An example of a dimmer light with 4 brightness settings 0..3. Here our light wor
"type": "tap",
"content": "{% if not (is_state('light.green_house', 'off') or is_state('light.green_house', 'unavailable')) %}{{ (((state_attr('light.green_house', 'brightness') | float) / 255 * 100) | round(0)) | int }}%{% else %}Off{% endif %}",
"tap_action": {
"service": "light.turn_on",
"action": "light.turn_on",
"data": {
"brightness_pct": 62
}
@@ -208,7 +208,7 @@ An example of a dimmer light with 4 brightness settings 0..3. Here our light wor
"type": "tap",
"content": "{% if not (is_state('light.green_house', 'off') or is_state('light.green_house', 'unavailable')) %}{{ (((state_attr('light.green_house', 'brightness') | float) / 255 * 100) | round(0))| int }}%{% else %}Off{% endif %}",
"tap_action": {
"service": "light.turn_on",
"action": "light.turn_on",
"data": {
"brightness_pct": 87
}