LordBoos / discord_game

Home Assistant custom component to get online and game status of Discord users
MIT License
57 stars 9 forks source link

[Request] Create entities as disabled #57

Open cdjm opened 5 months ago

cdjm commented 5 months ago

It would be great if the integration would behave a bit more like the previous version. The entity sensor.discord_user_123425 still contains everything needed for monitoring discord friend status.

Maybe we can disable most of the device entities (and keep only sensor.discord_user_123425 enabled) on configuration so they can be enabled when needed?

At the moment all entities need to be filtered for my dashboard card to work.

card:
  title: Discord Online
  type: entities
filter:
  exclude:
    - state: unavailable
    - state: offline
  template: |-
    {% for state in states.sensor -%}
      {%- if state.entity_id | regex_match("^sensor.discord_user_[0-9]+$", ignorecase=False) -%}
        {{
          {
            'entity': state.entity_id,
            'name': state.attributes.user_name,
            'type': "custom:secondaryinfo-entity-row",
            'secondary_info': state_attr(state.entity_id, 'game')
          }
        }},
      {%- endif -%}
    {%- endfor -%}
type: custom:auto-entities
else:
  title: Discord Online
  type: markdown
  content: Nobody online :-(
LordBoos commented 5 months ago

I will add option to add entities as disable to the configuration flow (if it is possible in HA).