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

Support use of entities in “max” and “min” properties #184

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

Conversation

mreysei
Copy link

@mreysei mreysei commented Sep 27, 2024

Name Type Default Description
max number or string 100 Defines maximum value of the bar using a number or a entity.
min number or string 0 Defines minimum value of the bar using a number or a entity.

And this is the working example using an entity and a number

type: custom:bar-card
positions:
  icon: inside
entities:
  - entity: sensor.maiku_salud
    name: Salud
    icon: mdi:heart
    color: '#a72741'
    unit_of_measurement: HP
    decimal: 0
    max: sensor.maiku_max_salud
  - entity: sensor.maiku_experiencia
    name: Experiencia
    icon: mdi:progress-star-four-points
    color: '#359441'
    unit_of_measurement: XP
    decimal: 0
    max: sensor.maiku_siguiente_nivel
  - entity: sensor.maiku_mana
    name: Maná
    icon: mdi:flask
    color: '#4693DB'
    unit_of_measurement: MP
    decimal: 0
    max: sensor.maiku_max_mana
  - entity: sensor.steps_daily
    name: Pasos de hoy
    icon: mdi:walk
    color: '#8646db'
    unit_of_measurement: pasos
    decimal: 0
    max: 10000

Result of such component
image

If this PR does not merge because this project is not maintained, you can add a "Custom repository" in HACS with my repository link:
https://github.com/mreysei/bar-card

@mreysei mreysei changed the title Can use an entity in max or min parameter Support use of entities in “max” and “min” properties Sep 27, 2024
@julll190
Copy link

Hi!
Please could you do the same thing to use entities in properties "from" and "to" inside the severity option, and maybe also in the "target" property? That is the only thing I miss.
Thank you in advance!

@mreysei
Copy link
Author

mreysei commented Oct 23, 2024

Hi @julll190, I'll give it a try.

@HenrikHills
Copy link

whenever I try to use your card I get "custom element doesn't exist: bar-card", any ideas?
I have added /hacsfiles/bar-card/bar-card.js as a js-module in resources (i guess this is added automatically when i add it through HACS) ...
It does work if i replace the content in "/homeassistant/www/community/bar-card/bar-card.js" with what you have here: github.com/mreysei/bar-card/blob/master/dist/bar-card.js
But when i try to use a sensor as max-value it doesnt show progress on the bar:

type: custom:bar-card
entities:
  - entity: sensor.billader_session_energy
    max: sensor.billader_estimert_levert_3_fase
    min: 0
    color: "#959d90"
positions:
  icon: "off"
  name: "off"
  value: "off"
height: 10px
entity_row: true

and sensor.billader_estimert_levert_3_fase is a int-number ( 24 ) in this case ...

@mreysei
Copy link
Author

mreysei commented Nov 1, 2024

@HenrikHills probably it is because I created a new beta version that doesn't works haha I deleted it
Try to change version to 1.3.0, now works?

@HenrikHills
Copy link

@HenrikHills probably it is because I created a new beta version that doesn't works haha I deleted it Try to change version to 1.3.0, now works?

haha okay, yeah that worked perfectly, nice thanks!!

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.

3 participants