High cpu usage

I´m having some trouble with home assistant where it goes 100% cpu on one core.
It can run fine for some time(30-50 minutes) then it kicks into high cpu usage mode, my configuration is split over 70 files so its hard to share.

I first encountered this issue on 0.42 so i upgraded to 0.43.2 to se if that resolved the issue but sadly it did not. (I´m not sure if 0.42 caused it or if i added some new component)

is there any other way than turning off one component at a time to figure out what is causing the issue?

I´m on windows running on windows 10 if that matters.

Im still having this problem, is there tool to show what in a python application is using all the cpu cycles?

I also have Win10 and 0.42, but none issues…
My suggestion, before incremental commenting, is: log everthing in the History, inclusive CPU usage, then try to visualy identify what is running when the cpu graph rise (compare with others days for patterns).
If you have logger with debug search anything suspect about the time when cpu rises.

I ahve noticed as well that over the last couple of releases (not sure exactly which release it started on) But I am running HA in docker on my Synology NAS 1515+ CPU sometimes hits up to 25%…

It got to the point for me that i added a automation and notification when it happens so i can restart HA…

sensor:
  - platform: systemmonitor
    resources:
    - type: processor_use

binary_sensor:
  - platform: template
    sensors:
      cpu_overload:
        value_template: "{{ states('sensor.cpu_use')|int > 25 }}"
        friendly_name: 'cpu above 25 %'

automation:
  - alias: cpu usage above 25 percent
    initial_state: 'on'
    trigger:
    - platform: state
      entity_id: binary_sensor.cpu_overload
      state: 'on'
      for:
        seconds: 10
    action:
      - service: automation.turn_off
        entity_id: automation.cpu_usage_above_25_percent
      - service: notify.notify
        data:
          title: "Warning"
          message: "CPU Spike"
      - delay:
          minutes: 5
      - service: automation.turn_on
        entity_id: automation.cpu_usage_above_25_percent
2 Likes

That’s awesome… Thanks!

Jeez, this thing is running hot… constantly over 30%… just updated to .45 but still seems to run high…

Mine cools down for some time if i restart it… my guess is that 30% constant is not normal…
I wish there was some inbuilt profiler to find the cause…

My cpu usage over the last 6 months.

The first two jumps were upgrades to HA (0.36?) and appdaemon (0.51?). The first big reduction was removing unnecessary modules from HA (discovery and MySensors).

The third and fourth jump was adding more appdaemon apps, and the final reduction was figuring out that appdaemon was working out dependencies every second, and stopping it.

But the best I have had is still around 25%. The biggest users now are influxdb and appdaemon.