Feature request: hide card when no events
when there are no events the card is not completely hidden. It would be nice if there was an option for this or if the card handled it automatically.
type: custom:week-planner-card
startingDay: monday
days: 5
maxEvents: 10
compact: true
showLegend: false
hidePastEvents: true
hideDaysWithoutEvents: true
hideTodayWithoutEvents: true
locale: de
texts:
tomorrow: ""
yesterday: ""
fullDay: " "
calendars:
- entity: calendar.main
color: "#3f51b5"
- entity: calendar.recurring
color: "#d50000"
showLocation: false
showDescription: false
columns:
extraLarge: "1"
large: "1"
medium: "1"
small: "1"
extraSmall: "1"
noCardBackground: false
Add:
card_mod:
style: |
.none {
display: none;
}
this will remove cards without event
Add:
card_mod: style: | .none { display: none; }this will remove cards without event
It doesn't work, unfortunately (and yes I have card mod installed)
That very unexpected, I had the same issue and found this solution 3 days ago.
Tried it again in a new dashboard and works for me.
If you share how you implemented? I can take a look if you like
the code is the same as in the first post. I've tried it in a new dashboard, still visible 🤷
views:
- title: Home
sections:
- type: grid
cards:
- type: custom:week-planner-card
days: 5
startingDay: today
maxEvents: 7
compact: true
showLegend: false
hidePastEvents: true
hideDaysWithoutEvents: true
hideTodayWithoutEvents: true
locale: de
texts:
today: Heute
tomorrow: ''
yesterday: ''
fullDay: ' '
calendars:
- entity: calendar.office
name: Büro
color: '#f09300'
showLocation: false
showDescription: false
columns:
extraLarge: '1'
large: '1'
medium: '1'
small: '1'
extraSmall: '1'
noCardBackground: false
card_mod:
style: |
.none {
display: none;
}
Thanks, I tried it and I misunderstood your challenge.
I did however create a work around for my dashboard as I had the same request. I created a sensor in node-red, checking how many events are scheduled today (in my case the whole week).
then i used conditional card to only appear when the sensor count >0 events. https://www.home-assistant.io/dashboards/conditional/
- type: conditional
conditions:
- condition: numeric_state
entity: sensor.calendar_count
above: 0
card:
type: custom:week-planner-card
If you only want the system to work for "today" you might be able to solve it with logic instead of an additional node-red sensor as your calender entity probably has an attribute with the next event. try to check the current date to the date of the next event. haven't tried this though
No problem
Yeah, a sensor would help, but I have about 20 calendars and don't display all of them on every dashboard. So, I'd need more than one sensor. It could probably be solved with card-templater as well, but it would still be nice if the card supported it natively, would make things a bit easier.