Emilv2 / huawei_solar

Home Assistant custom component for Huawei inverters
Apache License 2.0
172 stars 41 forks source link

Integrating with energy dashboard #61

Open themaninspain opened 2 years ago

themaninspain commented 2 years ago

I'm trying to get the energy output of the inverter to display in the energy dashboad, but only thedaily_yield sensor is available. Really what I want to use is the "sensor.sun2000_6ktl" which gives me the instantaneous reading but the entity is not listed in the "Configure Solar Panels" and the help says to contact the developer.

JacoboSanchez commented 2 years ago

Energy dashboard uses energy (kwh) and sensor.sun2000_6ktl is a power sensor (W), that is why it gets not listed as an option. Energy dashboard would never give you the instant W produced but the energy generated in a determined time window

themaninspain commented 2 years ago

thanks for the clarification. So I have to use one of the yield sensors instead?

JacoboSanchez commented 2 years ago

Yes, daily or total yield should work. My advice is to use total as daily resets to 0 at midnight but may give you issues if the system time between home assistant and inverter is not the same (if they do not reset the day at the same time). Total yield is incremental from the installation so home assistant is able to add to the current day the energy added from the last reading of the previous one

JacoboSanchez commented 2 years ago

For reference another post for a similar question where you can see some cards to have a power flow diagram in a dashboard (not the energy one from HA)

themaninspain commented 2 years ago

One thing I have noticed is my SUN2000 has a clamp for measuring the energy consumption of the whole home and the output I get from the HA instantaneous sensor is net energy production not what the panels are producing. The Huawei solar app gives me both numbers. What I don't have is a sensor for the clamp connected to the SUN2000 - is this accessible?

JacoboSanchez commented 2 years ago

Yes there are many values obtained from the inverter to the integration but most of them are attributes of the entitty, not sensors. You must define a sensor template at the configuration.yaml to transform them into sensors. For reference: This post and this post more or less covers that. For instance what determines the power imported/exported from grid is an attribute called power_meter_active_power which is positive or negative depending on the power direction (that is what the clamp measures.

AFAIK the attribute that contains the solar production is "input_power". If you do not use batteries input_power and active_power (which is the defaul value) should have the same (more or less) value

johanvh83 commented 2 years ago

I believe if you don't have a battery you can use the total_yield entity in the Energy integration. That works for me as far as my battery is not charged or discharged. My situation is more complex because I have a battery. I'm still struggeling with the real solar power production. It's a long story; it could be find here: https://community.home-assistant.io/t/struggling-to-setup-energy-integration-for-huawei-solar-system-with-battery/367664

themaninspain commented 2 years ago

I've taken a look at the the other posts and managed to set up the sensors and integrate them into the energy panel. Used two templates:

`# energy used

and

`# grid exported energy

Remember to change the sensor names to your installation (I found out the hard way :-()

johanvh83 commented 2 years ago

@themaninspain Where do you use your templates 'energy used' and 'grid exported energy' in the Energy Integration? I lost the way...

themaninspain commented 2 years ago

Yes, that's what the "device_class" and "state_class" are for. And so far it's working well.

johanvh83 commented 2 years ago

Apologies, had to define my question better: Your templates makes 2 new sensors: energy used and grid exported energy Where do you put them in the Energy setup? Grid consumption? Return to grid? Solar production? Battery system?

themaninspain commented 2 years ago

OK, this is how they are setup in the energy integration:

"Energy used" -> "Grid Consumption" "grid exported energy" -> "Return to grid"

johanvh83 commented 2 years ago

Ok, clear. I have a DSMR (digitale grid meter) so I read out the 'real' values. My problem is to get proper values for the Solar production. I have also a LUNA 2000 battery and so far I'm not able to set it up properly

themaninspain commented 2 years ago

Take a look at the 7th post in this thread, there are links to 2 posts with more info. I used them to work out how to get the readings I needed and they discuss installations with batteries.

themaninspain commented 2 years ago

I'm having a problem with the readings and I'm not sure if it is an issue with the readings themselves or the energy dashboard in HA. The "Energy from grid" measurement in the Dashboard is showing a number which is the real energy consumed minus the energy returned to the grid.

webdados commented 1 year ago

Hi @themaninspain,

Can you please share this in a YAML formatted way?

I've added the code to my configuration.yaml file, with the correct adaptations for my inverter name, and I can't find or use the energy_used and grid_exported_energy anywhere, even after restarting.

themaninspain commented 1 year ago

Hi, with the latest version of the integration you don't need these. The readings from the inverter show up as "Power Meter Consumption", "Power Meter Exported" and "Inverter Daily Yield". These can all be used directly in the Energy dashboard.

webdados commented 1 year ago

Is it "gridaccummulated", "gridexported" and "dailyyield*"? I can see them with the names you mention.

image
webdados commented 1 year ago

I've used those and I wonder if I shouldn't be seeing the energy produced, sent to the grid and consumed on each interval, instead of always seeing the totals:

image image
themaninspain commented 1 year ago

This is a screenshot of my energy dashboard. BTW I'm using v1.1.2 of the integration

Screenshot 2022-08-02 at 18 28 24
webdados commented 1 year ago

I'm on 1.2.4, which is the latest.

Can you confirm those are the right entities?

webdados commented 1 year ago

@Emilv2 Isn't there any documentation on which entities to use on the energy dashboard? Also, we could use documentation on what each attribute represents. I think that's a must.

themaninspain commented 1 year ago

These are entities that give the readings used in the energy dashboard

Screenshot 2022-08-02 at 18 36 31
webdados commented 1 year ago

@themaninspain that's weird because I don't have exactly those then, as you can see from the above screenshot unless you renamed them (?)

themaninspain commented 1 year ago

It seems that I am now using a different integration! I had some problems after the last update and had to delete and reinstall and I'v e just realised that there are 2 Huawei Solar integrations available in HACS and I managed to install the other one. This is the reason why the entities are different

themaninspain commented 1 year ago

go to the HACS website and search for Huawei Solar, that is the integration I have installed

webdados commented 1 year ago

@themaninspain What a actual mess!

themaninspain commented 1 year ago

I hadn't realised that I'd installed a different integration until you mentioned the different entity names. When I reinstalled only the one integration showed up, it lives in a folder called "huawei_solar" and the integration name is the same. There's no immediate way of knowing that it is not Emil's integration. you can tell by clicking on the known issues link as it takes you to a different website. I think that they should at least have different names so that you know which one you are installing