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

Be able to use myenergi CT's for solar panels/battery storage #421

Closed
reedy opened this issue Sep 26, 2023 · 17 comments
Closed

Be able to use myenergi CT's for solar panels/battery storage #421

reedy opened this issue Sep 26, 2023 · 17 comments

Comments

@reedy
Copy link
Contributor

reedy commented Sep 26, 2023

Is your feature request related to a problem? Please describe.
It seems currently unable to use any of the other CT's (from harvi, eddi or zappi) as either "Solar Production" or "Battery System".

Describe the solution you'd like
Be able to use any (and all) of the CT's in the myenergi integration as data sources for "Solar Production" or "Battery System".

I believe this is related to how the sensors are integrated/labelled inside the add-on for HA?

Searching for myenergi ct I do see "ct grid today" and things like "ct internal load today".

But I don't see the other CT's from either the eddi, the zappi or the harvi, that are shown under the device

Screenshot 2023-09-26 at 23 57 34

None of these appear in the drop down for "Solar Production" or "Battery System"

Describe alternatives you've considered

Using other data sources? 😓

Additional context

A few other tasks seem to have related issues:

@G6EJD
Copy link

G6EJD commented Sep 27, 2023

This is not an integration issue/error, you have your MyEnergi system incorrectly setup, you need to go back to your system and make sure it is functioning correctly.

@reedy
Copy link
Contributor Author

reedy commented Sep 27, 2023

Incorrectly setup how?

Telling someone to "make sure it is functioning correctly" is not helpful.

There's basically no configuration on the HA add-on, and on the myenergi side (in their app, and functionality wise), things are working/showing as expected.

I filed this after talking to someone else who has just set it up, and found they had the same issue...

@G6EJD
Copy link

G6EJD commented Sep 27, 2023

Well there is an element of self-help and the integration here is working perfectly. Have you tried deleting it and re-adding it.
Have you looked at all the entities for this integration, they start: myenergi-Harvi-nnnnnn-service name
So nothing like the variants you or HA have selected.

@reedy
Copy link
Contributor Author

reedy commented Sep 27, 2023

"works for me" doesn't mean it works perfectly for everyone else. It doesn't mean there are no bugs, or no issues. Same as it doesn't necessarily mean I have done everything right (or wrong).

I last deleted and re-added it a couple of weeks ago for #400. But as I mention, it's not just me seeing the issue, including a user who only just set this up in the last couple of days.

Have you looked at all the entities for this integration, they start: myenergi-Harvi-nnnnnn-service name So nothing like the variants you or HA have selected.

What do you mean "nothing like"?

Screenshot 2023-09-26 at 23 57 34

Has spaces, because of it using the display names, as shown on other screens. It was showing that the sensors are there in HA, and can be used in other contexts/displays. But also, on the right, the variants you are suggesting, showing that the first are just the display names.

If we look more closely...

Screenshot 2023-09-27 at 10 25 50

And then try and find those, say, for example, as solar production...

Screenshot 2023-09-27 at 10 28 22

Does find some myenergi sensors, but it's for the "today" figures, not the more "instantaneous" figures (which presumably will have some lag with the API round trip) from the CT that HA clearly has access to, and is monitoring/graphing, and shows/allows useage of in other contexts.

But nothing for harvi, at all:

Screenshot 2023-09-27 at 10 28 28


The data is making it into HA

Screenshot 2023-09-27 at 10 34 39
Screenshot 2023-09-27 at 10 34 34

And the closest, which seems to be some old sensor..

Screenshot 2023-09-27 at 10 36 37

Which doesn't appear on config/entities, but there is "sensor.myenergi_harvi_11XXXX19_power_ct_generation_battery" in the same place.

@LeiChat
Copy link

LeiChat commented Sep 27, 2023

Ooh! I had not realised myenergi had started capturing the additional CT data and made it available in the API.
Thanks to whoever was involved in adding that to the libraries/integrations for Home Assistant.

I have a third-party battery inverter (AC) being monitored with a CT clamp by my zappi (master with vHub) configured as such on the zappi. Will be interesting to compare the stats against the battery manufacturers app and the HA integration for their kit. Although, as it's snapshot data once every minute, accuracy isn't likely to be very good and even less so from a CT compared to internally generated data from the battery inverter.

image

With regards to @ready's query about why they aren't offered for the energy dashboard in Home Assistant, might that be due to their type or units? Does the energy dashboard only support certain ones?

@G6EJD
Copy link

G6EJD commented Sep 27, 2023

