mletenay / home-assistant-goodwe-inverter

Experimental version of Home Assistant integration for Goodwe solar inverters
https://discord.gg/TaXyWXT
MIT License
146 stars 41 forks source link

New Home Assistant Energy Management #38

Closed kolossboss closed 3 years ago

kolossboss commented 3 years ago

Hi,

the sensors provides by this Integration are not working with the new Energy Management in HA.

I think I have to include a last_reset property. But I'm not sure how to do this. https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics

Please help.

tinuva commented 3 years ago

They do, but you need to set up some of them yourself.

I have it working.

You need to create at least the following:

  1. template sensors for: (these are in W or kW)

    • energy_buy
    • energy_sell
    • solar_generate
  2. integration sensors that convert the above to kWh or Wh:

    • energy_buy
    • energy_sell
    • solar_generate
  3. utility meter

    • energy_buy_daily
    • energy_sell_daily
    • solar_generate_daily

These are in my config at https://github.com/tinuva/home-assistant-config/blob/master/packages/goodwe.yaml

Repeat the above for the individual devices you want to add. I have these at https://github.com/tinuva/home-assistant-config/blob/master/packages/power_sensors.yaml

tinuva commented 3 years ago

Since I already had these running for a while, I was able to already see data in the energy dashboard.

Screenshot 2021-08-04 at 18 30 15

Screenshot 2021-08-04 at 18 30 58

kolossboss commented 3 years ago

Hi,

wow thanks a lot this seams to work fine. Currently i don't have any data, I think because there is no sun and my house running with the battery. (I hope they will add battery support to.) I simply copy & past your configuration. Only issue I run into was: The sensor.energy_buy_daily was not shown in the Energy Management Configuration, because of 2 missing attributes

unit_of_measurement: kWh
device_class: energy

The other entities are working fine out of the box.

Thanks a lot!!

kolossboss commented 3 years ago

@tinuva one question. I'm a little confused..

I'm NOT creating the costs template sensors like sensor.energy_buy_daily_cost But I still have this sensor in my entity list and counting!? Is this sensor created by the "Energy Management" Integration? If yes, why do you called your template sensor exactly the same? And If yes, whats about sensor.energy_buy_daily. Is this also created by "Energy Management"??

Sorry maybe I'm dumb 🙃🤯

Edit: Ok this sensor sensor.energy_buy_daily_cost IS created by the "Energy" Integration. But this doesn't help with my headache

tinuva commented 3 years ago

The sensor.energy_buy_daily_cost I created before the Energy dashboard was released to track daily and monthly costs myself. It is based on a specific cost used for City of Cape Town in South Africa so it will be of no use for you.

That said, the energy management now allows you to enable cost tracking when you set up the energy buy.

See this screenshot:

Screenshot 2021-08-05 at 06 16 42

Maybe that created it? I am not sure. Mine is set to "do not track costs"

scrhall commented 3 years ago

Hi,

wow thanks a lot this seams to work fine. Currently i don't have any data, I think because there is no sun and my house running with the battery. (I hope they will add battery support to.) I simply copy & past your configuration. Only issue I run into was: The sensor.energy_buy_daily was not shown in the Energy Management Configuration, because of 2 missing attributes

unit_of_measurement: kWh
device_class: energy

The other entities are working fine out of the box.

Thanks a lot!!

Hi, I have the same problem with sensor.energy_buy_daily, where i had to add de properties in the config to solve the problem?

kolossboss commented 3 years ago

Hi, wow thanks a lot this seams to work fine. Currently i don't have any data, I think because there is no sun and my house running with the battery. (I hope they will add battery support to.) I simply copy & past your configuration. Only issue I run into was: The sensor.energy_buy_daily was not shown in the Energy Management Configuration, because of 2 missing attributes

unit_of_measurement: kWh
device_class: energy

The other entities are working fine out of the box. Thanks a lot!!

Hi, I have the same problem with sensor.energy_buy_daily, where i had to add de properties in the config to solve the problem?

Hi,

you can add this attributes in the customize.yaml or in Home Assistant UI --> Settings --> Customize

cibernox commented 3 years ago

I have a question: Why do would we need the _daily sensors? I've created only integral sum sensors the record energy consumption/production from the beginning of time (the moment I created such sensors) in kWh. Their value is an ever growing number.

