Skip to content
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

added lgess15 support #17432

Open
wants to merge 1 commit into
base: feat/lgess15
Choose a base branch
from

Conversation

texperiri
Copy link
Contributor

Added new template for the lg-ess-home-15 type
Adapted meters/lgess and lgpcs to be able to differ between lg-ess-home-8-10 and lg-ess-home-15 because lg-ess-home-15 provides different content in the json data.

@texperiri
Copy link
Contributor Author

this enhancement has not yet been tested live on an ESS HOME 15

@andig andig added the devices Specific device support label Nov 24, 2024
@andig
Copy link
Member

andig commented Nov 25, 2024

Thank you for the PR (and creative use of generics)! I think we could still make this a little more elegant- if your want?

}

// read data from Lgess, reconnects if session expired
func refreshDataFromLgess[T MeterResponse8 | MeterResponse15](meterResponse *T, m *Com) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about

func (m *Com) refresh(res any) error 

and then call it with

var res EssData8
err := m.refresh(&res)

res.GridPower = -res.GridPower
// convert response from LgEss8/10 into interface EssData
func essDataFromMeterResponse8(essData *EssData, meterResponse *MeterResponse8) {
essData.GridPower = meterResponse.Statistics.GridPower
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a bit awkward. An alternative would be to make EssData8 and EssData15 implement a common interface?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devices Specific device support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants