How to troubleshoot partially slow front end?

So I’m having a small issue with my front end loading specific parts slowly. To be specific, Lovelace loads just fine, it’s all responsive when I turn a light or switch on it happens instantly but when I tap on, for example a media player the play / pause / stop buttons take upwards of 20-30 seconds to show up. I get the same behaviour with my vacuums too. With my person entities the map takes a similar time to render. Also my state history’s take an age to show up too… I have cleared my database (I’m using MariaDB) so I’m fairly sure it’s not corruption on the DB.

This happens on all mobile phones, wall mounted tablets as well as both my PC and laptop and Surface Pro 7+ so I don’t think the issue with with my devices but rather my HA install. I am running HA on bare metal NUC i5 with an NVMe SSD with 8GB RAM. My usage of the CPU barely hits 10%. RAM usage is close to 50% but I assume that’s cause of my cameras (6 of them) and Frigate although I am using a Coral for detection.

Any ideas where I could start to troubleshoot this? I’ve obviously Googled this but almost all results for ‘Home Assistant Slow Front End’ seems to lead to deleting the DB file and rebooting.

Images examples of what I’m talking about: Weird issue with state history - Album on Imgur

Additinally I have verified that I do not have an IP conflict. Reverted from MariaDB to the default soloution.

After a reboot of the host, the problem is gone for around 10-15 min but then returns.

Here is my log:

