Lovelace: Button card

copy the whole automation here to check.
Check the status of the sensor.
binary_sensor.0x00158d0003fa5728_contact it must be on or off

in automation show this:

Not supported action:

data: {}
entity_id: input_boolean.kapu
service_template: input_boolean.turn_{{ states('binary_sensor.0x00158d0003fa5728_contact') }}

this template show the sensor state:
{{ states('binary_sensor.0x00158d0003fa5728_contact') }} ON

Uppercase ON?
it should be lowercase on i think

like input_boolean.turn_on
not input_boolean.turn_ON

Sorry, lowercase the on!

- data: {}
  entity_id: input_boolean.kapu
  service_template: "input_boolean.turn_{{ states('binary_sensor.test_motion4_2') }}"

add this "

Users will have to decide but the code is now slightly faster also thanks to this modification :slight_smile:

Iā€™d have done it slightly differently than what is proposed here as a solution:

  • Make an input_boolean turn on for 20 sec and then off after those 20sec
  • use a template state in button-card to match the input_booleanā€™s on state and add the blink animation to the icon while this input_boolean is on.

This would largely reduce the code size.

Ok, it is working but in the automation show this message: Not supported action
So donā€™t know why, but it is ok. Thank You!

Good idea, but I canā€™t do this. :slight_smile:

Can you share a code? Thank you

Expected behaviour :

  1. gate is closed. button icon is showing door_closed. no blinking. door_closed_state sensor is on
  2. press the icon
  3. gate starting to open, icon starting to blink, door_closed_state sensor is off
  4. after 20s the gate is opened. blinking stopped, icon shows door is opened.

Icon must reflect the actual status of the door (closed, opening-closing, opened).

No I have this:
When the gate opening, blinking the door icon till closed. But if I leave open the gate the blinking never stop. So I need stop after 20 sec. How to do that?

aspect_ratio: 2/1
entity: binary_sensor.0x00158d0003fa5728_contact
name: Gate
show_icon: true
show_state: true
state:
  - color: 'rgb(21, 255, 0)'
    icon: 'mdi:door-open'
    styles:
      icon:
        - animation: blink 2s ease infinite
    value: 'on'
  - color: 'rgb(255, 0, 0)'
    icon: 'mdi:door-closed'
    value: 'off'
tap_action:
  action: call-service
  service: switch.toggle
  service_data:
    entity_id: switch.electrodragon_relay1
type: 'custom:button-card'
- animation: blink 2s ease 20s

If I change infinite to 20s no blinking at all.

my mistake, read the docs wrong

- animation: blink 2s ease 10

Now it is perfect! Thank You!

But it is just start blinking when the status is already changed to on or off. not when i press the button.

@RomRider would it be possible to add a triple_tap_action by any chance please?

I would like to emulate some physical zigbee switches within Home Assistant using button card that use a combination of single, double, triple, and hold actions.

I was hoping that as you already cater for single, double, and hold, it may be fairly easy to implement a triple tap option please?

TIA

@RomRider is it possible to also get hold_hold and hold_release :smiley:

This card currently only uses hold_release which intermittently does not work so well on mobile devices (impacting WAF :weary: ) be awsome if just holding the button down would result in triggering the action :partying_face:

i see there is a semi-related Issue and PR on GH, but it seems to have gone stale

Have problem with the blink. If I refresh the browser always start blinking for 10 sec. Is it possible to setup only blink when the gate sensor change from off to on?

Nope, thatā€™s how CSS works. If the state is on, the CSS will play.

Is it possible to have the state spin true/false based upon fan attribute?

Iā€™ve tried this, and it does not workā€¦

          state:
            - value: "cool"
              icon: mdi:fan
              spin: > 
                [[[ 
                  if (states['climate.bedrooms'].attributes.fan_action == 'Running') 
                    return 'true' 
                  else 
                    return 'false'
                ]]]