Hi, I wrote an AppDaemon app that controls a power station in order to shift electricity use to times of lower prices. I am using the A* (A-star) algorithm to calculate the charge plane a day in advance. Running this algorithm can take >10 seconds to complete. It works fine, but I keep getting warnings in the log file:
2022-10-19 21:50:44.768316 WARNING AppDaemon: callback control_battery() in battery_manager_living_room has now completed 2022-10-19 21:50:44.818072 WARNING AppDaemon: Excessive time spent in utility loop: 13043.0ms, 13042.0ms in check_app_updates(), 1.0ms in other
This leads me to believe that I am doing something wrong. I already tried making the app async, I unpinned it, and I use the
run_in_executor thing mentioned in the docs. But the warnings keep coming. Could someone point me in the right direction how to deal with callbacks that take a lot of time actually computing something (and not just waiting for IO)?
This is the code and the function call that takes so long: appdaemon_battery_manager/battery_manager.py at a73c343fba34219c9cb422181679e28bb3d50ce8 · ast0815/appdaemon_battery_manager · GitHub
Thanks in advance!