Latest Devices connected #517
-
Sorry for the very noob question. Is there a way to display the latest devices connected (preferably) with ip address or device name on lovelace card? |
Beta Was this translation helpful? Give feedback.
Answered by
Vaskivskyi
Feb 4, 2023
Replies: 1 comment
-
Hey, @tismofied, Yes, you can do it using e.g. Codetype: entities
entities:
- type: custom:text-divider-row
text: Last 5 Connected Devices
align: left
card_mod:
style: |
h2.text-divider span {
background: #1A1A1A;
}
:host {
height: 0px;
}
- type: custom:flex-table-card
sort_by:
- list-
entities:
include: sensor.rt_ax88u_latest_connected
columns:
- data: list
modify: x.connected
hidden: true
- data: list
name: ' Device Name'
icon: mdi:devices
modify: x.name
- data: list
name: ' Address'
icon: mdi:ip-network
modify: x.ip
- data: list
name: ' Type'
icon: mdi:wifi-arrow-up-down
modify: x.connection_type
- data: list
name: ' Time'
icon: mdi:clock
modify: |
var date = (new Date(x.connected)).toJSON();
var dateRegex = /^([\d-]{10})T.*$/
var dateData = dateRegex.exec(date);
var timeRegex = /^.*T([\d:]{8}).*$/
var timeData = timeRegex.exec(date);
dateData[1]+" "+timeData[1]
card_mod:
style: |
ha-card {
background: none;
padding: 0px;
spacing: 0px;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
tismofied
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, @tismofied,
Yes, you can do it using e.g.
flex-table-card
. In this example, the data is sorted by the connection time attribute (by the hidden 1 column)Code