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

Energy Monitor Home Assistant #37

Closed
Alfagek opened this issue Aug 4, 2021 · 58 comments
Closed

Energy Monitor Home Assistant #37

Alfagek opened this issue Aug 4, 2021 · 58 comments

Comments

@Alfagek
Copy link

Alfagek commented Aug 4, 2021

Hey Tim,

First a big thank you for making this. I’m using it almost a year and it’s working great.

But I have a question. Home Assistant has a new Energy monitor (2021.8). And I’m using your setup to get all things that I want in Home Assistant. But i don’t see my power return in this Energy monitor. I do have it as a entity.

Do you know how I can get this now to use it in the new Home Assistant Energy Monitor.
https://developers.home-assistant.io/docs/core/entity/sensor#long-term-statistics

Thanks in advance,
Marco

@kolossboss
Copy link

kolossboss commented Aug 4, 2021

Hi have the same question. All sensors are not shown in the energy configuration panel.

I think I have to include a last_reset property. But I'm not sure how to do this.

@kolossboss
Copy link

kolossboss commented Aug 4, 2021

I got I sensor working.
Go to HA --> Settings --> Customize --> search for a Sensor
Than add State_class with measurement
and last_reset to 1970-01-01T00:00:00+00:00

and it needs to be a sensor with kwh.

But I'm not sure with sensor is the correct one for grid_comsumtion and return to grid

Bildschirmfoto 2021-08-04 um 17 35 34

Edit:
I need to correct. Sorry. This sensor I used is from the goodwe custom integration. I think the template sensors from this Sems integration are not working...
And the Goodwe Custom integration doesn't deliver the right informations...

@Alfagek
Copy link
Author

Alfagek commented Aug 4, 2021

Thanks for trying @kolossboss . There should probably more people who have this “problem” we will wait (and Google in the mean time)

@TimSoethout
Copy link
Owner

TimSoethout commented Aug 4, 2021 via email

@kolossboss
Copy link

Hi,
I now created a template sensor with total_buy

- platform: template
  sensors:
    pv_buy_total:
      value_template: "{{ states.sensor.sems_portal.attributes.total_buy }}"
      unit_of_measurement: "kWh"
      friendly_name: "PV kWh gekauft Total"

An created a Utility Meter Sensor and cycle daily

utility_meter:
  energy_buy_daily_test:
    source: sensor.pv_buy_total
    cycle: daily

Added a few missing attributes to sensor.energy_buy_daily_test in the customize.yaml

sensor.energy_buy_daily_test:
  unit_of_measurement: kWh
  device_class: energy

Now the sensor is detected by the Energy Management configuration. But I'm not sure if its working, because I'm not receiving any data at this moment (house ins running on battery)

@Alfagek
Copy link
Author

Alfagek commented Aug 4, 2021

I did try to add the device class to my configuration.yaml (pv-etoday) but it’s not showing up in my energy monitor. 1003D053-3747-4D1B-BBD6-5BB71602B866

@kolossboss, maybe it’s not showing up yet, because it’s a daily sensor that you are creating.And what i know it will add the value on 00:00 daily

@kolossboss
Copy link

Hi my sensor is now working. The house Battery is empty and the Inverter is now buying from grid.
Bildschirmfoto 2021-08-04 um 20 31 24

They problem with your sensor is, its a template sensor, and template sensors are not supported. (quote from frenck from HA)
You need to create a utility_meter sensor as I wrote above

@spudje
Copy link

spudje commented Aug 4, 2021

I do hope as well changes will be made to this component to make it work with Hass Energy. I'd rather not create a utility meter, because in essence you'll have two utility meters. The one you create with the utility meter integration and the new Energy Management feature, which is a utility meter in itself.

@TimSoethout
Copy link
Owner

TimSoethout commented Aug 4, 2021

With a quick look at the documentation it seems we need to expose another sensor with state_class=measurement and some sane last_reset property. The sensor's unit_of_measurement should be kWh.
The Long-term Statistics should then be automatically captured and it should be available in the power dashboard.

All above requirements seem to be simulated the above approach, and maybe also by utility meter.

@matthewbayard
Copy link

Still cant see my PV production in Energy section. Anybody got it working?

@conormce
Copy link

conormce commented Aug 5, 2021

Just got my first values showing up on the Energy dashboard, followed @kolossboss method of adding a utility meter sensor with the source of daily production total and then after a restart I customised that sensors device_class and unit of measurement.
Notes:
It looks to me like the energy dashboard assumes it's source is a daily total measurement and it uses the difference between the two most recent values.
Also the energy dashboard aggregates to hourly values. It looks like you need a full hours data from the sensor before it turns up.