> 2022-05-02 07:38:04 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration frigate which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
> 2022-05-02 07:38:04 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration samsungtv_smart which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
> 2022-05-02 07:38:04 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration eufy_vacuum which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
> 2022-05-02 07:38:04 WARNING (SyncWorker_7) [homeassistant.loader] We found a custom integration lovelace_gen which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
> 2022-05-02 07:38:04 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration breaking_changes which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
> 2022-05-02 07:38:04 WARNING (SyncWorker_5) [homeassistant.loader] We found a custom integration alexa_media which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
> 2022-05-02 07:38:04 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration adaptive_lighting which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
> 2022-05-02 07:38:04 WARNING (SyncWorker_6) [homeassistant.loader] We found a custom integration govee which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
> 2022-05-02 07:38:04 WARNING (SyncWorker_9) [homeassistant.loader] We found a custom integration nuki_ng which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
> 2022-05-02 07:38:04 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration skyq which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
> 2022-05-02 07:38:04 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration dwains_dashboard which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
> 2022-05-02 07:38:04 WARNING (SyncWorker_8) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
> 2022-05-02 07:38:04 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration deepstack_face which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
> 2022-05-02 07:38:04 WARNING (SyncWorker_5) [homeassistant.loader] We found a custom integration fullykiosk which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
> 2022-05-02 07:38:04 WARNING (SyncWorker_10) [homeassistant.loader] We found a custom integration scheduler which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
> 2022-05-02 07:38:08 WARNING (MainThread) [homeassistant.components.sensor] Platform rest not ready yet: All connection attempts failed; Retrying in background in 30 seconds
> 2022-05-02 07:38:08 WARNING (MainThread) [homeassistant.components.mqtt.sensor] Invalid state message '{"timestamp":1606385220,"timestamp_friendly":"11/26/2020, 10:07:00 AM","timeout":"2 years","timeout_timestamp":1669499124,"timeout_seconds":63113904,"severity":[{"color":"#bf4060","value":"-4 months","seconds":-10518984},{"color":"#bfb540","value":"0 months","seconds":0}]}' from 'homeassistant/sensor/vacuum_maint_replace_wheel/state'
> 2022-05-02 07:38:10 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140307349479136] Received invalid command: scheduler_updated
> 2022-05-02 07:38:12 WARNING (MainThread) [homeassistant.components.generic.camera] Loading generic IP camera via configuration.yaml is deprecated, it will be automatically imported. Once you have confirmed correct operation, please remove 'generic' (IP camera) section(s) from configuration.yaml
> 2022-05-02 07:38:13 WARNING (MainThread) [custom_components.govee] API is back online.
> 2022-05-02 07:38:16 WARNING (MainThread) [alexapy.alexawebsocket] mac_dms not detected; websocket likely won't connect
> 2022-05-02 07:38:17 ERROR (MainThread) [homeassistant.components.lifx.light] Failed to initialize 192.168.0.218
> 2022-05-02 07:38:17 ERROR (MainThread) [custom_components.frigate.api] Error fetching information from http://ccab4aaf-frigate:5000/api/stats: Cannot connect to host ccab4aaf-frigate:5000 ssl:default [Try again]
> 2022-05-02 07:38:17 WARNING (MainThread) [homeassistant.config_entries] Config entry 'ccab4aaf-frigate:5000' for frigate integration not ready yet; Retrying in background
> 2022-05-02 07:38:25 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0x0161:1:0x0300]: async_initialize: all attempts have failed: [DeliveryError('[0x0161:1:0x0300]: Message send failure'), DeliveryError('[0x0161:1:0x0300]: Message send failure'), DeliveryError('[0x0161:1:0x0300]: Message send failure'), TimeoutError()]
> 2022-05-02 07:38:25 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0x0161:1:0x0008]: async_initialize: all attempts have failed: [DeliveryError('[0x0161:1:0x0008]: Message send failure'), DeliveryError('[0x0161:1:0x0008]: Message send failure'), DeliveryError('[0x0161:1:0x0008]: Message send failure'), TimeoutError()]
> 2022-05-02 07:38:29 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Chromecast Audio' for tplink integration not ready yet: Unable to connect to the device: 192.168.0.219; Retrying in background
> 2022-05-02 07:38:38 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0xD776:3:0x0008]: async_initialize: all attempts have failed: [DeliveryError('[0xd776:3:0x0008]: Message send failure'), DeliveryError('[0xd776:3:0x0008]: Message send failure'), DeliveryError('[0xd776:3:0x0008]: Message send failure'), DeliveryError('[0xd776:3:0x0008]: Message send failure')]
> 2022-05-02 07:38:44 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template("{% if state_attr('sensor.rest980', 'cleanMissionStatus')['cycle'] == 'none' and state_attr('sensor.rest980', 'cleanMissionStatus')['notReady'] == 39 %}
> Pending
> {% elif state_attr('sensor.rest980', 'cleanMissionStatus')['notReady'] > 0 %}
> Not Ready
> {% else %} {% set mapper = {
> 'clean' : 'Clean',
> 'quick' : 'Clean',
> 'spot' : 'Spot',
> 'evac' : 'Empty',
> 'dock' : 'Dock',
> 'train' : 'Train',
> 'none' : 'Ready' } %}
> {% set state = state_attr('sensor.rest980', 'cleanMissionStatus')['cycle'] %} {{ mapper[state] if state in mapper else state }} {% endif %}")
> Traceback (most recent call last):
> File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 407, in async_render
> render_result = _render_with_context(self.template, compiled, **kwargs)
> File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1820, in _render_with_context
> return template.render(**kwargs)
> File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 1291, in render
> self.environment.handle_exception()
> File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 926, in handle_exception
> raise rewrite_traceback_stack(source=source)
> File "<template>", line 3, in top-level template code
> jinja2.exceptions.UndefinedError: 'None' has no attribute 'notReady'
> The above exception was the direct cause of the following exception:
> Traceback (most recent call last):
> File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 523, in async_render_to_info
> render_info._result = self.async_render(variables, strict=strict, **kwargs)
> File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 409, in async_render
> raise TemplateError(err) from err
> homeassistant.exceptions.TemplateError: UndefinedError: 'None' has no attribute 'notReady'
> 2022-05-02 07:38:44 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'notReady' when rendering '{% set mapper = {
> 0 : 'n-a',
> 2 : 'Uneven Ground',
> 15 : 'Low Battery',
> 39 : 'Pending',
> 48 : 'Path Blocked' } %}
> {% set state = state_attr('sensor.rest980', 'cleanMissionStatus')['notReady'] %} {{ mapper[state] if state in mapper else state }}'
> 2022-05-02 07:38:44 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'error' when rendering '{% set mapper = {
> 0 : 'n-a',
> 15 : 'Reboot Required',
> 18 : 'Docking Issue'} %}
> {% set state = state_attr('sensor.rest980', 'cleanMissionStatus')['error'] %} {{ mapper[state] if state in mapper else state }}'
> 2022-05-02 07:38:44 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'None' has no attribute 'split' when rendering '{% if state_attr('sensor.rest980', 'softwareVer') is defined %} {% set version = state_attr('sensor.rest980', 'softwareVer') %}
> {{ version.split('+')[1] }}
> {% else %}
> n-a
> {% endif %}'
> 2022-05-02 07:38:44 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template("{% if state_attr('sensor.rest980', 'softwareVer') is defined %} {% set version = state_attr('sensor.rest980', 'softwareVer') %}
> {{ version.split('+')[1] }}
> {% else %}
> n-a
> {% endif %}")
> Traceback (most recent call last):
> File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 407, in async_render
> render_result = _render_with_context(self.template, compiled, **kwargs)
> File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1820, in _render_with_context
> return template.render(**kwargs)
> File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 1291, in render
> self.environment.handle_exception()
> File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 926, in handle_exception
> raise rewrite_traceback_stack(source=source)
> File "<template>", line 2, in top-level template code
> File "/usr/local/lib/python3.9/site-packages/jinja2/sandbox.py", line 391, in call
> if not __self.is_safe_callable(__obj):
> File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2042, in is_safe_callable
> return isinstance(obj, AllStates) or super().is_safe_callable(obj)
> File "/usr/local/lib/python3.9/site-packages/jinja2/sandbox.py", line 275, in is_safe_callable
> getattr(obj, "unsafe_callable", False) or getattr(obj, "alters_data", False)
> File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1846, in _fail_with_undefined_error
> raise ex
> File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1837, in _fail_with_undefined_error
> return super()._fail_with_undefined_error(*args, **kwargs)
> jinja2.exceptions.UndefinedError: 'None' has no attribute 'split'
> The above exception was the direct cause of the following exception:
> Traceback (most recent call last):
> File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 523, in async_render_to_info
> render_info._result = self.async_render(variables, strict=strict, **kwargs)
> File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 409, in async_render
> raise TemplateError(err) from err
> homeassistant.exceptions.TemplateError: UndefinedError: 'None' has no attribute 'split'
> 2022-05-02 07:38:44 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'phase' when rendering '{% if state_attr('sensor.rest980', 'cleanMissionStatus')['phase'] == 'charge' and state_attr('sensor.rest980', 'batPct') == 100 %}
> Idle
> {% elif state_attr('sensor.rest980', 'cleanMissionStatus')['cycle'] == 'none' and state_attr('sensor.rest980', 'cleanMissionStatus')['phase'] == 'stop' %}
> Stopped
> {% else %} {% set mapper = {
> 'charge' : 'Charge',
> 'run' : 'Run',
> 'evac' : 'Empty',
> 'stop' : 'Paused',
> 'stuck' : 'Stuck',
> 'hmUsrDock' : 'Sent Home',
> 'hmMidMsn' : 'Mid Dock',
> 'hmPostMsn' : 'Final Dock' } %}
> {% set state = state_attr('sensor.rest980', 'cleanMissionStatus')['phase'] %} {{ mapper[state] if state in mapper else state }} {% endif %}'
> 2022-05-02 07:38:44 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'full' when rendering '{% set mapper = {
> true : 'Full',
> false : 'Not Full' } %}
> {% set state = state_attr('sensor.rest980', 'bin')['full'] %} {{ mapper[state] if state in mapper else state }}'
> 2022-05-02 07:38:44 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'present' when rendering '{% set mapper = {
> true : 'Yes',
> false : 'No' } %}
> {% set state = state_attr('sensor.rest980', 'bin')['present'] %} {{ mapper[state] if state in mapper else state }}'
> 2022-05-02 07:38:44 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'initiator' when rendering '{% set mapper = {
> 'schedule' : 'Scheduler',
> 'rmtApp' : 'App',
> 'manual' : 'Robot',
> 'localApp' : 'HA' } %}
> {% set state = state_attr('sensor.rest980', 'cleanMissionStatus')['initiator'] %} {{ mapper[state] if state in mapper else state }}'
> 2022-05-02 07:38:44 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'notReady' when rendering '{% set mapper = {
> 0 : 'n-a',
> 2 : 'Uneven Ground',
> 15 : 'Low Battery',
> 39 : 'Pending',
> 48 : 'Path Blocked' } %}
> {% set state = state_attr('sensor.rest980', 'cleanMissionStatus')['notReady'] %} {{ mapper[state] if state in mapper else state }}'
> 2022-05-02 07:38:44 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'error' when rendering '{% set mapper = {
> 0 : 'n-a',
> 15 : 'Reboot Required',
> 18 : 'Docking Issue'} %}
> {% set state = state_attr('sensor.rest980', 'cleanMissionStatus')['error'] %} {{ mapper[state] if state in mapper else state }}'
> 2022-05-02 07:38:44 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'None' has no attribute 'split' when rendering '{% if state_attr('sensor.rest980', 'softwareVer') is defined %} {% set version = state_attr('sensor.rest980', 'softwareVer') %}
> {{ version.split('+')[1] }}
> {% else %}
> n-a
> {% endif %}'
> 2022-05-02 07:38:44 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'phase' when rendering '{% if state_attr('sensor.rest980', 'cleanMissionStatus')['phase'] == 'charge' and state_attr('sensor.rest980', 'batPct') == 100 %}
> Idle
> {% elif state_attr('sensor.rest980', 'cleanMissionStatus')['cycle'] == 'none' and state_attr('sensor.rest980', 'cleanMissionStatus')['phase'] == 'stop' %}
> Stopped
> {% else %} {% set mapper = {
> 'charge' : 'Charge',
> 'run' : 'Run',
> 'evac' : 'Empty',
> 'stop' : 'Paused',
> 'stuck' : 'Stuck',
> 'hmUsrDock' : 'Sent Home',
> 'hmMidMsn' : 'Mid Dock',
> 'hmPostMsn' : 'Final Dock' } %}
> {% set state = state_attr('sensor.rest980', 'cleanMissionStatus')['phase'] %} {{ mapper[state] if state in mapper else state }} {% endif %}'
> 2022-05-02 07:38:44 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'full' when rendering '{% set mapper = {
> true : 'Full',
> false : 'Not Full' } %}
> {% set state = state_attr('sensor.rest980', 'bin')['full'] %} {{ mapper[state] if state in mapper else state }}'
> 2022-05-02 07:38:44 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'present' when rendering '{% set mapper = {
> true : 'Yes',
> false : 'No' } %}
> {% set state = state_attr('sensor.rest980', 'bin')['present'] %} {{ mapper[state] if state in mapper else state }}'
> 2022-05-02 07:38:44 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'initiator' when rendering '{% set mapper = {
> 'schedule' : 'Scheduler',
> 'rmtApp' : 'App',
> 'manual' : 'Robot',
> 'localApp' : 'HA' } %}
> {% set state = state_attr('sensor.rest980', 'cleanMissionStatus')['initiator'] %} {{ mapper[state] if state in mapper else state }}'
> 2022-05-02 07:38:44 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'None' has no attribute 'notReady'') while processing template 'Template("{% if state_attr('sensor.rest980', 'cleanMissionStatus')['cycle'] == 'none' and state_attr('sensor.rest980', 'cleanMissionStatus')['notReady'] == 39 %}
> Pending
> {% elif state_attr('sensor.rest980', 'cleanMissionStatus')['notReady'] > 0 %}
> Not Ready
> {% else %} {% set mapper = {
> 'clean' : 'Clean',
> 'quick' : 'Clean',
> 'spot' : 'Spot',
> 'evac' : 'Empty',
> 'dock' : 'Dock',
> 'train' : 'Train',
> 'none' : 'Ready' } %}
> {% set state = state_attr('sensor.rest980', 'cleanMissionStatus')['cycle'] %} {{ mapper[state] if state in mapper else state }} {% endif %}")' for attribute '_attr_native_value' in entity 'sensor.vacuum'
> 2022-05-02 07:38:44 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'None' has no attribute 'split'') while processing template 'Template("{% if state_attr('sensor.rest980', 'softwareVer') is defined %} {% set version = state_attr('sensor.rest980', 'softwareVer') %}
> {{ version.split('+')[1] }}
> {% else %}
> n-a
> {% endif %}")' for attribute 'software_ver' in entity 'sensor.vacuum'
> 2022-05-02 07:38:44 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'battery' when rendering '{{ states.sensor.vacuum.attributes.battery }}'
> 2022-05-02 07:38:44 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'battery' when rendering '{{ states.sensor.vacuum.attributes.battery }}'
> 2022-05-02 07:38:49 ERROR (MainThread) [custom_components.frigate.api] Error fetching information from http://ccab4aaf-frigate:5000/api/stats: Cannot connect to host ccab4aaf-frigate:5000 ssl:default [Try again]
> 2022-05-02 07:39:00 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0x98EE:11:0x0006]: async_initialize: all attempts have failed: [DeliveryError('[0x98ee:11:0x0006]: Message send failure'), DeliveryError('[0x98ee:11:0x0006]: Message send failure'), DeliveryError('[0x98ee:11:0x0006]: Message send failure'), DeliveryError('[0x98ee:11:0x0006]: Message send failure')]
> 2022-05-02 07:39:18 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0xD776:3:0x0006]: async_initialize: all attempts have failed: [DeliveryError('[0xd776:3:0x0006]: Message send failure'), DeliveryError('[0xd776:3:0x0006]: Message send failure'), DeliveryError('[0xd776:3:0x0006]: Message send failure'), DeliveryError('[0xd776:3:0x0006]: Message send failure')]
> 2022-05-02 07:39:19 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.washroom
> 2022-05-02 07:39:44 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'None' has no attribute 'split' when rendering '{% if state_attr('sensor.rest980', 'softwareVer') is defined %} {% set version = state_attr('sensor.rest980', 'softwareVer') %}
> {{ version.split('+')[1] }}
> {% else %}
> n-a
> {% endif %}

If you suspect it is a frontend issue I would check network operations / console in chrome debug tool. Would probably give some hints.

I’ve recently been getting the same, been like butter until now running on a vastly overspec’d VM. The only thing I can see that has changed is I enabled system log event firing but I’ve disabled that again to no affect and MariaDB updated but can so no errors in the logs for that being an issue!? @finalbillybong are you using MariaDB 2.6.0?

I’ll have a look at the chrome developer logs but it seems to be responsiveness.