mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 07:17:14 +00:00
Add template function: device_name (#38476)
This commit is contained in:
parent
d368498f3d
commit
1a67539466
@ -427,6 +427,7 @@ The same thing can also be expressed as a test:
|
|||||||
- `device_attr(device_or_entity_id, attr_name)` returns the value of `attr_name` for the given device or entity ID. Can also be used as a filter. Not supported in [limited templates](#limited-templates).
|
- `device_attr(device_or_entity_id, attr_name)` returns the value of `attr_name` for the given device or entity ID. Can also be used as a filter. Not supported in [limited templates](#limited-templates).
|
||||||
- `is_device_attr(device_or_entity_id, attr_name, attr_value)` returns whether the value of `attr_name` for the given device or entity ID matches `attr_value`. Can also be used as a test. Not supported in [limited templates](#limited-templates).
|
- `is_device_attr(device_or_entity_id, attr_name, attr_value)` returns whether the value of `attr_name` for the given device or entity ID matches `attr_value`. Can also be used as a test. Not supported in [limited templates](#limited-templates).
|
||||||
- `device_id(entity_id)` returns the device ID for a given entity ID or device name. Can also be used as a filter.
|
- `device_id(entity_id)` returns the device ID for a given entity ID or device name. Can also be used as a filter.
|
||||||
|
- `device_name(lookup_value)` returns the device name for a given device ID or entity ID. Can also be used as a filter.
|
||||||
|
|
||||||
#### Devices examples
|
#### Devices examples
|
||||||
|
|
||||||
@ -444,6 +445,11 @@ The same thing can also be expressed as a test:
|
|||||||
{{ device_id('sensor.sony') }} # deadbeefdeadbeefdeadbeefdeadbeef
|
{{ device_id('sensor.sony') }} # deadbeefdeadbeefdeadbeefdeadbeef
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
{{ device_name('deadbeefdeadbeefdeadbeefdeadbeef') }} # Sony speaker
|
||||||
|
{{ device_name('sensor.sony') }} # Sony speaker
|
||||||
|
```
|
||||||
|
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
|
||||||
### Config entries
|
### Config entries
|
||||||
|
Loading…
x
Reference in New Issue
Block a user