nervetattoo / banner-card

A fluffy banner card for Home Assistant 🥰
MIT License
605 stars 58 forks source link

Feature Request | tap_action and hold_action #34

Open ThirteenTX opened 5 years ago

ThirteenTX commented 5 years ago

I'd love to be able to specify tap and hold actions. This is what I have currently but clicking or holding the icon just shows history pop-up.

type: 'custom:banner-card'
heading: "\U0001F6AA Front Door"
background: '#434954'
entities:
  - entity: binary_sensor.front_door_open
    name: Open/Closed
    map_state:
      'on': 'mdi:door-open'
      'off': 'mdi:door'
  - entity: lock.front_door
    name: Lock
    map_state:
      locked: 'mdi:lock'
      unlocked: 'mdi:lock-open-outline'
    tap_action:
      action: call-service
      service: lock.lock
      service_data:
        entity_id: lock.front_door
    hold_action:
      action: call-service
      service: lock.unlock
      service_data:
        entity_id: lock.front_door
  - entity: sensor.ring_front_door_last_ding
    name: Last Ring

Not sure if that is something that is possible. Thanks for the add-on and your time on this already!

ThirteenTX commented 5 years ago

That or if door locks showed the lock/unlock button. That would be fine too.

iantrich commented 5 years ago

It's typescript, but this is what you could implement long-press as used here in the button-card

Also supports double tap and repeat on long hold

nervetattoo commented 5 years ago

Proper support for the lock domain with lock/unlock button would be great, I'll gladly get that in. I don't have a lock device myself so would be great if someone could contribute this feature ready-tested.

I'm opinionated about long-press and double tap being anti-patterns blocking good UX and thus will not add support for that.

kernel610 commented 2 years ago

Proper support for the lock domain with lock/unlock button would be great, I'll gladly get that in. I don't have a lock device myself so would be great if someone could contribute this feature ready-tested.

I'm opinionated about long-press and double tap being anti-patterns blocking good UX and thus will not add support for that.

@nervetattoo Any update on this lock support? Ideally I'd like to setup tapping on my lock entity to toggle the lock depending on status (ie: lock when unlocked, unlock when locked). Lock doesn't support a toggle service today so different actions depending on state is probably what makes sense with the current services offered for lock devices. I could see this being beneficial for other use cases as well.

I do have a lock device and can collaborate and test this but not to the level of being able to develop the solution.