How to get device info into lovelace template

Hi guys.

How would I be able to get device information into a template in Lovelace ?

For example, i have a Synology below:

Is there a way to get the Device info “DS918+” and Frimware into a template for my lovelace dashboard?

make a sensor or markdown card

Well in this example it works. Because you can get the firmware version from a different entity attribute.

But for example the “DS918+” is shown in device info, but no where to be found in the entity states or attributes.

You can see where the data lies with this template. Just replace device with whatever your entity_id or device_id is.

{% set device = 'light.cabinet_wled' %}
{% set attrs = [
  "configuration_url",
  "disabled_by",
  "entry_type",
  "manufacturer",
  "model",
  "name",
  "suggested_area",
  "sw_version",
  "via_device_id",
  "area_id",
  "name_by_user",
  "is_new",
  "identifiers",
  "connections",
  "config_entries",
] %}
{% for attr in attrs %}
{{ attr }}: {{ device_attr(device, attr) }}
{%- endfor %}

Pretty sure that’s the sw_version, so you could skip that template and just use

{{ device_attr('light.cabinet_wled', "sw_version") }}

Well thanks!

Using that template gives me all the information I need.

So in this example I used this tempate to find all attributes:

{% set device = 'update.ds918_dsm_update' %}
{% set attrs = [
  "configuration_url",
  "disabled_by",
  "entry_type",
  "manufacturer",
  "model",
  "name",
  "suggested_area",
  "sw_version",
  "via_device_id",
  "area_id",
  "name_by_user",
  "is_new",
  "identifiers",
  "connections",
  "config_entries",
] %}
{% for attr in attrs %}
{{ attr }}: {{ device_attr(device, attr) }}
{%- endfor %}

Which results in:

configuration_url: https://10.0.0.100:5001
disabled_by: None
entry_type: None
manufacturer: Synology
model: DS918+
name: DS918
suggested_area: None
sw_version: DSM 6.2.4-25556 Update 6
via_device_id: None
area_id: it
name_by_user: None
is_new: False
identifiers: {('synology_dsm', '19A0PDN111206')}
connections: set()
config_entries: {'ede6b6f1365d3f6a303254e77f13c645'}

Narrowing down on the model:

{{ device_attr('update.ds918_dsm_update', 'model') }}

which results in:

DS918+

2 Likes

Sorry Bert, but this was not solved by you in #6 but by @petro in #4.
You merely adapted it for your needs.
Credit where credit is due.