For a while now I have been fighting with issues that cause my main dashboard to be slow as molasses in loading and clicking on buttons does nothing for extended and variable periods of time. One huge issue was related to the loading of 5 IP cameras (4 of which 4K / 8MP). I tried HA’s default picture-glance
card, and then the webrtc-camera
card, both pulling from the NVR directly. I was overloading the NVR and am therefore now rebroadcasting the streams using Scrypted. While I still have some glitches to deal with, this approach appears to have improved things a lot.
Another issue, is related to loading 2 `plotly-graph’ cards that seem to take a long time. This may in part be due to them waiting for the camera feeds and other cards to finish as they seem better now.
The 3rd issue, which is the main topic of this post, is how I keep track of the trash and recycling pickup. I tried a couple integrations but they were overkill and not free of issues. I am now using a simpler local calendar based solution.
The 4 cards shown below is how I display what gets picked up when. The images can change based on state but I am currently using the same image. The cards used are card-templeter
, picture-entity
, markdown
, horizontal-stack
and card-mod
.
The schedule is in a local calendar I only use for this, and might use for other home maintenance things in the future. I believe there is no end date on the schedule (and yes it ignores the day delay introduced by the pickup skipped by a holiday in the pickup week, but I don’t care).
The cards load very slowly very often, which the markdown cards (#2 and #4) being the worst offenders. I use templates to generate the custom text. The templates used to be part of the cards, but I then opted to pull them out and put them in my templates.yaml
file in hopes it would help fix the issue (maybe evaluate template less often or ???). The issue remained the same.
Trash Templates:
#Controls image of trash can even though for now it is the same one for the 3 states
- sensor:
- name: "Trash"
icon: "mdi:trash-can-outline"
state: >
{% set midnight = today_at() %}
{% set event = state_attr('calendar.trash', 'start_time') | as_datetime | as_local %}
{% set delta = event - midnight %}
{% if delta.days == 0 %}
0
{% elif delta.days == 1 %}
1
{% elif delta.days > 1 %}
2
{% endif %}
- sensor:
- name: "Trash Pickup Short"
icon: "mdi:trash-can-outline"
state: >
{% set midnight = today_at() %}
{% set event = state_attr('calendar.trash', 'start_time') %}
{% set event = event | as_datetime | as_local if event is not none else now() %}
{% set delta = event - midnight %}
{% if delta.days == 0 %}
Today
{% elif delta.days == 1 %}
Tomorrow
{% elif delta.days >= 2 %}
{{delta.days}} days
{% endif %}
- sensor:
- name: "Trash Pickup Long"
icon: "mdi:trash-can-outline"
state: >
{% set midnight = today_at() %}
{% set event = state_attr('calendar.trash', 'start_time') %}
{% set event = event | as_datetime | as_local if event is not none else now() %}
{% set delta = event - midnight %} {% if delta.days == 0 %}
*Bring trash in!*
{% elif delta.days == 1 %}
*Put trash out!*
{% elif delta.days <= 5 %}
*Friday*
{% elif delta.days > 5 %}
*Next Week*
{% endif %}
Recycling templates:
#Controls image of recycling can even though for now it is the same one for the 3 states
- sensor:
- name: "Recycling"
icon: "mdi:recycle"
state: >
{% set midnight = today_at() %}
{% set event = state_attr('calendar.recycling', 'start_time') | as_datetime | as_local %}
{% set delta = event - midnight %}
{% if delta.days == 0 %}
0
{% elif delta.days == 1 %}
1
{% elif delta.days > 1 %}
2
{% endif %}
- sensor:
- name: "Recycling Pickup Short"
icon: "mdi:recycle"
state: >
{% set midnight = today_at() %}
{% set event = state_attr('calendar.recycling', 'start_time') %}
{% set event = event | as_datetime | as_local if event is not none else now() %}
{% set delta = event - midnight %}
{% if delta.days == 0 %}
Today
{% elif delta.days == 1 %}
Tomorrow
{% elif delta.days >= 2 %}
{{delta.days}} days
{% endif %}
- sensor:
- name: "Recycling Pickup Long"
icon: "mdi:recycle"
state: >
{% set midnight = today_at() %}
{% set event = state_attr('calendar.recycling', 'start_time') %}
{% set event = event | as_datetime | as_local if event is not none else now() %}
{% set delta = event - midnight %} {% if delta.days == 0 %}
*Bring recycling in!*
{% elif delta.days == 1 %}
*Put recycling out!*
{% elif delta.days < 5 %}
*This Friday*
{% elif delta.days < 12 %}
*Next Week*
{% elif delta.days < 14 %}
*Week After Next*
{% endif %}
Code sourced from these forums with additional assistance from the knights of this forum! The templates were modified based on a forum suggestion to fix errors in my logs, but I believe they made the slow loading issue worse. I can’t recall the exact changes, but they are related to the as_local if event is not none else now()
part.
I get the impression that loading these 4 blocks even causes the lovelace engine (name?) to crash. At times it all freezes up, and I believe I’ve seen a disconnected
message flash, and I’ve seen the burgundy filled cards with error messages while everything is loading back up.
I am aware the information provided by the cards is overkill (like the number of days to the next pickup) but I like to geek out with HA
Can anyone suggest what may be causing issues, or better ways of doing this without yet another integration to maintain?