I am seeing the below error repeat regularly in the log.
ERROR (MainThread) [homeassistant.components.template.sensor] Could not render template horizon_gpu_memory: UndefinedError: 'mappingproxy object' has no attribute 'mem'
I’ve seen solutions to avoid getting this error. However, I haven’t figured out how to adapt my template to avoid getting the error successfully. I’m also not sure why this error even happens.
Could someone please tell me how to change my template to avoid getting this error?
It appears the the response from the API end-point doesn’t always produce a valid “mem” value (for whatever reason). When it doesn’t, it produces the error message I posted.
Update: It seems like the reason I’m getting that error is because the API endpoint for the REST sensor is timing out once in a while. Below, is the error preceding the ’mappingproxy object’ has no attribute error message:
So, if I were to replace my value_template with the one you posted, it should avoid getting the error message when there isn’t a “mem” attribute? I’m just looking for a way to avoid getting this error if possible. I’m not sure how to avoid not getting the read timeout error. So, if there’s a way to avoid getting the subsequent error, I’d like to know.