I’m sure you’ll fix your system setup so all the entities become correct.

@LeiChat
Copy link

LeiChat commented Sep 27, 2023

When configuring solar for the energy dashboard I am offered a sensor for myenergi.
(zappi is the master device and the CT measuring PV generation (AC) is hard wired to it)

Is there not an HA integration for your solar panel inverter though? Would have thought you would get more accurate stats using that than basing it on CTs connected to myenergi harvi and/or master device.

image

@reedy
Copy link
Contributor Author

reedy commented Sep 27, 2023

I’m sure you’ll fix your system setup so all the entities become correct.

You are really not being helpful whatsoever. Please stop.

With regards to @ready's query about why they aren't offered for the energy dashboard in Home Assistant, might that be due to their type or units? Does the energy dashboard only support certain ones?

Something along those lines would make more sense, indeed.

https://www.home-assistant.io/docs/energy/solar-panels/ and https://www.home-assistant.io/docs/energy/battery/ don't give any hints as to the specific setup, beyond saying you can use an API (if one and an integration exists) and/or a CT clamp.

It's a little unclear if these various Energy Config items are supposed to be supporting "instantaneous" readings, or is it supposed to be using these "accumulative" sensors.

Based on the ones that are appearing, this would be the case, but it's poorly documented.

When configuring solar for the energy dashboard I am offered a sensor for myenergi. (zappi is the master device and the CT measuring PV generation (AC) is hard wired to it)

Yeah, there are sensors for myenergi (see screenshots in earlier comments), I'm not saying that no sensors appear at all, it just seems/feels odd that the individual CT options don't appear for use in the energy configuration screen.

I have the "today"/"accumulative" myenergi sensors (and am currently using the myenergi "Grid Import Today" and "Grid Export Today" for the grid sensors) appearing, it just feels, and maybe it's a wrong assumption on my (and other peoples) end that the more instantenous ones should be showing in those fields. Sure, that's also a documentation issue, and I can make an attempt to fix that in various places... Incuding here (suggesting what people might want to use in various different boxes).

Sam, do you have this "_home_home" sensor?

I do, yeah.

@LeiChat
Copy link

LeiChat commented Sep 27, 2023

To the best of my knowledge, there's nothing added to the definition of an entity in an HA integration to make it specifically available for use in the Home Assistant energy dashboard. I think it's simply based on the unit being energy and not power.
In HA, I am offered a long list that include energy sensors from various integrations and for Helpers I've created for smart plug energy consumption.

I believe the myenergi libbi is a hybrid inverter, so the "myenergi ... ct generation today" entity reporting zero (for me) suggests that entity is intended to show the generation from panels connected to the libbi string inverter, rather than for third party PV generation measured through a CT connected to a harvi or vHub device.

Unless there is an easy way for those maintaining the library this integration uses to include cumulative daily energy values, (calculated from the CT power data??) AND a way to dynamically name them based on how they are configured on the harvi/vHub (bare in mind each CT could be wired to one of a few ports) then, it is probably better for you to use a Home Assistant Helper.

@LeiChat
Copy link

LeiChat commented Sep 27, 2023

It's a little unclear if these various Energy Config items are supposed to be supporting "instantaneous" readings, or is it supposed to be using these "accumulative" sensors.

The HA Energy dashboard configuration does prompt you to pick an "energy consumption" entity, so definitely a cumulative sensor OR "Integration - Riemann sum integral" Helper.

image

@reedy
Copy link
Contributor Author

reedy commented Sep 27, 2023

Unless there is an easy way for those maintaining the library this integration uses to include cumulative daily energy values, (calculated from the CT power data??) AND a way to dynamically name them based on how they are configured on the harvi/vHub (bare in mind each CT could be wired to one of a few ports) then, it is probably better for you to use a Home Assistant Helper.

The "types" of CT is fairly limited - https://www.myenergi.com/wiki/zappi-v2-wiki/13650-2/#CTConfig (thankfully not free text).

But I do agree, extra handling would be needed, if we were going to go down that route. There's potentially some value in that if it is set to anything but "none" to be reporting this/collecting this... And it would make more sense for the library/add-on to be doing it, if possible, rather than users doing it themselves each time...

I believe the myenergi libbi is a hybrid inverter, so the "myenergi ... ct generation today" entity reporting zero (for me) suggests that entity is intended to show the generation from panels connected to the libbi string inverter, rather than for third party PV generation measured through a CT connected to a harvi or vHub device.

