Ok, I have a soultion now:
Shows a list of unavailable Matter devices.
This is most likely due to connection issues or an empty battery.
Shows battery powered devices with an explicit badge icon.
- Primary Device Type Dictionary
As it seems not possible to get the “primary” entity of a device in home assistant a dictionary of devices has to be maintained in order for the report to show correct icons.
An example with devices I own is already added in the UI code.
As you can see on Eve Systems 77 a device could have multiple device classes based on what is configured on the device.
set manufacturerDeviceClasses =
{
'Eve Systems': {
'77': ['door', 'window'],
'79': ['temperature'],
'80': ['outlet'],
'87': ['temperature'],
'89': ['motion']
},
'Nanoleaf': {
'67': ['light'],
'68': ['light'],
'71': ['light']
},
'Sunricher': {
'257': ['light']
}
}
Code 1: Dictionary of device model IDs primary device types per manufacturer.
As it seems not possible to get an entities current icon in home assistant a dictionary of deviceClasses with the desired icon has to be maintained in order for the report to show correct icons.
An example with device types I own is already added in the UI code.
set icon = {
'temperature': 'mdi:thermostat',
'motion': 'mdi:motion-sensor',
'door': 'mdi:door',
'window': 'mdi:window-closed',
'light': 'mdi:lightbulb',
'outlet': 'mdi:power-socket-de'
}
Code 2: Dictionary of device types designated icon.
- HACS

- Auto Entities (For creating a list of entities by code)

- Mushroom (For populating a tile for each matter device)

- Easy Time (For showing a meaningful value in last updated)

- Custom Brand Icons (For having a matter icon)

- Input Helper (For selecting if additional information is shown)

Name: show_matter_debug_information
type: grid
cards:
- type: heading
heading: Matter Devices
heading_style: subtitle
icon: phu:matter
- type: tile
entity: input_boolean.show_matter_debug_information
features_position: bottom
vertical: false
grid_options:
columns: full
tap_action:
action: toggle
icon_tap_action:
action: toggle
hide_state: true
- type: custom:auto-entities
card:
type: vertical-stack
card_param: cards
show_empty: false
filter:
template: |-
{%- from 'easy_time.jinja' import big_relative_time -%}
{#-
{
'Eve Systems': {
'77': 'Eve Door 20EBN9901'
'79': 'Eve Thermo 20EBP1701'
'80': 'Eve Energy 20EBO8301'
'87': 'Eve Weather 20EBS9901'
'89': 'Eve Motion 20EBY9901'
},
Nanoleaf: {
'67': 'Essentials A19/A60'
'68': 'Essentials Lightstrip'
'71': 'Essentials Holiday String Lights'
},
Sunricher: {
'257': 'MT-RGBCCT'
}
}
-#}
{%-
set manufacturerDeviceClasses =
{
'Eve Systems': {
'77': ['door', 'window'],
'79': ['temperature'],
'80': ['outlet'],
'87': ['temperature'],
'89': ['motion']
},
'Nanoleaf': {
'67': ['light'],
'68': ['light'],
'71': ['light']
},
'Sunricher': {
'257': ['light']
}
}
-%}
{%-
set icon = {
'temperature': 'mdi:thermostat',
'motion': 'mdi:motion-sensor',
'door': 'mdi:door',
'window': 'mdi:window-closed',
'light': 'mdi:lightbulb',
'outlet': 'mdi:power-socket-de'
}
-%}
{%-
set device_ids = states
| selectattr('entity_id', 'in', integration_entities('matter'))
| selectattr('attributes.device_class', 'ne', 'firmware')
| selectattr('state', 'eq', 'unavailable')
| map(attribute='entity_id')
| map('device_id')
| unique
-%}
{%- for device_id in device_ids -%}
{%- set deviceEntities = expand(device_entities(device_id)) -%}
{%- set deviceClasses = manufacturerDeviceClasses.get(device_attr(device_id, 'manufacturer'), {'default': ''}).get(device_attr(device_id, 'model_id'), ['']) -%}
{%-
set batteryEntity = deviceEntities
| selectattr('attributes.device_class', 'eq', 'battery')
| map(attribute='entity_id')
| first
-%}
{%-
set primaryEntity = deviceEntities
| selectattr('attributes.device_class', 'in', deviceClasses)
| map(attribute='entity_id')
| first
| default('zone.home')
-%}
{%- if 'temperature' in deviceClasses -%}
{%-
set primaryEntity = deviceEntities
| selectattr('attributes.device_class', 'in', deviceClasses)
| selectattr('attributes.state_class', 'in', 'measurement')
| map(attribute='entity_id')
| first
| default('zone.home')
-%}
{%- endif -%}
{%- if 'light' in deviceClasses -%}
{%-
set primaryEntity = deviceEntities
| selectattr('domain', 'in', deviceClasses)
| map(attribute='entity_id')
| first
| default('zone.home')
-%}
{%- set primaryDeviceClass = 'light' | string -%}
{%- else -%}
{%- set primaryDeviceClass = state_attr(primaryEntity, 'device_class') | string -%}
{%- endif -%}
{%- set details = '' -%}
{%- set lastChanged = big_relative_time(states[primaryEntity]['last_updated'], language='en') | trim -%}
{%- set badgeIcon = 'mdi:alert' -%}
{%- set badgeColor = 'yellow' -%}
{%- if batteryEntity is defined -%}
{%- set badgeIcon = 'mdi:battery-alert' -%}
{%- set badgeColor = 'red' -%}
{%- endif -%}
{%- if is_state('input_boolean.show_matter_debug_information', 'on') -%}
{%-
set details = '\nHersteller: ' + device_attr(device_id, 'manufacturer')
+ '\nModel-ID: ' + device_attr(device_id, 'model_id')
+ '\nDevice Class: ' + primaryDeviceClass
+ '\nPrimary Sensor: ' + primaryEntity
-%}
{%- endif %}
{{-
{
'type': 'custom:mushroom-template-card',
'primary': device_attr(device_id, 'name_by_user'),
'secondary': 'Room: ' + area_name(device_id)
+ '\nLast Update: ' + lastChanged
+ details,
'entity': primaryEntity,
'icon': icon.get(primaryDeviceClass, 'mdi:alert'),
'badge_icon': badgeIcon,
'badge_color': badgeColor,
'multiline_secondary': true,
'tap_action': {
'action': 'none'
},
'hold_action': {
'action': 'none'
},
'double_tap_action': {
'action': 'none'
}
}
-}},
{%- endfor -%}
sort:
method: name
visibility:
- condition: state
entity: binary_sensor.matter_unavailable_warning_exists
state: "on"
Code 3: Code of the unavailable matter device report as grid.
What it looks like (German Version)
Image 1: Report without additional information.
Image 2: Report with additional information.