followed your suggestion to create a custom_field, but have a couple issues…
I would love to position the custom lock exactly as you do with the lock: true option. Could you please let me know what the coordinates and size are? I am now using
custom_fields:
icon: >
[[[ return `<ha-icon icon="mdi:lock-alert" style="width: 22px; height: 22px;"> </ha-icon>` ]]]
and
styles:
custom_fields:
icon:
- color: red
- position: absolute
- left: 70%
- top: 5%
which seems to come close, but just not exactly:
lock: true
:
and custom_field:
I did try to make them 20px but then rendered too small again…
also, since I am not using a template, would I still need to use the [[[ ]]] construction? seems the code can be simpler without that, using a fixed ha_icon?
for reference this is my full button template:
button_lock_permanent:
label: >
[[[
var id = entity.entity_id.split('.')[1].slice(3, -9);
return states['sensor.' + id + '_actueel'].state + ' Watt';
]]]
color: auto
size: 30%
aspect_ratio: 1/1
show_state: true
show_label: true
tap_action:
action: none
haptic: light
hold_action:
action: more-info
haptic: success
custom_fields:
icon: >
[[[ return `<ha-icon icon="mdi:lock-alert" style="width: 22px; height: 22px;"> </ha-icon>` ]]]
styles:
custom_fields:
icon:
- color: red
- position: absolute
- left: 70%
- top: 5%
icon:
- color: grey
card:
# - color: grey
- background-color: lightgrey
- border-radius: 6px
- padding-left: 5px
- box-shadow: '0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)'
name:
- justify-self: start
- font-weight: bold
- font-family: Helvetica
- font-size: 13px
- text-overflow: unset
- white-space: unset
- word-break: break-word
- text-align: start
label:
- font-size: 11px
- font-family: Helvetica
- justify-self: start
state:
- font-size: 11px
- font-family: Helvetica
- justify-self: start
- text-transform: capitalize
- font-weight: bold
grid:
- grid-template-areas: '"i" "n" "s" "l"'
- grid-template-columns: 1fr
- grid-template-rows: 1fr min-content min-content
- position: relative
img_cell:
- justify-content: start
- align-items: start
state:
- value: 'on'
styles:
state:
- color: green
label:
- color: red
- value: 'off'
styles:
label:
- color: rgba(0, 0, 0, 0.0)
state:
- color: darkgrey
- value: 'unavailable'
styles:
label:
- color: rgba(0, 0, 0, 0.0)
state:
- color: red
thanks for having a look if you would.