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

[Feature request] Hide bar when sensor is unavailable #179

Open
volkuhl opened this issue May 12, 2024 · 2 comments
Open

[Feature request] Hide bar when sensor is unavailable #179

volkuhl opened this issue May 12, 2024 · 2 comments

Comments

@volkuhl
Copy link

volkuhl commented May 12, 2024

Thanks for this pretty card!
Hiding bar depending on value works like a charm. Would be nice, if I can hide the bar also, when sensor is unavailable.

@volkuhl
Copy link
Author

volkuhl commented May 12, 2024

If anyone is interested, here is my workaround:
Define a sensor template in configuration.yaml

- platform: template
  sensors:
    val_shelly006:
      unique_id: val_shelly006
      friendly_name: "Value Shelly006 IR-Heizung Werkstatt"
      unit_of_measurement: "W"
      value_template: >-
        {% if is_state("switch.shell_006", "unavailable") -%}
          {{ 0 }}
        {%- else -%}
          {{ states("sensor.shell_006_power")|float }}
        {%- endif %}

In the bar card, references to template-sensor instead of directly to the power sensor:

  - entity: sensor.val_shelly006
    name: Heiz.Werkstatt
    severity:
      - from: 0
        to: 0.1
        hide: true

It works well, but could be much easier to have a "switch" in the bar-card directly, instead of having to create a template for each sensor

@ildar170975
Copy link

  1. Even when the bar-card is hidden by it's native hide option (for supported numerical values), the card anyway occupies some space ([FR] Hide the card if all bars are hidden #167).

  2. For unavailable value - you may use a standard conditional card/row to hide the whole bar-card. But the "hidden" row also occupies some space (Entities card with conditional row - card’s height is changing when it shouldn’t home-assistant/frontend#7292).

So, the only option to hide the card totally - card-mod & display: none.

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

No branches or pull requests

2 participants