@TimSoethout
Copy link
Owner

I added an extra sensor for total kWh in a branch. It is released as 3.3.0-beta. (go to HACS > Integrations > Search SEMS > reinstall > show beta versions)

It does not yet show up for me in the dashboard, but I'll wait an hour and see what happens.

@tabnul
Copy link

tabnul commented Aug 5, 2021

3.3.0-beta

Great news, i was allready messing around with the sensors.. installing the beta -now- ;)

@tabnul
Copy link

tabnul commented Aug 5, 2021

sensor is existent now.
unable to choose it as input for solar panels. i would expect that that would be visible immediately (apart from the statistics)

image

@Alfagek
Copy link
Author

Alfagek commented Aug 5, 2021

I added an extra sensor for total kWh in a branch. It is released as 3.3.0-beta. (go to HACS > Integrations > Search SEMS > reinstall > show beta versions)

It does not yet show up for me in the dashboard, but I'll wait an hour and see what happens.

@TimSoethout
Also installed Beta version. But the sensor isn’t showing up in the list. I do see a extra entitie at the goodwe intergratie.

@conormce
Copy link

conormce commented Aug 5, 2021

Just tested and the same as @tabnul above, I was able to get it to show up by

  • going to Developer Tools->States
  • Select "sensor.inverter_home_energy"
  • Adding the following to state attributes
    "state_class: measurement
    last_reset: '2021-08-05T11:27:42.998420+00:00'

It'll take around one hour before I can tell if it matches the output from the utility meter option

@TimSoethout
Copy link
Owner

I'm having the same. It's not showing in the list of the power manager. I am hoping it will turn up after a while as @conormce was saying: "It looks like you need a full hours data from the sensor before it turns up."

Does anyone know how to check if statistics are working?

@TimSoethout
Copy link
Owner

TimSoethout commented Aug 5, 2021

The source contains:

    @property
    def last_reset(self):
        """Last reset property, used by Metered entities / Long Term Statistics"""
        return homeassistant.util.dt.utc_from_timestamp(0)

    @property
    def state_class(self):
        """used by Metered entities / Long Term Statistics"""
        return STATE_CLASS_MEASUREMENT

Apparently that is not enough to add those state attributes?

I need to make diner now and will check later tonight again.

EDIT: Probably have to add @property def extra_state_attributes(self): in the code.

@Alfagek
Copy link
Author

Alfagek commented Aug 5, 2021

I need to make diner now and will check later tonight again.

EDIT: Probably have to add @property def extra_state_attributes(self): in the code.

@TimSoethout will wait, thanks for now. Have a nice meal!

@TimSoethout
Copy link
Owner

https://github.com/TimSoethout/goodwe-sems-home-assistant/releases/tag/3.3.0-beta3

This seems to work and I can select it in the Energy config!

@Dehler2
Copy link

Dehler2 commented Aug 5, 2021

Yup, working here as well. Thanks @TimSoethout !

@TheGabeMan
Copy link

Working here as well. Just a question, should I add "Inverter GoodWe Energy" to both the "Solar Panel" section and the "Return to grid" section?

@TimSoethout
Copy link
Owner

TimSoethout commented Aug 5, 2021

@TheGabeMan , I guess only "Solar" because the kWh it shows is what is produced by the panels, before any consumption in my house. Only left over energy after usage in the house goes back to grid.
(At least for my setup.)

@TheGabeMan
Copy link

@TimSoethout ah and then the "Return to grid" should probably come from my P1 monitoring devcie.

@Alfagek
Copy link
Author

Alfagek commented Aug 5, 2021

@TimSoethout , awesome job. Thanks for the quick fix (y)

@tyz
Copy link

tyz commented Aug 5, 2021

Works for me as well. Tnx!! Now I only have to wait for the sun to see it in action.. 😀

@tabnul
Copy link

tabnul commented Aug 5, 2021

@TimSoethout ah and then the "Return to grid" should probably come from my P1 monitoring devcie.

exactly, p1 / meter does that part
tomorrow first day with full fletched dashboard. a big upgrade to my old DSMR Reader setup that did not show the actual solar output and prediction (basically not able to automate against it)

Confirmed that beta 3 fixes it indeed. great work!

@TheGabeMan
Copy link

It is now 7:48am down here and my GoodWe sensor (sensor.pv_outputpower) is showing 260W output, but the Energy dashboard remains empty for the solar panel section.

In the developer tools, the "sensor.inverter_goodwe" shows a value of 260 and the attribute outputpower: 260.

@tabnul
Copy link

tabnul commented Aug 6, 2021

It is now 7:48am down here and my GoodWe sensor (sensor.pv_outputpower) is showing 260W output, but the Energy dashboard remains empty for the solar panel section.

