piitaya / lovelace-mushroom

Build a beautiful Home Assistant dashboard easily
Apache License 2.0
3.31k stars 312 forks source link

[Feature]: More responsive `custom:mushroom-entity-card` #1424

Open bilogic opened 1 month ago

bilogic commented 1 month ago

Requirements

Is your feature request related to a problem?

After tapping on the card once for some of my entities, the UI takes a while to react that I think something is wrong (a while = over 1 second)

The reason this happens is because I scripted some switches over MQTT, e.g. turning off wifi, blocking ads etc, and these do require the scripts to complete running.

For HA's native on/off switch, what I observe is they change state immediately upon being clicked and only to revert back to original state if the script fails, this in my view is a better behavior

Describe the solution you'd like

Follow HA's native switch implementation and toggle the UI immediately, and if the action fails, the entity state changes back again shortly because of feedback from the sensor

Describe alternatives you've considered

n/a

Additional context

No response

piitaya commented 1 month ago

Do you have something set to hold_action? Try to set it to none and see if it's better.

bilogic commented 1 month ago

I don't think so, this is all

      - type: custom:mushroom-entity-card
        name: Ads
        entity: switch.router_ads
        tap_action:
          action: toggle

and I modified my OP, "... because of feedback from the sensor"

piitaya commented 1 month ago

Mushroom actions are Home Assistant built-in actions so it's strange that you have this only with Mushroom cards.

  1. Do you have the same issue with other entity using mushroom card?
  2. Do you have the same issue with same entity using tile card?
bilogic commented 1 month ago

https://github.com/piitaya/lovelace-mushroom/assets/946010/2f8f9cba-be0b-464a-857b-087bb8ecc97a

  1. No issue if I use Mushroom card with MQTT lights
  2. I have not tried the tile card
bilogic commented 1 month ago

https://github.com/piitaya/lovelace-mushroom/assets/946010/24ef1833-6c5c-4703-a2ab-b6e7fa6fa57f

Same problem with tile, but since there is a clicked animation, it is more intuitive and does not lead to the "something wrong" concern