I can’t see an error in the structure. The only thing I noticed is the service call button.press
.
What is the result if you just toggle a light?
Hi, I like what you have done.
Could you tell me how you got HA Release and HASSOS. I cannot find any entities for them.
or
…However for the Supervisor sensors (which are disabled by default) I don’t know how to enable them… hunting for that info now.
Hi, I have a strange thing with my attributes.
My states of some attributes are changing but not correct. I think that I am doing something wrong with the custom-button cards.
An example below:
I think this has change the attributes “days_until_collection_date” to 0
type: custom:button-card
template: meldingen_card
triggers_update:
- sensor.afvalinfo_gft
- sensor.afvalinfo_kerstboom
- sensor.afvalinfo_pbd
- sensor.afvalinfo_restafval
icon: mdi:recycle
name: Afvalwijzer
styles:
icon:
- color: |
[[[
if (states['sensor.afvalinfo_gft'].attributes.days_until_collection_date = 0) return '#4CAF50';
if (states['sensor.afvalinfo_kerstboom'].attributes.days_until_collection_date = 0) return '#4CAF50';
if (states['sensor.afvalinfo_pbd'].attributes.days_until_collection_date = 0) return '#4CAF50';
if (states['sensor.afvalinfo_restafval'].attributes.days_until_collection_date = 0) return '#4CAF50';
else return 'white';
]]]
custom_fields:
aa:
- '--icon-color-sensor': >-
[[[ if
(states['sensor.afvalinfo_restafval'].attributes.days_until_collection_date
= 0) return "rgb(74,106,132)"; else return "grey";]]]
bb:
- '--icon-color-sensor': >-
[[[ if
(states['sensor.afvalinfo_gft'].attributes.days_until_collection_date
= 0) return "rgb(78,131,70)"; else return "grey";]]]
cc:
- '--icon-color-sensor': >-
[[[ if
(states['sensor.afvalinfo_pbd'].attributes.days_until_collection_date
= 0) return "rgb(233,162,70)"; else return "grey";]]]
dd:
- '--icon-color-sensor': >-
[[[ if
(states['sensor.afvalinfo_kerstboom'].attributes.days_until_collection_date
= 0) return "rgb(78,131,70)"; else return "grey";]]]
custom_fields:
aa: |
[[[
return `<ha-icon
icon="mdi:trash-can-outline"
style="width: 60%; height: 60%;
color: var(--icon-color-sensor);">
</ha-icon>`
]]]
bb: |
[[[
return `<ha-icon
icon="mdi:food-apple-outline"
style="width: 60%; height: 60%;
color: var(--icon-color-sensor);">
</ha-icon>`
]]]
cc: |
[[[
return `<ha-icon
icon="mdi:bottle-soda-classic-outline"
style="width: 60%; height: 60%;
color: var(--icon-color-sensor);">
</ha-icon></span>`
]]]
dd: |
[[[
return `<ha-icon
icon="mdi:pine-tree"
style="width: 60%; height: 60%;
color: var(--icon-color-sensor);">
</ha-icon>`
]]]
Try it with double equals signs:
… attributes.days_until_collection_date == 0)
…
(and so on)
Tnx. It seems to work.
I am wanting to remove the icon from this card so I can push the text over to the left, so the text would be where the icon is currently.
type: custom:button-card
custom_fields:
graph:
card:
type: entities
entities:
- entity: input_datetime.night_mode_time
name: End Time
icon: mdi:clock
state_color: true
style: |
ha-card {
box-shadow: none;
border-radius: 0%;
background-color: transparent;
--mdc-icon-size: 30px;
text-align: start;
margin-bottom: -8px;
margin-top: -8px;
}
styles:
custom_fields:
graph:
- overflow: unset
card:
- overflow: unset
- background-color: transparent
- box-shadow: none
- border-radius: 0%
- padding-top: 0%
- padding-bottom: 0%
- padding-left: 0%
- padding-right: 10%
grid:
- grid-template-areas: '"i" "n" "graph"'
- grid-template-columns: 1fr
- grid-template-rows: 1fr min-content min-content
- background-color: '#202020'
double_tap_action:
action: more-info
change under the “styles:” section:
grid:
- grid-template-areas: "n" "graph"'
- grid-template-columns: 1fr
- grid-template-rows: min-content min-content
- background-color: '#202020'
(In other words, eliminate the references to icon in the grid settings.)
Didn’t work, the icon is still appearing?
I did miss a leading ’ in front of the “n” “graph”’.
You could also try setting the --mdc-icon-size: to 0 pixels:
type: custom:button-card
custom_fields:
graph:
card:
type: entities
entities:
- entity: input_datetime.night_mode_time
name: End Time
state_color: true
style: |
ha-card {
box-shadow: none;
border-radius: 0%;
background-color: transparent;
--mdc-icon-size: 0px;
text-align: start;
margin-bottom: -8px;
margin-top: -8px;
}
Did you get this figured out? I’m having the exact same issue.
If you are using a grid card, ensure that squares are deactivated:
type: grid
columns: 3
square: false
cards:
- …
Can somebody help me, I want to combine the “multiple-entity-row” card with “button-card”… Is that possible?
What I want to achieve is to change the icon color depending on status of a binary sensor I have.
Here is my base code for my multiple-entity-row card.
type: entities
title: ''
entities:
- entity: sensor.elforbrukning_idag_total_kwh_peak
type: custom:multiple-entity-row
name: Tvättmaskin
show_state: false
icon: mdi:washing-machine
entities:
- entity: sensor.elforbrukning_idag_total_kwh_peak
name: Förbr. / Mån
format: precision0
styles:
width: 75px
- entity: sensor.today_energy_cost
name: Pris / Mån
styles:
width: 75px
- entity: sensor.elforbrukning_idag_total_kwh_offpeak
name: false
icon: mdi:dots-horizontal
tap_action:
action: fire-dom-event
browser_mod:
command: popup
deviceID: this
title: TVÄTTMASKIN
card:
type: entities
title: ''
entities:
- entity: sensor.elforbrukning_idag_total_kwh_peak
type: custom:multiple-entity-row
name: Tvättmaskin
show_state: false
icon: mdi:washing-machine
entities:
- entity: sensor.elforbrukning_idag_total_kwh_peak
name: Förbr. / Mån
format: precision0
styles:
width: 75px
- entity: sensor.today_energy_cost
name: Pris / Mån
styles:
width: 75px
- entity: sensor.elforbrukning_idag_total_kwh_offpeak
name: Antal / Mån
unit: ggr
styles:
width: 60px
unit: ggr
styles:
width: 60px
And here is the code for button card to change color depending on status. Where and how do I paste this in the above code?
- type: 'custom:button-card'
entity: switch.ac
icon: mdi:air-conditioner
color: rgb(28, 128, 199)
state:
- value: 'off'
color: rgb(255, 0, 0)
That was it and a 2-second fix. Thanks!!
ciao pazzo vorrei chiederti un aiuto vorrei creare una button card dove richiamo un servizio, non so dove sbagio sono da poco in homeassistant, il servizio sarebbe remote.send command dove si dovrebbe accendere la tv dalla scheda servizi funziona perche ho associato broadlink e memorizzato i codici, ti allego la configurazione yaml del button card’
type: horizontal-stack
cards:
- type: custom:button-card
color_type: blank-card - type: custom:button-card
color_type: blank-card - type: custom:button-card
color_type: card
color: rgb(223, 255, 97)
icon: mdi:television-box
tap_action:
action: call service
service: remote.send_command
service_data:
entity_id: remote.zhi_neng_yao_kong_remote
device: televisione
command: ‘on’
spero in un aiuto sto cercando di imparare
I’m struggling with negative values: dBm signal strength from BT Xiaomi module. I’m trying to show card in different color when signal falls below -80. I think that the problem is that sensor value is string, and my command doesn’t differ from “-80” or “-8”. Consequently i get a red value if signal is -9dBm, which is, of course, lower than -8…
Any clues how to solve this? I guess i have to convert string to number in a way…
Here’s my code:
styles:
custom_fields:
debeem:
- position: absolute
- left: 33%
- color: |
[[[
if (states['sensor.wifi_bt_nadstropje'].state <= '-80') return "cyan"
else
return 'red'
]]]
Very nice work indeed @ktownsend-personal
Is there a way to put the templates in the configuration.yaml
file so that the templates can be used in all dashboards? Or do I need to put the templates in every dashboard? I have different dashboards by user.
@MilesAheadToo, if you are using the UI to manage dashboards unfortunately you have to put them in every dashboard. I got tired of that myself, so I went full YAML management on the dashboards. If you haven’t discovered that technique yet, it’s great for organizing and re-using snippets of dashboards for re-use, but it can’t be managed in the UI at all. Check out my post earlier in this topic where I talked about it here. I based my organization on a great example I found from Frenck on his organization pattern for his configuration.yaml here.
Thanks. While I love what you have done, I don’t really want to program the UI entirely.
Different question: Can a template be used as input? For example:
- entity: {{ states('group.closure_downstairs') == 'on' and states('alarm_control_panel.carpe_diem_alarm' == 'armed')
state:
- value: 'on'
id: value_on
name: Open
icon: mdi:door-open
- value: 'off'
id: value_off
name: Closed
icon: mdi:door-closed
template: alerter-dual
type: custom:button-card
variables:
color_seconds: 120