New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
decimal.InvalidOperation #914
Comments
I have added extra logging for the next release so we can see which entity is the culprit. And what the value is it is trying to convert to a decimal. |
Getting this as well! Using template and doing some math so not sure if it's an issue with my template. Example of what I'm using:
Maybe there is a better way to do it to ensure it's safer but it should at least work for now I'd think. |
I added the |float to everything to ensure it was typed but dunno if that is even necessary. |
I have found the issue, the problem is with sensors having a template as the value and created with new config flow. Will have some time to write some tests and make the fix tomorrow. @ColinRobbins did you also use a power sensor with templates? |
I do. |
I may be barking up the wrong tree, but I only see the issue at start up. |
hmm I am pretty sure that this bug I reproduced for specifically the config flow created entities will never work if you use a template. |
Hi,
I have several entries with template sensors, and this only throws 1 error. |
Ah ok |
No problem - by trial an error, I have tracked it to the following...
The sensor
My guess is, that during the startup sequence, If I change it to
The error goes away. |
Ok that's nice. Could you still check what value is in the logs when you use your old simple template? I suspect it is "unknown". When I know this I can have a look into making this a littlte more failsafe so no error will be logged in the error log and you can still use your old template. |
@ColinRobbins I have found the best solution to your problem. @jfrux You issue with the template not being evaluated when using the config flow is also fixed, see #918, this will also be in the upcoming release. |
I've run v0.24.4 and reverted my template.
I can now resolve this locally. Thank you. |
Just released v0.24.5 with proposed fixes mentioned above. |
I am seeing the followng error in my logs.
I am running HA 2022.8.0b0.
PowerCalc 0.24.3.
I think the error was probably hapening before I upgraded from 2022.7.7, but cannot be certain.
Alas, I can't (easily) roll back to verify to database schema changes in 22.22.8.0b0
The error is ocurring at Startup time, so maybe because the status of a sensor is "Unavailable" or "Unknown" as it has not fully started yet. Thus the conversion to decimal fails.
The text was updated successfully, but these errors were encountered: