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

Add IQ Battery power charge and discharge #207

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

isottipietro
Copy link

Maybe not an elegant code, but add the ability to read single iq battery power and aggregate power to or from battery, also correcting net consumption and import/export.

Copy link
Collaborator

@catsmanac catsmanac left a comment

Choose a reason for hiding this comment

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

Thanks @isottipietro. Can you also add a description of the new entities and if calculated how, to the documentation (https://github.com/catsmanac/home_assistant_custom_envoy/blob/a9287a922b8b7ece5f624a5b13248498dcc42250/README.md?plain=1#L209)

@@ -858,13 +867,16 @@ async def consumption(self,phase=None):
jsondata = await self._meters_report_value("currW",report="total-consumption",phase=phase)
if jsondata is None:
return self.message_consumption_not_available if phase is None else None
if self.batteries_power != 0:
jsondata = self.batteries_power + self.pv_power + self.grid_power
Copy link
Collaborator

Choose a reason for hiding this comment

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

This replaces a value reported by the Envoy with a calculated value. This integration is always reporting Envoy values as they are. So best add a new entity like calculated_consumption and give it the value of the calculation.

Also, with the construct !=0 the calculation will not be done when battery is not charging or discharging (value=0), and if so, in current construct the entity will then use the value from the CT again. Again, best use a new entity for this

def unique_id(self):
"""Return the unique id of the sensor."""
if self._serial_number:
return f"{self._serial_number}_power"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This creates a unique_id like

"unique_id":"12345678901006_power"

If you want to keep the option for future migration to the HA Core integration as open as possible, consider using

"unique_id":"12345678901005_real_power_mw"

As that's the unique_id created by the core one.

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

Successfully merging this pull request may close these issues.

2 participants