UAU! Thanks a lot! That looks outstanding!
I wish i would be as siklled programmer as you, guys… but, a man can’t have it all, correct? I’m more in electronics hardware then in software.
EDIT: i play with this addon a bit and i managed to sort entites alphabetically - just add
sort_by: [devices+]
to main code.
To alter font size css code is used:
Above code sets font of devices to 12px, line height to 15px and font in line “NAMES” to 20px. ANd adds a border around all devices list.
nice card, indeed!
I was able to incorporate the list for the ‘Connected Devices’ entity into a ‘Fold Entity Row Card’ using the ‘Flex Table Card’. I was only able to get this to work because of the specific config settings that can be used with the ‘Flex Table Card’, so thanks to the creator of that card as well as the HA-ASUS Router integration! Screenshot and code below…
I’ve been manually going in and disabling these entities one-by-one since it has been causing so many issues with my Kasa Devices’ connectivity (don’t ask - long story that has nothing to do with your Integration).
[BREAKING] With version 0.9.0 (when released), the devices attribute of the Connected devices sensor will change the format from a list of strings to a list of dictionaries. As a result, you will need to correct your templates.
I am attaching new versions you will need instead of the 2 types of code we discussed before.
Template with tabs alignment
{% set ns = namespace(
devices = state_attr('sensor.rt_ax88u_connected_devices', 'devices'),
max_length = 0,
max_tabs = 0)
%}
{# Save the maximum length of device names #}
{% for item in state_attr('sensor.rt_ax88u_connected_devices', 'devices') %}
{%- if item.name|length > ns.max_length %}
{%- set ns.max_length = item.name|length %}
{%- endif %}
{% endfor %}
{# Sort #}
{%- set ns.devices = ns.devices|sort(attribute="name", case_sensitive=true) %}
{%- set ns.max_tabs = (ns.max_length / 8)|int %}
{# Output #}
{% for device in ns.devices %}
{{- device.name }}
{%- set tabs = (device.name|length / 8) | int %}
{%- for tab in ['\t']|batch(ns.max_tabs - tabs + 1, '\t') %}
{%- for el in tab %}
{{- el }}
{%- endfor %}
{%- endfor %}
{{- device.ip + '\t' + device.mac }}
{% endfor %}
IMPORTANT! A breaking change for the devices attribute of the Connected devices sensor as discussed above. Please, check 2 messages before for the new code examples.
A new possibility - to select a custom update interval for different sensors independently.
Device trackers got many new updates:
you can now disable them;
select their own update interval, independent from all other sensors;
one nasty bug was fixed, so fewer errors in your HA logs and fewer freezes of the integration.
Many code optimizations to faster work on it and decrease the time for bug fixes.
Was reading through the GitHub notes and you can add model 4G-AC55U to your list as the component works perfectly on this model with stock firmware (sorry, should have let you know that sooner)
Quick slightly off topic Q…anyone know if is it possible to sort the Flex Table Card by IP Address?
As the same field is used for the three columns I don’t think the sort key will make any difference.
But I believe it always sort the first column (if no other instruction), then you can move IP for the first column. Is that OK?
Yes, @EdwardTFN is right, you can use a hidden column. Also, there is no need to assign a name to it. After upgrading to version 0.9.0 of the integration the code will be like this:
Brilliant, thanks to you both for that @Vaskivskyi @EdwardTFN
Sometimes it’s the obvious solution that’s hardest to find . Think I need more coffee
Thanks again.
Thanks for the update! But, for some reason the “Connected Devices” is now showing 0 (see screenshot). And under attributes, there are no devices listed. Any idea as to why this is?
I deleted the “Integration” and re-installed it (Note: I did NOT uninstall the HACS portion; just the Integration) with no effect. I restarted the RPi (running Home Assistant OS) a few times so far without any luck. I’ll try re-installing the HACS Add-On (and the Integration as well) to see if that fixes it.
Edit 1: I just rebooted my ASUS Router to see if maybe a refresh was needed, but unfortunately that wasn’t it either.
Edit 2: For reference, my router model is an RT-AX58U.
Edit 3: I reinstalled the HACS Add-On and then the Integration - no luck. I have a thought as to why I am running into the problem… could it be that enabling ‘Device Trackers’ is required for this to work?
I am sorry for this. It is really the case, that if the device tracking is disabled, the connected devices sensor stops working, which I didn’t consider before. The fix will be released today
@Vaskivskyi Thank you! I updated it and all is working very, very well! I am definitely buying you a cup of coffee (Edit: Just sent you a few cups of coffee ) - I don’t think I’ve ever seen a developer so active with the community regarding their Integration/Add-On, especially one that specifically updates their project just to fix one thing for ONE individual. Thank you again.
As a side note, I did notice higher than normal CPU usage on the RPi, however I have yet to investigate. It is unlikely that this Integration is the cause, but just wanted to throw it out there.
I did a reboot of the RPi and the usage dropped back to normal parameters - all is well!