thomasloven / lovelace-auto-entities

🔹Automatically populate the entities-list of lovelace cards
MIT License
1.26k stars 115 forks source link

FR: add update_interval #413

Open Mariusthvdb opened 8 months ago

Mariusthvdb commented 8 months ago

continued from https://github.com/thomasloven/lovelace-card-mod/issues/333#issuecomment-1880955416

having a broad set of auto-entities cards in my config, there is 1 aspect that I sometimes need/want to control and we currently can't:

Update interval.

I am aware ofc this is an auto-entities, in the sense it auto lists entities, but also listens to the states of those entities to do its job. And perfectly so. However, we are confronted with very chatty entities sometimes, and HA can't control those updates from core.

example: several BT sensors with connection strength entities update several times per second, and when grouped in an auto-entities card that starts looking like Christmas, even without card-modding icon and color, but all the more so if we do (Bdraco had a look and was able to tune down the temp sensors on these devices (was a rounding issue), but strength is just as is. ):

type: custom:auto-entities
card:
  type: entities
  title: Hygro temp
filter:
  include:
    - entity_id: sensor.*_hygro_temp_signal_strength
      options:
        card_mod:
          style: |
            :host {
              {% set signal = states(config.entity)|int(default=0) %}
              --card-mod-icon:
                {% if signal == 'unknown' %} mdi:help
                {% elif signal >= -50 %} mdi:wifi-strength-4
                {% elif signal >= -60 %} mdi:wifi-strength-3
                {% elif signal >= -67 %} mdi:wifi-strength-2
                {% elif signal >= -70 %} mdi:wifi-strength-1
                {% elif signal >= -80 %} mdi:wifi-strength-outline
                {% else %} mdi:wifi-strength-alert-outline
                {% endif %};
              --paper-item-icon-color:
                {% if signal == 'unknown' %} gray
                {% elif signal >= -50 %} darkgreen
                {% elif signal >= -60 %} green
                {% elif signal >= -67 %} lightgreen
                {% elif signal >= -70 %} gold
                {% elif signal >= -80 %} orange
                {% else %} maroon
                {% endif %};
            }
sort:
  method: state

https://github.com/thomasloven/lovelace-auto-entities/assets/33354141/3d1a4745-3e16-44d1-a59c-a8789a1f83a6

Updating these once a minute would more than suffice and safe a lot of changes in the Dashboard.

Obviously I checked the last_changed option again better knowledge:

          - entity_id: sensor.*_hygro_temp_signal_strength
            last_changed: '> 1'

and indeed that has not the desired effect, as it only lists the entities changed more than 1 minute ago....

Please consider adding an update_interval, for which I kindly refer to what Apexcharts does

Hope you can have a look, thanks1

AJolly commented 7 months ago

This would be great, I'd like a dashboard with all my devices by last update - but right now it keeps autorefreshing, and I have lots of chatty devices.