Need help customizing a lovelace card for Nest Protect

Hi,

Thank you so much for such a rapid reply. I have managed to get the basic layout working but the images do not pull through.

I enclose an image of what the card looks like in my setup here:

I have used your code but removing bits that relate to your non-Nest smoke alarms. I do not want to burden you but would it be possible to take a look and see where I am going wrong?

I enclose the code I have used below.

type: vertical-stack
cards:
  - type: custom:button-card
    show_name: false
    show_icon: false
    aspect_ratio: 1/1
    extra_styles: |
      @keyframes bgswap_red {
        0% {
          background-image: url("/local/images/protect/nestprotect-grey.png");
        }
        50% {
          background-image: url("/local/images/protect/nestprotect-red.png");
        }
        100% {
          background-image: url("/local/images/protect/nestprotect-grey.png");
        }
      }
      @keyframes bgswap_green {
        0% {
          background-image: url("/local/images/protect/nestprotect-grey.png");
        }
        50% {
          background-image: url("/local/images/protect/nestprotect-green.png");
        }
        100% {
          background-image: url("/local/images/protect/nestprotect-grey.png");
        }
      }
      @keyframes bgswap_yellow {
        0% {
          background-image: url("/local/images/protect/nestprotect-grey.png");
        }
        50% {
          background-image: url("/local/images/protect/nestprotect-yellow.png");
        }
        100% {
          background-image: url("/local/images/protect/nestprotect-grey.png");
        }
      }
      @keyframes bgswap_grey {
        0% {
          background-image: url("/local/images/protect/nestprotect-grey.png");
        }
        100% {
          background-image: url("/local/images/protect/nestprotect-grey.png");
        }
      }
    styles:
      card:
        - animation: >
            [[[ if (states[entity.entity_id.replace('smoke','heat')].state ==
            'off' && states[entity.entity_id.replace('smoke','co')].state ==
            'off') 
              {
                if (states[entity.entity_id.replace('_smoke_status','_battery_health')].state ==
            'on')
                  return 'bgswap_yellow 2s linear infinite'; 
                else
                  return 'bgswap_grey 2s linear infinite'; 
              }
              else return
            'bgswap_red 2s linear infinite';]]]
        - background-size: cover
    entity: this.entity_id
  - show_name: true
    show_icon: false
    type: custom:button-card
    tap_action:
      action: toggle
    entity: this.entity_id
    styles:
      name:
        - font-size: 12px

It is such a cool build, I would really love to replicate it. However, please do not worry if it is a burden to look through…but any help would be much appreciated.

BW

Richie

are the images accessible?

/local/images/protect/nestprotect-grey.png

which means that the nestprotect-grey.png etc images need to be store in /config/www/images/protect/

Hi

Again, thank you for replying so quickly and pointing out what an idiot I am!

I changed the folder structure and didn’t update the code (teaches me to do things when I am really tired).

It is working brilliantly now:

I still need to do some work on the dashboard but it is getting there.

I would love to be able to single click on each alarm and be able to bring up a “more info” of battery life, sensor checks etc. I really do not know much about the auto entities card and not sure if this is possible.

I am also presuming from what is exposed by the nest protect integration that you cannot silence the alarm from within HA? Do you happen to know if that is the case?

Thank you again for all your help, I really appreciate it!

There are different options, you could either create a specific page with the battery information, or create a group with the battery information in and then use the “more-info” on this group.

I have for example in each room the details of the protect
image

@geertmeersman thank you so much for this and apologies for my slow reply. I am not that used to the community yet. I have managed to get something very similar to work in a browser_mod popup with the lower row coming in conditionally based on pressing the smoke alarm icon. Its no longer autoentities as I couldnt get the combination of browser_mod popup, autoentities and conditional cards to work.

Thanks again for your help!