-
Notifications
You must be signed in to change notification settings - Fork 24
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
Fix potential div zero error in init #95
Conversation
Wraps math function inside ternary operator to provide for a "default" value when actual values are not available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't assume values if there are none, I think this should be a missing data point and I think None will plumb through here?
Updated with feedback. Also, let me know if you have a preference for full fat if/else instead of ternaries as the primary maintainer. I have a tendency toward one-liners when making quick hacks, but for they can sometimes be not so great for code readability. |
Just making sure this is tested and does what I'd expect (I'm not 100% sure, but believe this should result in unknown data for a sample with 0 inverters) I'm perfectly happy with the ternaries, they are small enough they stay perfectly readable (IMO) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so long as this does what I think go for it.
I'm testing just by editing the filed directly on my install through the VSCode add-on. I have confirmed your surmise that the value being None make the resulting entitites In
|
Wraps math function inside ternary operator to provide for a "default" value when actual values are not available.
I suspect this happens when the virtual meter device is created during local night, when the inverters are in an error state, and associated entites are unavailable.