please let me get back to this.
Id like to create a button which pops up in the anniversary day, showing the person/event and the years count.
For that I (think) I need a sensor.party_today which holds the attributes like the sensor countdown makes, to be able to show in the button like this:
type: custom:button-card
template: button_body
entity: 'sensor.today_party'
aspect_ratio: 1/1
name: Party
#icon:
show_state: false
show_entity_picture: true
entity_picture: >
[[[ return entity.attributes.entity_picture ]]
tap_action:
action: navigate
navigation_path: tijd_agenda
hold_action:
action: call_service
service: persistent_notification.dismiss
service_data:
notification_id: party_notification
styles:
card:
- padding: 5px
- font-size: 10px
- color: blue
- background: ivory
grid:
- grid-template-areas: '"n n" "years years" "original_date original_date"'
- grid-template-columns: 1fr 1fr
- grid-template-rows: 1fr min-content min-content min-content
name:
- align-self: middle
- justify-self: start
- padding-bottom: 4px
img_cell:
- margin: none
icon:
- color: red
- width: 70%
- margin-top: -5%
custom_fields:
years:
- padding: 5px
- align-self: start
- justify-self: end
- --text-color-sensor: green
original_date:
# - padding-bottom: 2px
- align-self: middle
- justify-self: start
- --text-color-sensor: green
custom_fields:
years: >
[[[
return `<ha-icon
icon='mdi:calendar-star'
style='width: 12px; height: 12px;'>
</ha-icon><span>Years:<span style='color: var(--text-color-sensor);'>${entity.attributes.years} </span></span>`
]]]
original_date: >
[[[
return `<ha-icon
icon='mdi:calendar'
style='width: 12px; height: 12px;'>
</ha-icon><span>Date: <span style='color: var(--text-color-sensor);'>${entity.attributes.original_date}</span></span>`
]]]
been turning my head round this, if this could be added to the python script, or maybe should be a template sensor built around an anniversary sensor with numberofDays = 0.
Can’t make it yet, so seek some assistance here please. As a side note, I need it to be able to handle double events on a day (have 2 anniversaries on the day of tomorrow )
for the sake of it, I made a group with all relevant sensors, group.party_counters. Hope to create a template that expands that group, checks for state == 0 of each member and then create the sensor.today_party ?
this at least gives me a list of relevant sensors with the state == 0
value_template: >
{% set party = expand('group.party_counters')|selectattr('state','eq','0')
|map(attribute='entity_id')
|list %}
{{ party }}
now how to get these sensors in the button, either directly, or via a dynamically made intermediary sensor:
for each entity_id in {{party}} create a sensor with name, entity_picture, event, years and origin.
please have a look if you can help me? thanks!