at the moment im struggeling with a task, where i want to display the values of last day, week, month, year. I’ve used the normal statistic card to display this:
So then i have to create a trigger at 23:59 and Check If its sunday/last day of month or year and Set the last week/month/year value to the current value because at 00:00 its get resetted.
Two template binary sensors for last day of month / year.
- binary_sensor:
- name: Last Day of the Month
icon: mdi:calendar
state: "{{ (now() + timedelta(days=1)).day == 1 }}"
- name: Last Day of the Year
icon: mdi:calendar
state: "{{ (now() + timedelta(days=1)).year == now().year + 1 }}"
And then i have created four automations who set the last day / week / month / year values:
did this for each last day/ week / month / year with different conditions at 23:59.
Then i’ve the values inside my number helpers. In the multiple entity row the input field isnt show, so thats the value is displayed without the chance to change it - like its normal mode for input numbers as entity card.
How-to: make a statistics card look like an entity row
I was faced with the same challenge, but I didn’t want to create any additional template sensors or automations, because everything is already there - it just doesn’t look the way I want it to. So I helped it along with card-mod. Solution: a vertical stack consisting of a regular entities card followed by the necessary statistics cards.
The entity “Gasverbrauch heute” is duplicated to match the similarity. The upper entity is a regular entity row of the entities card and the lower entity is the customized statistic card. It also behaves in the same way as the entity row if there is not enough space available: the state is always displayed and, if necessary, the entity name is abbreviated with three dots. The only small disadvantage is that there is no secondary info row.
Note: this is not a full copy&paste solution as it requires HACS to install card-mod. Furthermore, you may not want to use card-mod for the first time to get the desired result, which may require further customization when using (other) themes. For this reason, I have saved myself the trouble of posting the complete card yaml, because there is nothing special there apart from the procedure described above. All the “magic” is done by card-mod.
Perhaps it will help someone who, like me, does not want to create any further templates or automations.