dylandoamaral / uptime-card

Minimalistic uptime card for Home Assistant Lovelace UI
266 stars 11 forks source link

Filter for sensors that are down #122

Closed viking2010 closed 2 years ago

viking2010 commented 2 years ago

Hi,

Great card for binary sensors, thank you! Been using it in a new HA implementation, but I was wondering if there was a way to filter the card to only show sensors that are down. I've tried playing with the filter entity card but not had any success so just wondered if this could be something to incorporate as an enhancement?

Cheers

dylandoamaral commented 2 years ago

Hi, I am not really sure to understand your feature request.

The card alone works for one sensor, not for a group of sensors. So you want the card to be printed only if the sensor is down ?

viking2010 commented 2 years ago

Hi, thanks for replying. I'll try to clarify a little more.

I use the uptime card for multiple sensors within a vertical stack like this: image

Whilst it may not be necessary, here's the yaml code for the above anyway:

type: vertical-stack
title: WiFi Plugs - Other Areas
cards:
  - type: custom:uptime-card
    status_adaptive_color: true
    color:
      icon: white
      title: white
      status: white
      tooltip: white
      half: '#ffff00'
      ko: '#ff0000'
    show:
      footer: true
      header: true
      title: true
      status: true
      timeline: true
      average: true
    alias:
      ok: Up
      ko: Down
    bar:
      height: 10
      round: 1
      spacing: 5
      amount: 15
    update_interval: 60
    icon_adaptive_color: true
    title_adaptive_color: false
    init:
      duration: 1
      animation: slide
    tooltip:
      hour24: true
    tap_action:
      action: more-info
    alignment:
      header: spaced
      status: spaced
      icon_first: false
    blink:
      target: status
      effect: fade
      speed: 10
    hours_to_show: 0.25
    icon: mdi:power-socket-uk
    title_template: Power Strip - Bedroom 1
    entity: binary_sensor.wifi_power_strip_bedroom1
  - type: custom:uptime-card
    icon: mdi:power-socket-uk
    status_adaptive_color: true
    color:
      icon: white
      title: white
      status: white
      tooltip: white
      half: '#ffff00'
      ko: '#ff0000'
    show:
      footer: true
      header: true
      title: true
      status: true
      timeline: true
      average: true
    alias:
      ok: Up
      ko: Down
    bar:
      height: 10
      round: 1
      spacing: 5
      amount: 15
    update_interval: 60
    icon_adaptive_color: true
    title_adaptive_color: false
    init:
      duration: 1
      animation: raise
    tooltip:
      hour24: true
    tap_action:
      action: more-info
    alignment:
      header: spaced
      status: spaced
      icon_first: false
    blink:
      target: status
      effect: fade
      speed: 10
    hours_to_show: 0.25
    entity: binary_sensor.wifi_plug_speaker_light
    title_template: LEDs & WiFi Speaker
  - type: custom:uptime-card
    status_adaptive_color: true
    color:
      icon: white
      title: white
      status: white
      tooltip: white
      half: '#ffff00'
      ko: '#ff0000'
    show:
      footer: true
      header: true
      title: true
      status: true
      timeline: true
      average: true
    alias:
      ok: Up
      ko: Down
    bar:
      height: 10
      round: 1
      spacing: 5
      amount: 15
    update_interval: 60
    icon_adaptive_color: true
    title_adaptive_color: false
    init:
      duration: 1
      animation: slide
    tooltip:
      hour24: true
    tap_action:
      action: more-info
    alignment:
      header: spaced
      status: spaced
      icon_first: false
    blink:
      target: status
      effect: fade
      speed: 10
    hours_to_show: 0.25
    entity: binary_sensor.wifi_plug_fridge
    icon: mdi:power-socket-uk
    title_template: Fridge
  - type: custom:uptime-card
    status_adaptive_color: true
    color:
      icon: white
      title: white
      status: white
      tooltip: white
      half: '#ffff00'
      ko: '#ff0000'
    show:
      footer: true
      header: true
      title: true
      status: true
      timeline: true
      average: true
    alias:
      ok: Up
      ko: Down
    bar:
      height: 10
      round: 1
      spacing: 5
      amount: 15
    update_interval: 60
    icon_adaptive_color: true
    title_adaptive_color: false
    init:
      duration: 1
      animation: slide
    tooltip:
      hour24: true
    tap_action:
      action: more-info
    alignment:
      header: spaced
      status: spaced
      icon_first: false
    blink:
      target: status
      effect: fade
      speed: 10
    hours_to_show: 0.25
    icon: mdi:power-socket-uk
    entity: binary_sensor.wifi_plug_spare_plug
    title_template: Spare Plug

I use 7 vertical stack cards, like the one above, with 35 different binary sensors monitoring devices on my network. So it can get a little cluttered seeing everything that's 'green'. So what I thought would be a nice addition, if it were possible, would be to add some sort of filter and only display the binary sensors when they are offline.....eg a "hide sensor if status value is {enter value here}". This way I would only see the problems on the network and not everything in one go where I then have to scroll through a number of devices. It's pure laziness on my part lol!

I've tried playing with various filter or conditional cards but they don't really do what I want them to do. It doesn't matter if it isn't something that can be done, I was just throwing the idea out there really. It's been of great value just having the uptime card. It's saved me looking to purchase a network monitoring solution for my own home network!

Cheers

dylandoamaral commented 2 years ago

I really think that https://www.home-assistant.io/dashboards/conditional/ is exactly what you are looking for. You said that it didn't work for you but why ?

Therefore, since you are combining two cards and you are repeating yourself a lot, I suggest you to use https://github.com/custom-cards/decluttering-card.

viking2010 commented 2 years ago

Thanks for the feedback. I'll give the conditional card and the decluttering card another shot. Appreciate the comments.