Jason_hill
(Jason Hill)
February 21, 2021, 10:02am
5173
Hi. how can i setup correctly two actions under tap_action? Below is what i would like to do.
type: 'custom:button-card'
entity: input_boolean.media_shuffle_kokken
tap_action:
action: call-service
service: media_player.shuffle_set
service_data:
entity_id: media_player.kokken
tap_action:
action: toggle
RomRider
February 21, 2021, 10:18am
5174
Create a script which does the 2 actions and call the script. You canât call 2 actions.
1 Like
RomRider
February 21, 2021, 10:49am
5175
I doubt that reinstalling everything will change the result
trying tio compress some logic and integrate switches with different properties, I want a hold_action depending on whether the entity.entity_is is includes in a group.z_wave_switches, but I cant get the correct syntax for that:
button_switch:
variables:
id: >
[[[ entity.entity_id.split('.')[1]; ]]]
z_wave: >
[[[ return group.z_wave_switches.includes(entity.entity_id); ]]] #<------
tap_action:
action: toggle
haptic: light
# hold_action:
# action: call-service
# service: script.turn_on
# service_data:
# entity_id: >
# [[[ var id = entity.entity_id.split('.')[1];
# return 'script.' + id + '_meterget_power'; ]]]
hold_action:
action: >
[[[ return variables.z_wave ? 'more-info' : 'call-service'; ]]]
service: >
[[[ return variables.z_wave ? null : 'script.turn_on'; ]]]
service_data:
entity_id: >
[[[ return variables.z_wave ? null : 'script.' + id + '_meterget_power'; ]]]
please help me find that⊠it must be simple?
tried
[[[ return states['group.z_wave_switches'].attributes.entity_id.includes(entity.entity_id); ]]]
too but the hold action wasnât performed (and it horrendously turn off the power off my Mac while editingâŠ
thanks for having a look
That is the correct syntax. If it doesnât work, make sure the entity is actually in the list by checking your dev-tools panel.
thanks, and yes, it does work after all⊠maybe a cache thing going on. Love the versatility of the button-card.
VMCosco
February 22, 2021, 3:32pm
5179
I am having an issue with this button card template on iOS (Safari and Companion App). The issue is not present in Chrome or Fully Kiosk on Windows or Android. If the switch is âonâ it works as expected. If the switch is âoffâ, the border is not shown. I tested by commenting out:
card:
- filter: opacity(50%)
After doing this the border was visible in iOS when the state is âoffâ.
Any idea why this would impact iOS only?
# Homekit type buttons
switch_homekit:
color: var(--google-yellow)
hold_action:
action: more-info
show_state: true
styles:
card:
- border-style: solid
- border-width: 2px
- border-color: var(--primary-color)
- height: 90px
- width: 90px
grid:
- grid-template-areas: '"i" "n" "s"'
- grid-template-columns: 1fr
- grid-template-rows: 1fr min-content min-content
icon:
- margin-top: '-5%'
- padding-left: 10px
img_cell:
- justify-content: start
- text-align: start
name:
- font-size: 14px
- font-weight: bold
- justify-self: start
- margin-bottom: 3%
- padding-left: 10px
state:
- font-size: 14px
- justify-self: start
- padding-left: 10px
- text-transform: lowercase
state:
- value: 'off'
styles:
card:
- filter: opacity(50%)
icon:
- filter: grayscale(100%)
I have the answer for you: Appleâs safari sucks
1 Like
VMCosco
February 22, 2021, 3:37pm
5181
I agree. I only tested it on there because it is not working on the iOS Companion app either. Is this an issue that I should post there since the card works as expected on Chrome?
That is pure CSS compatibility issue with safari vs chrome/firefox. Not something button-card can fix.
VMCosco
February 22, 2021, 3:41pm
5183
Got it. Well that sucks. Must be a recent change in iOS. I hadnât accessed HA on the app in awhile. It had been working previously.
Is there the possibility of using button cards while keeping the toggle switch?
Thanks
JKW
(Kolja Windeler)
February 23, 2021, 12:47pm
5185
Hi, short question on the new structure, with fire-dom-event: Should every card already support this out-of-the-box?
I got it working for all standard buttons, also for the custom:button-card, but I canât get it to work with the custom:mini-graph-card
is that related to the card?
Thanks, JKW
Hi
Can anyone tell me why the âtext-align: leftâ property doesnât work?
I wish the text was on the left in the buttons. Thanks
type: horizontal-stack
cards:
- type: 'custom:button-card'
name: Stato allarme Bentel
styles:
card:
- background-color: white
name:
- font-size: 15px
- text-align: left
- type: 'custom:button-card'
custom_fields:
stato_allarme_bentel: |-
[[[
if (states['binary_sensor.stato_allarme_bentel'].state == "on")
return "Enable";
return "Disable";
]]]
styles:
card:
- background-color: white
custom_fields:
stato_allarme_bentel:
- font-size: 15px
- text-align: left
You should use justify-self: start
instead of text-align
RomRider:
justify-self: start
Thanks for your help.
It works with the first card but not with the custom field
Thatâs because you didnât put the custom_field in the grid.
You should use the name
field with your code instead of putting that in a custom_field, itâs going to be easier.
1 Like
Thanks again, it works. I have achieved my goal. But I would like to understand: with the custom field was the grid the only solution?
Hi,
using
type: custom:button-card
template: button_alarm
entity: script.alarm_disarm
icon: >
[[[ if (states['alarm_control_panel.ha_rpi4_alarm'].state == 'triggered') return 'mdi:shield-alert';
return 'mdi:shield-check'; ]]]
hold-action:
action: navigate
navigation_path: >
[[[ return (window.location.pathname.split('/')[2] == 'alarm')
? null : '/ui-settings/alarm'; ]]]
wont navigate⊠It simply shows. Tap does trigger the script. No errorsâŠ
please help me find whatâs up? Ive checked the window.location.pathname.split('/')[2] == 'alarm'
in inspector to be correct.
thanks for having a look