Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the possibility to set up icons as entity names - similar to headings #112

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

thedeemling
Copy link

@thedeemling thedeemling commented Apr 18, 2021

In my use case, icons were much more readible than the simple text heading, so I wanted to update the behaviour.

It looks like this:
image

And inside the code it looks like:

      - type: custom:banner-card
        background: 'url("/local/pictures/views/bedroom.png") center center no-repeat, #84bf94; background-size: cover'
        heading:
          - mdi:bed-empty
          - Bedroom
        entities:
          - entity: sensor.netatmo_home_nordi_temperature
            # Here is the change
            name:
              - mdi:thermometer
              - Temperature
          - entity: sensor.netatmo_home_nordi_co2
            name: mdi:molecule-co2
          - entity: sensor.netatmo_home_nordi_humidity
            name: mdi:water-percent
          - entity: sensor.netatmo_home_nordi_noise
            name: mdi:account-music
          - entity: sensor.netatmo_home_nordi_pressure
            name: Pressure
          - entity: media_player.cookie

As you can see in the screenshot, I have tested the option to set up the simple icon, then icon + text, then simple text.

@@ -35,10 +35,23 @@ function createElement(tag, config, hass) {
}

function entityName(name, onClick = null) {
if (!Array.isArray(name)) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want, I can move this part to the function to make it more robust and reusable (the same logic, but a little different) is used in the heading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants