Any Ideas? how can i display this in Lovelace?

hi all

I am trying to tidy up my UI and have hit a problem… how else can I show this data ?


most of that is sensors… except the bulb that is a multi colour LED and the “off” that is a reset button

also I have installed an anniversary sensor with all the dates I need to remember ( i intend to create some automations using these too) but how can I display them?

entity is


attributes are

years: xx
date: xxxx-xx-xx
friendly_name: Birthday to remember
icon: mdi:calendar-blank

any help?

Create some template sensors.

@Rdoull Are you looking for something like I posted here?

@cyn yes, how did you display the calendar events?

I’ve changed it to include a calendar widget since I posted that screen shot but still pretty similar.

My calendar events are sensors that I set up extracting all the data I need from Google Calendars and an ugly python program using mqtt to update HA. I needed to write this outside of HA because I also wanted drop down list showing all birthdays, holidays and the entire season of games

Anyway, to display the next events I used markdown cards. Here’s what my lovelace code looks like now:

          - type: custom:vertical-stack-in-card
              - type: markdown
                style: |
                  ha-card {
                    height: 40px;
                padding: '0px'
                content: >
                  ## {{ states('sensor.floorplan_date') }}{{ states('sensor.suffix_day') }}

              - type: "custom:atomic-calendar"
                style: |
                  ha-card {
                    height: 215px;
                title: ""
                firstDayOfWeek: 7
                defaultMode: 2
                showDate: false
                showLastCalendarWeek: false
                  - calendar.google_message_3

              - type: markdown
                style: |
                  ha-card {
                    height: 178px
                padding: '0px'
                content: >

                  {{ states('sensor.next_payday') }}

                  {{ states('sensor.next_holiday') }}

                  {{ states('sensor.next_birthday') }}

                  {{ states('sensor.next_fullmoon') }}

                  {{ states('sensor.next_dst') }}

                  {{ states('sensor.next_season') }}

                  {{ states('sensor.next_game') }}

I’ll be honest… this has me lost, I’ve no idea what I am looking at or what bits to change to do what I want.

here is what I want to display

looking to have something that will show the name of the person, how old they will be on their next birthday (in this case 43), when the birhtday is and how long untill their birthday (in this case 280 days) (pref in months, weeks and days, but days will work for now)

I thought yours would do that but now I am not so sure.

Edit: fixing typos

I’ve kinda decided that i’m going to use graphs and stuff for the other sensors that I want to display, maybe use the big number button in HACS

Give this a try (not tested)

            type: markdown
            content: >
              {{ state_attr('sensor.christan_birthday', 'date') }} - {{ state_attr('sensor.christan_birthday', 'friendly_name') }} in {{ states('sensor.christan_birthday') }}  days

had to pop out but just tested this and got the following

None - None in unknown days

in the middle of a card

(hope this makes sense to you )

misspelled christian in 3 places, lol

I never even noticed… sorry lol

i’ll get that fixed

Perfect! Cyn you are a legend ! thank you!

with a little tweaking i got this to display

Christian will be 43 in 280 days - 1977-07-15

with the following ( i altered the name of the sensor to output what I wanted)

content: >
  {{ state_attr('sensor.christian', 'friendly_name') }} will be {{
  state_attr('sensor.christian', 'years') }}  in {{ states('sensor.christian')
  }}  days - {{ state_attr('sensor.christian', 'date') }}
type: markdown

now just to add all the rest of the dates and organise them :slight_smile:

thank you again !

Glad you got it to work

@cyn sorry to pester you,

i wonder if I can call on your help once again, I have the following

      - content: >
          You have had SKY for {{ state_attr('', 'years') }} years in
          {{ states('') }}  days - {{ state_attr('', 'date')
        type: markdown

but how do I perform maths on this? or what language is it so I can try and search to work it out?

what i want to show in this one is how long I have had the service for in years, months and days.

is it possible?

thank you in advance

This one is gonna need a little work. You need to define a sensor with a template.

Calculate the number of days between 2 events. Say 6000 days.
Then I think the formula would be along these lines:
Years in integers: 6000/365 = 16 (How does leap year come in?)
Days2: 6000 - (365* 16) = 160

Months in integers: 160 / 30.417 = 5
Days3: 160 - (30.417 * 5) = 8

Weeks in integers: 8 /7 = 1
Days in integers: 8 - (7 *1) = 1

Final answer is 16 years 5 months 1 week and 1 day

I no longer have an example to share. I have changed my templates to python code with cron & MQTT For me it was easier to maintain & remember what I was doing. I’m sure others on the forum can help once you post what you have tried.

Thank you for your help, I didn’t realise it would require so much work and don’t want to put anyone out.

I’ll have a look at it, see if I can learn some more about it and get back to the group should I hit problems (which I deffinately will).

Again though, thank you very much for your help and time, it is greatly appreciated.

See if this is what you are looking for:

Uses the new features of service response data from the built in calendars.