piitaya / lovelace-mushroom

Build a beautiful Home Assistant dashboard easily
Apache License 2.0
3.53k stars 329 forks source link

[Feature]: Add setting to disable controls of numbers slider #1069

Open freeDom- opened 1 year ago

freeDom- commented 1 year ago

Requirements

Is your feature request related to a problem?

The number card can not be used for displaying numeric values without changing them, because there is no option to disable its controls.

If it would support an option for disabling its controls, the number card could also be used to display sensor values such as battery percentage in a beatiful way.

Describe the solution you'd like

Add an additional display mode "Disabled Slider" to number card, which only shows the current value in a slider and does not allow any controls.

Describe alternatives you've considered

Add an additional property to the number card "Disable Controls" to disable the controls.

When display mode is slider: Do not allow any cotrols. When display mode is buttons: Disable or hide control buttons.

Additional context

No response

Sab44 commented 1 year ago

I'd like to support this proposal as well. Though instead of editing the existing number slider, it would probably be better to add a new "read-only slider" card that accepts numeric sensor entities (on top of number entities presumably). If there is agreement over this proposal I'm willing to develop this card and create a PR.

Sab44 commented 1 year ago

Update: you can actually already assign a sensor entity via yaml. So we could also rename the existing card to e.g. "slider card" and allow sensor entity selection in the entity field. Then there would only need to be support for setting min/max values manually, as this prevents the slider from being useful at the moment, as it takes the min/max attributes from the number entity (which are not present for sensor entities).

StuFrankish commented 1 month ago

Just want to jump in and see if there is any update on this or any advice that could be offered. Much like freeDom's example - I have a numeric MQTT sensor configured that I use for returning a percentage value for whole home backup power.

mqtt:
    sensor:
      - name: "Backup Battery"
        state_topic: "home/power/backup_perc"
        unit_of_measurement: "%"
        qos: 1

As you suggested, the sensor can be added through the YAML configuration of the card, however the "slider" portion of the card never updates.

type: custom:mushroom-number-card
icon_color: green
name: Backup Power
tap_action:
  action: none
hold_action:
  action: none
double_tap_action:
  action: none
display_mode: slider
fill_container: false
layout: horizontal
entity: sensor.backup_battery

While the displayed numeric value changes, the % fill of the slider never changes from 100%, even after page loads.

image

I would also like to ask, would it be possible to add color thresholds too?