chinezbrun / pytes_serial

Read RS232 serial port of PYTES and PYLONTECH LiFePo4 batteries, send data to MQTT, JSON and MariaDB ,There is a build in integration with Home Assistant.
GNU Affero General Public License v3.0
17 stars 3 forks source link

reported 100% CPU when running #23

Closed Banana5kin closed 5 months ago

Banana5kin commented 6 months ago

Hi there,

When I run pytes_serial.py one of the RPI cores is constantly at 100%. It's configured for mysql and mqtt, and I have configured for one or other with no change to cpu usage. The refresh period is set to 600 seconds so it's not like I am trying to hammer the stats.

image

I ran py-spy to monitor the running python code with the results below.

image

Many thanks.

chinezbrun commented 6 months ago

while true loop is used in the code and the behaviour is normal and will not affect the overall performance. while loop will use 100% of available idle CPU resources, and will only begin to use less when other CPU intensive processes are started up. anyhow i will try to fix this to do not be reported as 100% .