Closed
Description
System Health details
Measure script issue
Checklist
- I have read the FAQ to see if there is a known solution to my problem.I have enabled debug logging for my installation.I have filled out the issue template to the best of my ability.This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).This issue is not a duplicate issue of currently previous issues..
Describe the issue
I've been recently contributing to powercalc and I have been measuring some of my devices using the built in script.
However one of my biggest grips is when there is a 500 error presented during the home assistant api call there is no graceful error handling. Without this error handling or attempt to retry the entire measure session is wasted on a temporary error that is quickly gone away.
Reproduction steps
- Start measure session
- Create error 500 response code during measure session
- Watch entire 4 hours go down the drain
Debug logs
N/A
Diagnostics dump or YAML config
No response
Activity
bramstroker commentedon Jan 29, 2025
You should be able to continue at the point it crashed when you have half CSV.
The measure tool should provide you with an option to resume.
Will have a look how to improve retry mechanism when HA API is temporarily unavailable.
challgren commentedon Jan 30, 2025
By default the RESUME var is not set in the env. I uncommented it out and resume worked. However still having timeouts so having to keep restarting the script.
challgren commentedon Jan 30, 2025
Ok so I figured out why I'm getting these random 500 errors.
I checked the Home Assistant main log and see.
challgren commentedon Jan 30, 2025
Actually it looks like the issue is really the Hubspace integration. I keep getting 403 from their web service, my guess is rate limiting maybe occurring.
bramstroker commentedon Jan 30, 2025
Yes the "error" you showed from log is not really an error but just a deprecation notice. Shouldn't break anything, and not be the cause of 500 error.
bramstroker commentedon Jan 30, 2025
You could try raising the
SLEEP_TIME
in order to prevent hitting rate limiting on that cloud API. looking at the response code it shouldn't be rate limiting, but I won't be surprised if it's a badly implemented API or infrastructure.challgren commentedon Jan 30, 2025
Well majority of my issues were during the color_temp. Once I got into the HsVaration all my 403 errors resolved.
bramstroker commentedon Jan 31, 2025
I have probably fixed the deprecation error with #3041
Might be the problem you were running in the 403 errors, as the hs didn't give you issues.
Good to have this warning resolved anyway.
However having a hard time building the docker image.
github action keeps running in strange segmentation faults after 20 minutes :-(
New run is running here: https://github.com/bramstroker/homeassistant-powercalc/actions/runs/13077153943
Also cleared github caches now. Hopefully will succeed now.
challgren commentedon Jan 31, 2025
Yeah thats what I'm thinking it was Hubspace really causing the issues by sending a 403 randomly. And Home Assistant just returning 500 instead of the actual message. The other thing was just having to restart it after every 500 that was the real pain because I would start the measure script. Go about my day and come back to find out it crashed 5 minutes after I started it and now I gotta resume it. So it was really having to babysit the measure script to ensure it was still working.
bramstroker commentedon Feb 3, 2025
Closing this issue. Improvements have been done in measure tool to prevent the script from crashing on one error.
challgren commentedon Feb 3, 2025
Yep seems to be working great been running the effect measure for over 30 hours and no unexpected quits.