Python3 high CPU Usage

Hi everyone
What is the consensus on this issue? Is this individual?
I am running it on NUC and noticed CPU usage increase as well

_worker can be ignored as its idle time.

eintr_retry_call looks like a bug in pyudev. It could be related to Stack trace from MonitorObserver thread · Issue #194 · pyudev/pyudev · GitHub

write is from a tarfile / backup creation.

I have an Intel Nuc and its always running between 60-100 cpu use. I have tried the profiler and created to files. But I have no idea how to look at the files. Can someone help me or guide me how to do that? :slight_smile:

I believe the docs on the profiler page give a few options on how to view the files:

I also have this issue with mostly 100% cpu. But I’m wondering why.

Can someone read these files, as I can’t get to read it with those programs: HERE

What about addons. Which ones do you have installed?

I’m running HA in docker. I only have integrations:
Wemo
Marantz
Viera VT60 DLNA
Slimme meter
Google Cast
Govee
HACS
Brother Printer
Libreelec
LG webOS Smart TV
Lifx
Home
Mobile app
MQTT
Netgear
Node-RED companion
Profiler
Squeezebox
Tuya
Xiaomi Miio
Sun

configuration.yaml

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

# GROUPS
light:
  - platform: group
    name: Eetkamer
    entities:
      - light.eetkamer_spots
      - light.eetkamer_1
      - light.eetkamer_2
      - light.eetkamer_3
  - platform: group
    name: Play
    entities:
      - light.play_l
      - light.play_r
  - platform: group
    name: Spots Tuin 
    entities: 
      - light.tuin_spot_links 
      - light.tuin_spot_rechts 
  - platform: group
    name: Spots Erker 
    entities: 
      - light.erker_spot_links 
      - light.erker_spot_rechts
  - platform: group
    name: Alle Lampen Woongedeelte
    entities:
      - light.erker_spot_links      
      - light.erker_spot_rechts
      - light.tuin_spot_links
      - light.tuin_spot_rechts
      - light.eetkamer_spots
      - light.eetkamer_1
      - light.eetkamer_2
      - light.eetkamer_3
      - light.play_l
      - light.play_r
      - light.keuken_ikea
      - light.hoeklicht
      - light.staande_lamp
      - light.hanglamp
  - platform: group
    name: Keuken
    entities:
      - light.keuken1
      - light.keuken2
      - light.keuken3

camera:
  - platform: xiaomi_cloud_map_extractor
    host: !secret xiaomi_vacuum_host
    token: !secret xiaomi_vacuum_token
    username: !secret xiaomi_cloud_username
    password: !secret xiaomi_cloud_password
    draw: ['all']
    attributes:
      - calibration_points


device_tracker:
  - platform: google_maps
    username: ********@gmail.com

What other containers do you have then?

zigbee2mqtt, mosquito, portainer.

When I stop homeassistant, the high CPU is gone and python3 is not shown in top.

To test, I made another Homeassistant test container. No configuration, no integrations, nothing. Cpu is now low.

So what makes the cpu so high on my main HA? Could it be the home-assistant_v2.db file. That’s about 500 MB.

Nope that’s quite small.

Backuped the database and tried with a fresh one, but that did not make a difference.

I think I narrowed it down. I disabled the custom_components folder. And now the CPU is max 15%.

And the issue was this: Xiaomi Cloud Map Extractor

Here is your event loop graph. Most of the time in there is spent on denonavr but overall its not that much.

after having finally managed to run py-spy in my HAOS system, please let me ask this:

we have to start that process with

docker exec -it homeassistant /bin/bash

but shouldn’t we somehow finish that too? how can we leave the container again, which command is used for that?

exit

1 Like


dear o dear… it was that simple… thing is, in unprotected mode, I didnt dare just go hit an run :wink:

thanks Tom

1 Like

Sorry to raise an old thread. Do you happen to remember how you did it?
I am on the lastest build of HA OS and I have portainer addon as well
what were your steps please?
My HA instance keep pegging at 100 cpu sometimes which makes it crash and reboot.