The energy panel seems to be working fine, so I wondered if there's any reason I'm not aware of why we'd prefer a sensor that resets the count of consumed kWh every day.

coolinx commented 3 years ago

Just came here to say; Supporting the new HA Energy Management by this integration out of the box would be much appreciated.

mletenay commented 3 years ago

I've just uploaded change which adds out of the box support for the kWh entities reported by the inverter

coolinx commented 3 years ago

Thanks for putting effort in this request, and I'm sorry to have to report that it is not ok for me. I updated the integration and restarted. Then I still didn't see my goodwe inverter in the solar production energy pulldown menu. After restarting again I get this error on my configuration where I hadn't changed anything:

Logger: homeassistant.components.homeassistant Source: components/homeassistant/init.py:151 Integration: Home Assistant Core Integration (documentation, issues) First occurred: 13:35:05 (1 occurrences) Last logged: 13:35:05

The system cannot restart because the configuration is not valid: Platform error sensor.goodwe - cannot import name 'STATE_CLASS_TOTAL_INCREASING' from 'homeassistant.components.sensor' (/usr/src/homeassistant/homeassistant/components/sensor/init.py)

djares01 commented 3 years ago

I have the same error, also I had the previous error that my EM inverter wasn't detected and I supposed that is solved now, I had to return to previous version to solve it by now.

1ntroduc3 commented 3 years ago

I also have this error.

mletenay commented 3 years ago

Ouch, I was coding it against the master branch, but that constant is not in any released version yet. I need to revert that, damn !

coolinx commented 3 years ago

I can confirm the integration now again works as before.

mletenay commented 3 years ago

OK, I've just uploaded 2021.8.0 compatible implementation of kWh energy sensors for the Energy dashboard. Happy testing ...

coolinx commented 3 years ago

I updated and restarted (had to restart twice). I actually don't see any change. Still the Goodwe inverter doesn't show up in the solar production energy pulldown menu. When checking the sensor entity I can't see the unit_of_measurement or device_class. I understood that these and maybe also last_reset were a prerequisite for the entity to show up in the energy config page. Not sure how to debug this further to help you with troubleshooting this.

mletenay commented 3 years ago

Hmm, weird since I see kWh sensors it works for me and I see this: image Although the number seem to be a bit off and last_reset was not reset ... What inverter do you have ?

coolinx commented 3 years ago

I have GW4200D-NS I don't have that entity sensor.goodwe_e_day. I have e_day as attribute of entity sensor.goodwe_inverter, as well as e_total and h_total, and these attributes do seem to have the correct values.

mletenay commented 3 years ago

e_total should be fine, it seems to have the same precision (0.1 kWh) as the e_day and does not have problems with that last_reset property (can/should be 0). (The last_property is anyway removed in latest HA code and will be replaced by that STATE_CLASS_TOTAL_INCREASING state_class). Anyway, as long as you have e_total property, that one should have the device_class=energy and last_reset=epoch0 and as such it should be exposed to energy dashboard. See: image

coolinx commented 3 years ago

I think the problem is that I only have entity sensor.goodwe_inverter, no other goodwe entities. Both e_day, e_total and many other values are attributes of this entity sensor.goodwe_inverter. The solar production energy pulldown menu shows only entities, but not the attributes of entities. So for this to work out of the box I think we would need e_day and e_total (not sure if there are any other interesting values) as separate entities with device_class=energy, unit_of_measurement=kWh, etc.

mletenay commented 3 years ago

That is indeed the problem. Can we move this discussion to discord https://discord.gg/CAZVTDsB so we don't pollute this ticket too much ?

kolossboss commented 3 years ago

Did anyone get battery to work?

I got this sensor sensor.goodwe_pbattery1 But I outputs "+" and "-" I not sure how to create 2 sensors for "going to battery" and "coming from battery" and both positiv.

Any tips?

mletenay commented 3 years ago

For ET/EH inverters there are these new sensors e_bat_charge_total and similar. For ES/EM those values are not provided by inverters. You have to create template sensors filtering + and - values, see readme section https://github.com/mletenay/home-assistant-goodwe-inverter#cumulative-energy-values for example. But they precision will be obviously limited by the frequency of polling ...

mletenay commented 3 years ago

I believe all the stuff necessary for the energy dashboard is there now, so I'm closing the ticket. Some brief description was added to the readme file: https://github.com/mletenay/home-assistant-goodwe-inverter#home-assistant-energy-dashboard