In the developer tools, the "sensor.inverter_goodwe" shows a value of 260 and the attribute outputpower: 260.

i think this is one of the major downsides of this dashboard. data lags behind massively. it calculates per hour.
i wonder whether you can also modify this dashboard, or use it as a template for a custom energy board.

@TimSoethout
Copy link
Owner

For me it starts to do something:
Screen Shot 2021-08-06 at 08 03 00
A small bullet from PV to Grid somehow, although it should go to the house I guess. I will see if it shows more when an hour is passed.

It could also be that kWh (with one digit after comma) is not precise enough. Then we'll have to use another metric. Or use the "today" value instead of the total ever kWh or something.

@JornMich
Copy link

JornMich commented Aug 6, 2021

For me it starts to do something:
Screen Shot 2021-08-06 at 08 03 00
A small bullet from PV to Grid somehow, although it should go to the house I guess. I will see if it shows more when an hour is passed.

It could also be that kWh (with one digit after comma) is not precise enough. Then we'll have to use another metric. Or use the "today" value instead of the total ever kWh or something.

It's still on 0 here, even though the entity itself seems to be updated. No bullets going from Solar to anywhere either.

@tabnul
Copy link

tabnul commented Aug 6, 2021

As it is raining cats and dogs in Maastricht, I think I have to wait more than an hour :-)

doesn't sound good for your solar panels ;)

For me it starts to do something:
Screen Shot 2021-08-06 at 08 03 00
A small bullet from PV to Grid somehow, although it should go to the house I guess. I will see if it shows more when an hour is passed.
It could also be that kWh (with one digit after comma) is not precise enough. Then we'll have to use another metric. Or use the "today" value instead of the total ever kWh or something.

It's still on 0 here, even though the entity itself seems to be updated. No bullets going from Solar to anywhere either.

it will take 1-2 hours to show data
you also need to configure the new energy sensory in the energy configuration (solar)

mine works;
image

@JornMich
Copy link

JornMich commented Aug 6, 2021

As it is raining cats and dogs in Maastricht, I think I have to wait more than an hour :-)

doesn't sound good for your solar panels ;)

For me it starts to do something:
Screen Shot 2021-08-06 at 08 03 00
A small bullet from PV to Grid somehow, although it should go to the house I guess. I will see if it shows more when an hour is passed.
It could also be that kWh (with one digit after comma) is not precise enough. Then we'll have to use another metric. Or use the "today" value instead of the total ever kWh or something.

It's still on 0 here, even though the entity itself seems to be updated. No bullets going from Solar to anywhere either.

it will take 1-2 hours to show data
you also need to configure the new energy sensory in the energy configuration (solar)

mine works;
image

And here I was, thinking I've been patient enough.. Indeed it is working now! Great stuff.

Edit: Maybe I'm reading the numbers wrong, but my panels are generating 0.632 kW right now, and the Energy tab is showing 0.2 kWh, like the screenshot above me. Shouldn't this number be more around 0.6kWh in my case?

TimSoethout added a commit that referenced this issue Aug 6, 2021
@TimSoethout
Copy link
Owner

TimSoethout commented Aug 6, 2021

I think the Energy tab shows the total kWh (kW times hour) produced on the current whole day. If you have 0.6 kW power for 1 hour, you produce 0.6 kWh energy in total.

I am glad it seems to work. I guess we can promote it to a non-beta version.

@TimSoethout
Copy link
Owner

TimSoethout commented Aug 6, 2021

Released as 3.3.0. :D
Thanks all for the input and testing.

@kevinvugts
Copy link

Released as 3.3.0. :D
Thanks all for the input and testing.

@TimSoethout it doesn't seem to working correctly yet. My SEMS is registering a different output / capacity than the energy dashboard is showing.

Any idea why so?

IMG_7428
IMG_7427

@TimSoethout
Copy link
Owner

TimSoethout commented Aug 6, 2021

@kevinvugts, I don't know. You mean that the 3.8 kWh from the energy overview differs from the PV Energy Day of 7.5 kWh?

Maybe it is related to the delay (1 or 2 hours) in statistics that was mentioned earlier?
We can check this by comparing the numbers again 2 hours after sun down.

Or it is related to this being the first day that the new version of the component is installed. That would clear up after running it for at least a full calendar day.

@conormce
Copy link

conormce commented Aug 6, 2021

