-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
Hi,
Thanks for your great work. It iis so usefull.
I need to use the row number of the table.
As it is not avalaible I have to create template sensor like this:
- unique_id: mesh_online_devices_indexed
name: Linksys Mesh Online Devices Indexed
state_class: measurement
unit_of_measurement: devices
state: >
{{ state_attr('sensor.linksys_mesh_online_devices','devices') | count }}
attributes:
devices: >
{% if state_attr('sensor.linksys_mesh_online_devices','devices') != None -%}
{% set original = state_attr('sensor.linksys_mesh_online_devices','devices') | sort(attribute='ip') -%}
{% set ns = namespace(items=[]) -%}
{% for d in original -%}
{% set ns.items = ns.items + [d | combine({'idx': loop.index})] -%}
{% endfor -%}
{{ ns.items }}
{% else -%}
[]
{% endif -%}
So that in the table I can expose the idx attribute:
- type: custom:flex-table-card
entities:
include: sensor.linksys_mesh_offline_devices_indexed
disable_header_sort: true
columns:
- name: '#'
data: devices.idx
- name: Name
data: devices.name
- name: Id
data: devices.id
hidden: true
- name: Action
align: center
data: devices.id
modify: '''<ha-icon icon="mdi:trash-can-outline">'''
tap_action:
action: perform-action
perform_action: linksys_velop.delete_device
data:
mesh: '8cac543ed98af301c852f6c453162342'
device: col[2]
target: {}
confirmation:
text: 'Confirmez-vous la suppression ?'
css:
table: "border: 0px; padding: 4px; width: 100%;"Thanks and regards.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels