-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[evcc] Fix missing grid readings after evcc breaking change in 0.133.0 #18199
base: main
Are you sure you want to change the base?
[evcc] Fix missing grid readings after evcc breaking change in 0.133.0 #18199
Conversation
Fixes openhab#18148 Signed-off-by: Daniel Kötting <[email protected]>
Can we spend the extra effort and implement this change backward compatible? Allowing the old and the new location of the grid values? |
Might Work. I will have a look later and try to implement it with a quick version check.
|
Fixes openhab#18148 Signed-off-by: Daniel Kötting <[email protected]>
I have added the workaround and testet with evcc 0.131.5 and 0.133.0. |
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.
Overall LGTM, thanks!
I have added a few comments, please take a look at them.
} | ||
|
||
/** | ||
* @return grid's power or {@code null} if not available | ||
* @return is grid configured |
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.
* @return is grid configured | |
* @return whether grid is configured (since evcc version 0.133.0) |
} | ||
|
||
/** | ||
* @return grid's energy | ||
* @return all grid related values |
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.
* @return all grid related values | |
* @return all grid related values (since evcc version 0.133.0) |
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.
Assuming my comments are correct (can you please verify?), I would add some API compatibility notes to the changed values.
Please also update the class JavaDoc for the evcc version compatibility.
float gridPower = ((result.getGridPower() == null) ? 0.0f : result.getGridPower()); | ||
Grid grid = result.getGrid(); |
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.
Grid grid = result.getGrid(); | |
// handling gridPower since evcc version 0.133.0 | |
Grid grid = result.getGrid(); |
// and from https://docs.evcc.io/docs/reference/configuration/messaging/#msg | ||
|
||
@SerializedName("currents") | ||
private float[] currents; |
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.
Does this also work if no currenty are provided in the JSON response?
private float[] currents; | ||
|
||
@SerializedName("energy") | ||
private float energy; |
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.
Looking at the evcc demo, it might be possible that this value is not available, which would make deserialization fail. Can you please switch to Float
?
Fixes #18148
This PR fixes the new alignment of grid data comming from evccs /api/state endpoint.
The old and new structure can be seen in this conversation over at evcc evcc-io/evcc#18063
This change is not backwards compatible with older versions of evcc.