I needed a light timer-switch with visualisation of time remaining. After lots of tries finally I did as I want using button-card:
type: custom:button-card
icon: hass:lightbulb-on-outline
custom_fields:
czas:
card:
type: conditional
conditions:
- entity: timer.mytimer
state_not: "idle"
card:
type: entities
entities:
- entity: timer.mytimer
name: ''
show_name: false
show_icon: false
#icon: 'hass:none'
styles:
custom_fields:
czas:
- position: absolute
- left: 70%
- top: 10%
- show_name: false
entity: switch.my_light
and result:
Generally it works well. Problem is only with format of custom_field, which shows a time, when timer counts. For me best would be only small window with value, nothing else, because, when I put this button into the stack with others, it will be much smaller and has to be readable. But there is an icon and “name” and finally this field is much wider, than it could be.
I can set empty name (as in the code) and set icon as “none”, but there still will be blank space reserved for these fields on screen. My question: why options show_name: false and show_icon: false don’t work here? Or how to do it better?