I am trying to use card_mod to conditionally display a badge on my dashboard. I have the following code:
path: quickview
theme: Google Dark Theme
title: QuickView
badges:
- entity: sensor.front_porch_temperature
- entity: sensor.garage_temperature_zigbee
- entity: sensor.kitchen_lumi_lumi_weather_temperature
- entity: sensor.basement_temperature_temperature
- entity: sensor.rack_temperature_basement_zigbee
- entity: sensor.wifi_temperature_humidity_sensor_temperature
name: Bedroom Temperature
- entity: sensor.front_porch_humidity
- entity: sensor.garage_humidity_zigbee
- entity: sensor.kitchen_humidity
- entity: sensor.basement_temperature_humidity
- entity: sensor.wifi_temperature_humidity_sensor_humidity
name: Bedroom Humidity
- entity: sensor.cryptoinfo_ethereum_usd
- entity: person.dinner
type: state-label
tap_action:
action: call-service
service: pyscript.dinner
card_mod:
style: |
:host {
--ha-label-badge-size: 50px;
display: {% if (now().hour >= 21 and now().hour < 23) %} online_lock; {% else %} none; {% endif %}
}
It works immediately after I save it (via edit dasboard), but when I reload the frontend, it fails, and always display the “dinner” badge. It also does not propogate to other devices which are running HA frontends. In fact, the other devices fail to recognize that the frontend dashboard was changed, as I am used to seeing whenever I have changed the dashboard.
Can anyone see what I am doing wrong?
Many thanks!