I don't have a "ct generation today", but I do have a "_generated_today" (sensor.myenergi_hub_name_generated_today).

To the best of my knowledge, there's nothing added to the definition of an entity in an HA integration to make it specifically available for use in the Home Assistant energy dashboard. I think it's simply based on the unit being energy and not power.

And this makes sense.

And if the real resolution here is to further improve the documentation/readme, both here and/or upstream in HA in applicable places, that's fine.

I suspect it could/should be documented a bit more as to what sensors you should be using (rather than expecting users to work it out), and then suggesting either how to use the CT's for others, or, more likely (maybe? probably?) suggesting they get some information from elsewhere. Other integrations or APIs as appropriate/available.

The HA Energy dashboard configuration does prompt you to pick an "energy consumption" entity, so definitely a cumulative sensor OR "Integration - Riemann sum integral" Helper.

Yay, units.

Pick a sensor which measures solar energy production in either of GJ, kWh, MJ, MWh, Wh.

Pick sensors which measure energy going in to and out of the battery in either of GJ, kWh, MJ, MWh, Wh.

Grid consumption is the energy that flows from the energy grid to your home.

Pick a sensor which measures grid consumption in either of GJ, kWh, MJ, MWh, Wh.

Grid production is the energy that flows from your solar panels to the grid.

Pick a sensor which measures grid production in either of GJ, kWh, MJ, MWh, Wh.

@LeiChat
Copy link

LeiChat commented Sep 27, 2023

haha, I just meant that the CT sensors you mentioned are all returning power in W, rather than energy in Wh, so wouldn't be suitable for the Home Assistant energy dashboard. The "Integration" Helper is designed to assist with getting energy data for devices, like smart plugs and the CT entities in this HA Community myenergi integration, that only offer measure power.

https://www.home-assistant.io/integrations/integration/#energy

Yes, perhaps this community integration's documentation might benefit from a section that advises which entities you could opt to use for the HA Energy dashboard and how to configure Integration Helpers.

The reason I was suggesting using alternative source for your solar PV and/or grid import/export was because CTs are known to be somewhat inaccurate and the myenergi devices only capture the value to their cloud at 60 second intervals. I have a SolarEdge inverter, for which there fortunately is an HA integration. The data it captures definitely more closely matches what the physical generation meter displays than the CT based figures.

@G6EJD
Copy link

G6EJD commented Sep 27, 2023

Or simply change the settings for the CT’s to get the correct units.

@reedy
Copy link
Contributor Author

reedy commented Sep 27, 2023

The reason I was suggesting using alternative source for your solar PV and/or grid import/export was because CTs are known to be somewhat inaccurate and the myenergi devices only capture the value to their cloud at 60 second intervals. I have a SolarEdge inverter, for which there fortunately is an HA integration. The data it captures definitely more closely matches what the physical generation meter displays than the CT based figures.

Yeah, in my case, I've got a USB RS485 adapter into my inverter, and there's a third party HA integration... And have been doing this for at least a year at this point (after some trial and error of different adapters that weren't reliable).

In the case of the person I was helping last night, their options are a little more limited (a quick looks suggests growatt has many issues, including various rate limiting of their API), and they're planning on changing their inverter/battery setup "soon", so don't necessarily want to be spending much money on hardware/similar that may not be helpful on their new setup.

@trizmark
Copy link
Contributor

@reedy All you need to do is put the CT data through a Riemann sum integral helper. The CT data is a spot measurement in time (W/kW). What the energy dashboard requires is measurement over time (Wh/kWh).
When configuring the integral helper, make sure that you select method as 'left' (and not the default trapezoid).
Once you create the helper (and it got at least 3 updates to calculate a value), you'll be able to select it when configuring the energy dashboard. (Attaching an sample config - it's from my libbi's CT, but the principle is the same.)

Screenshot 2023-09-28 at 12 32 05

@CJNE
Copy link
Owner

CJNE commented Oct 4, 2023

The answer has already been given in the discussion, so I just to to confirm.
Only sensors that measure energy can be used in the energy dashboard. The CT sensors are measuring power (W) rather than energy (Wh).
Closing this as it's not fixable, but feel free to continue discussing.
I think the idea of using Riemann sum integral helper might be useful for others, perhaps it should be added in the readme..

@CJNE CJNE closed this as completed Oct 4, 2023
@reedy
Copy link
Contributor Author

reedy commented Oct 4, 2023

Thanks, yeah.

Updating the readme (further) is on my todo list when I have a bit more time to sit down and put it together

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

No branches or pull requests

5 participants