#Negative numbers in a bar-card

1 messages · Page 1 of 1 (latest)

wintry adder
#

@hollow plinth @warped fern So... you guys are really going to hate me, but I figured out the problem with the bar card... The card does support negative numbers. The problem was the from: and to: for each severity level. from: has to be the smaller number; to: has to be the larger number. ```yaml

  • from: 0
    to: -39.9999
    color: green``` -39.999 is smaller than 0...
#
type: custom:bar-card
entities:
  - sensor.philips_sml001_b2671709_basic_rssi
  - entity: sensor.philips_sml001_b2671709_basic_rssi
    name: Manually entered name
limit_value: true
min: -100
max: 0
positions:
  indicator: 'off'
  icon: 'off'
height: 22
severity:
  - color: red
    from: -999
    to: -100
  - color: darkorange
    from: -99
    to: -81
  - color: orange
    from: -80
    to: -61
  - from: -60
    to: -41
    color: yellow
  - from: -40
    to: 0
    color: green```
wintry adder
#

Shredder5262 Before you go manually plugging in all 90 of the entities you want to monitor, consider the auto-entities. Basically, if you have a usable naming convention of entities that you want to monitor (something like sensor.whatever-whatever-rssi), can use wildcards to populate the entities in the bar-card (like sensor.-rssi). Or you can just tell it to find all entities that have an rssi attribute and show that. Then, you can apply sorting options such as alphabetical or value high-to-low. You can use the example bar-card code from above inside the auto-entities card; just remove the entities section from the bar-card. The auto-entities card will populate the entities.

warped fern
wintry adder
#

Sadly, I spent a bunch of time working on this before I caught it. I used card_mod and made my own severity levels but the entity had to be hard-coded; it would not work with the config.entity variable. Then, I tried getting auto-entities to work with it but when I went to add the configuration-template-card, things stopped working. Then, I found someone's example that was used specifically for RSSI. It worked fine with the severity levels. So, then I had to take time to understand why that one worked and the original didn't...