@kevinvugts
There are two things that can create a difference between what is showed in the energy dashboard and what is returned from the API

  1. The energy dashboard is time delayed. It aggregates data by the hour and only shows it in the dashboard after that hour has completed + some time for the sensor to update. So far for me it updates ~10 minutes after the hour(
  2. The energy dashboard only starts it's calculations after you add the sensor to it. I think it also only does this for "good" hours, hours where it has measurements before, during and after

I would think a combination of the two could be affecting you, 1) the current hours production will be the highest since it is approaching peak sun so the inverters total will be adding up but the dashboard won't change until 10 past the hour. 2) all the solar energy generated before you added the sensor to the dashboard won't count

@HCookie
Copy link

HCookie commented Aug 9, 2021

After waiting over 2 hours, still nothing is showing up in the new energy dashboard,
One strange characteristic of the selected sensor, is that it is the total energy produced, total. No other sensor can even be selected.
Is this the right one to use, or am I missing something?
I also don't seem to get any other sensors from the panels, just current production and total.

@TimSoethout
Copy link
Owner

TimSoethout commented Aug 9, 2021 via email

@HCookie
Copy link

HCookie commented Aug 9, 2021

Hi,
Thanks for the assistance, and reminder to read the readme,
I'm new to homeassistant and even more so to custom integrations,
So I appreciate the help
To confirm, to use the new energy dashboard, eday or etotal is to be used?
If so, I must have missed something, for it is not showing up to be selected

@TimSoethout
Copy link
Owner

To confirm, to use the new energy dashboard, eday or etotal is to be used?

I guess the component uses etotal internally, but you have to select nothing yourself.

@conormce
Copy link

Definitely etotal.
eday can be reset if you adjust time on the inverter along with some other features. Also if you lose connection late in the evening which is common for me, eday resets at midnight so you lose whatever generation happened.
etotal gets around all these issues.

@TPochobradsky
Copy link

Hi guys,
could you help me with setting of Energy dashboard? I have use sensor "sensor.inverter_gw5k_et_energy" as a "Solar production", it works well. But there are not any next sensor for "Grid consumption" and "Return to grid". It seems that the negative part of "sensor.pv_excess' can be "Grid consumption" and positive part "Return to grid". Any idea how to split and display the sensor in Energy dashboard?
Thanks advance.
image

@TimSoethout
Copy link
Owner

Hi guys,
could you help me with setting of Energy dashboard? I have use sensor "sensor.inverter_gw5k_et_energy" as a "Solar production", it works well. But there are not any next sensor for "Grid consumption" and "Return to grid". It seems that the negative part of "sensor.pv_excess' can be "Grid consumption" and positive part "Return to grid". Any idea how to split and display the sensor in Energy dashboard?
Thanks advance.
image

Hi, I guess you need another component for this that tracks your power taken and returned from/to the grid. You fill them in separately on the first screen of the Energy Monitor. For me this data comes from a dsmr entity.
Maybe the buy/sell as discussed in #43 can also be used for this?

@TPochobradsky
Copy link

Hi,
I have added sensors Buy and Seller. In "HA --> Settings --> Customize --> search for a Sensor" added Measurement "1970-01-01T00:00:00+00:00" and "device_class: energy". Now I see these two new sensor in Energy dashboard. Thank you it is perfekt.
image
Tomorow I will see if all works well.
image

@dmshimself
Copy link

I thought that templated sensors (such as buy) were not currently supported by the energy component of HA. I hope to be wrong in a good way :-)

@TPochobradsky
Copy link

it looks like it works :-)
image

@dmshimself
Copy link

yes here too. The combination of utility meter and adding those extra atrributes seems to do the trick very nicely :-)

@TPochobradsky
Copy link

Hi, every midnight sensors show wrong status. Could you advise how to correct it?
image
image
image

@TimSoethout
Copy link
Owner

TimSoethout commented Aug 26, 2021 via email

@TPochobradsky
Copy link

I'm in the same time zone +1 Europe/Prague :-(

@TPochobradsky
Copy link

:-(

Od: "Joakim Sørensen" [email protected]
Komu: "home-assistant/core" [email protected]
Datum: 27.08.2021 10:42
Předmět: Re: [home-assistant/core] Energy dashboard - Midnight problem with resetting the previous day (#55315)

That is from a custom integration, we do not support that. Please raise an issue with the author of that integration.
Closed #55315.

@TPochobradsky
Copy link

I have little bit investigated data of sensors (Buy and Seller) and it seems that problem can be in real time of resetting. Last measurement I have at 23:45:50 (0,54 kWh) and first at 00:00:50 (0 kWh). Do you know how to move first measurement to midnight?

@TPochobradsky
Copy link

It seems that my problem is solved by changing of sensor state_class from "measurement" to "total_increasing". :-)

@TimSoethout
Copy link
Owner

Aha, good! The latest version 3.4.0 should also fix it then, since it has the same change.

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