home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.8k stars 30.06k forks source link

Solaredge integration doesn't report any usable statistics for new energy dashboard #54017

Closed ironicbadger closed 2 years ago

ironicbadger commented 3 years ago

The problem

The Solaredge integration does not provide any useful statistics for the new energy features in 2021.08 except for "lifetime energy".

It is my understanding that this is due to the integration not yet supporting these new features in HA as per this link, hence this issue.

The integration itself works as expected and pulls in the information from the Solaredge API perfectly as it stands today.

What is version of Home Assistant Core has the issue?

core-2021.8.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

solaredge

Link to integration documentation on our website

https://www.home-assistant.io/integrations/solaredge/

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

probot-home-assistant[bot] commented 3 years ago

solaredge documentation solaredge source (message by IssueLinks)

probot-home-assistant[bot] commented 3 years ago

Hey there @frenck, mind taking a look at this issue as it has been labeled with an integration (solaredge) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

ironicbadger commented 3 years ago

I noticed that you stated elsewhere that this integration is working (in the comments of the release post) but I only see lifetime energy and not any of the other statistics that are exposed to me via the SE monitoring API.

image

ironicbadger commented 3 years ago

Looks this might be useful...

https://community.home-assistant.io/t/energy-management-in-home-assistant/326854/114?u=ironicbadger

odgregg commented 3 years ago

Hardcoding the last_reset date to 1970 has made the two extra sensors work for now, but assume they'll have issues after midnight when they reset.

image

I have the data displaying elsewhere just fine, but would be nice to integrate into the new dashboard properly image

robi59italy commented 3 years ago

same situation for me I have HA updated to all last version (core,etc.) and Solaredge integration + Solaredge Modbus. I have even solaredge smartmeter + battery.

So I'm available for any test ... at this time I only have lifetime energy... no grid.. no battery... no home consumption

eavanvalkenburg commented 3 years ago

Same issue for me, also couldn't get it working with a utility meter!

odgregg commented 3 years ago

image So it's working fine for today with a hardcoded last_reset on the import/export sensors. So if we can get the last_reset attribute populated correctly for the daily data that the SolarEdge API outputs that should fix it.

In https://github.com/home-assistant/core/blob/dev/homeassistant/components/solaredge/coordinator.py it looks like may just need to duplicate the "date" attribute with the same value but called "last_reset" in line 218?

image

And add state_class=STATE_CLASS_MEASUREMENT to the Imported Power and Exported Power at lines 147 and 175 in https://github.com/home-assistant/core/blob/dev/homeassistant/components/solaredge/const.py

nelbs commented 3 years ago

Same issue for me, the only available sensor is sensor.solaredge_lifetime_energy but it does not show any values in the energy dashboard while the sensor itselfs works fine.

afbeelding afbeelding

odgregg commented 3 years ago

It does take 1-2 hours for values to start showing up. Seems to update at about 12 minutes past the hour.

nelbs commented 3 years ago

Ok but I've been waiting for 12 hours and the other sensors are already showing some data..

nelbs commented 3 years ago

I forgot to add the sensor to the recorder. Now it works

robi59italy commented 3 years ago

I forgot to add the sensor to the recorder. Now it works

could you explain more what you did?

nelbs commented 3 years ago

You can include or exclude entities which are recorded, see https://www.home-assistant.io/integrations/recorder/

robi59italy commented 3 years ago

You can include or exclude entities which are recorded, see https://www.home-assistant.io/integrations/recorder/

All my entities are recorded but I'm still missing them in the energy integration.... as many other Solaredge users....

ironicbadger commented 3 years ago

Seeing some weird inconsistencies. I set up a few integration sensors as a stop gap and they mostly seem to work but...

- platform: integration
  source: sensor.solaredge_current_power
  name: "Solar - Current Generation"
- platform: integration
  source: sensor.solaredge_grid_power
  name: "Solar - Grid Import"
- platform: integration
  source: sensor.solaredge_exported_power
  name: "Solar - Grid Export"
- platform: integration
  source: sensor.solaredge_power_consumption
  name: "Solar - House Consumption"
- platform: integration
  source: sensor.solaredge_selfconsumption_power
  name: "Solar - Self Consumption"

Here's the Solaredge dashboard read out:

Screen Shot 2021-08-05 at 13 13 55

And here's what HA is seeing:

Screen Shot 2021-08-05 at 13 11 59

And finally, here's how I have the energy page configured (though I am actively tweaking and changing this):

image

robi59italy commented 3 years ago

Seeing some weird inconsistencies. I set up a few integration sensors as a stop gap and they mostly seem to work but...


- platform: integration
  source: sensor.solaredge_current_power
  name: "Solar - Current Generation"
- platform: integration
  source: sensor.solaredge_grid_power
  name: "Solar - Grid Import"
- platform: integration
  source: sensor.solaredge_exported_power
  name: "Solar - Grid Export"
- platform: integration
  source: sensor.solaredge_power_consumption
  name: "Solar - House Consumption"
- platform: integration
  source: sensor.solaredge_selfconsumption_power
  name: "Solar - Self Consumption"

These are written in configuration.yaml, right? I will try too, mixing solaredge integration and modbus one....

ironicbadger commented 3 years ago

Yeah they are in configuration.yaml.

robi59italy commented 3 years ago

Yeah they are in configuration.yaml.

Sorry to bother you... on Energy configuration I have still the same entities... no way to get "Solar - House Consumption" as you have.. and I put yr suggestion on my configuration.yaml (and restarted 2 times)... maybe I should wait 2-3 hours....

odgregg commented 3 years ago

As expected, with the last_reset set to 1970, at midnight when the import/export counters reset it caused a "blip" image

odgregg commented 3 years ago

It also looks like you sometimes get a non zero value just after midnight from the SolarEdge API (sometimes it's close to zero, but sometimes it's about half the previous days total reading). So it might be a good idea since we're restricted to 15 minute polling, if that polling was aligned to perhaps start at 14 minutes after the hour? So first poll of the day would be at 12:14am, and last poll of the day at 11:59pm

image

image

robi59italy commented 3 years ago

no way to work with solaredge, even I had a problem at midnight... all HA crashed....

Dave-Casey commented 3 years ago

It also looks like you sometimes get a non zero value just after midnight from the SolarEdge API (sometimes it's close to zero, but sometimes it's about half the previous days total reading). So it might be a good idea since we're restricted to 15 minute polling, if that polling was aligned to perhaps start at 14 minutes after the hour? So first poll of the day would be at 12:14am, and last poll of the day at 11:59pm

image

image

would this work? last_reset: "{{ now().replace(hour=0, minute=14, second=0) }}"

odgregg commented 3 years ago

I think I have a solution with no code changes, standard SolarEdge and using Utility Meter. Need another couple of hours of usage to confirm that the export figure is displaying correctly. It's currently display that it's exported 0.1kWh but that's not showing on the graph yet (it displays in the animation and the table at the bottom). Will wait for the next hour, and hopefully a bit of sun although it's looking pretty gloomy out there at the moment.

odgregg commented 3 years ago

Okay. It's working correctly with two Utility Meter definitions replicating the import/export sensors from SolarEdge wihtout it appears the post midnight hickup

image

Added the following to configuration.yaml and then wait until both have updated at least once. You will have to wait until you export some power before the export one will get the correct properties to show up in the Energy configuration (it inherits the units, class etc from the sensor when a change in value happens).

image

purcell-lab commented 3 years ago

image

Great work.

Similar setup here so I'll check as well.

Why did you setup the meters as yearly, don't they reset daily on the solaredge side?

odgregg commented 3 years ago

Just to see how it would handle converting it from the daily data to yearly. There's no real need for them to be the same. I now have a daily figure in the existing sensors, and this will have yearly. Although now come to think of it, since our power bills are ever 3 months I should change it to quaterly I guess, although I'm not sure if the offset will work to get it on the right day which the is always the 2nd of the month with the next quarter starting on the 2nd of September.

Dave-Casey commented 3 years ago

This looks like a good work-around but it seems like this issue still needs the Solaredge integration modified to work "out of the box". What is the process to have someone modify the actual integration?

littlbee commented 3 years ago

@odgregg it's not a good idea to use the integration sensor as a workaround, the data will always be incorrect. Main reason is that you integrate based on sensors that are updated every 10 minutes (default API polling) on HA's side, while solaredge uses live data consistently to compute imported and exported Wh. You can see this if you use the solaredge app or website, data is updated in real-time as you turn on/off appliances around your home. So the sensors from the integration need to be adapted to report the last_reset value, based on the real exact time these sensors are reset on solaredge's side.

odgregg commented 3 years ago

I'm not using the integration sensor. I'm using the utility meter integration. I knew about the problems that would occur using the sum integration sensor so never tried it.

The utility meter integration is using the exact values from the Solar Edge import /export sensors which are correct.

littlbee commented 3 years ago

OK sorry my mistake! Before the integration added the imported and exported power I used to use the integration + utility together based on the W consumption reported every 10 min. I'll try your method until the solaredge integration is fixed.

skynet01 commented 3 years ago

Don't we need to first create the energy sensor before we create the utility_meter instead of using the power sensor?

So

- platform: integration        
  source: sensor.solaredge_current_power
  name: energy_solar_created
  unit_prefix: k
  round: 2
  unit_time: h
  method: left

then

utility_meter:
  solar_meter:
    source: sensor.energy_solar_created
    cycle: daily
littlbee commented 3 years ago

That's when you are going to get incorrect values. Tried this before and because your current power is only measured every 10 minutes (but can vary a lot in between) the results are not good.

odgregg commented 3 years ago

There is already a sensor for lifetime solar production which works just fine. You don't need a utility meter for that.

The utility meter is for the import /export of power to the grid.

Note : this is if your inverter has an import /export meter attached to it which ours does but may not be the case for everyone?

skynet01 commented 3 years ago

Yeah mine doesn't have import /export meter attached. My power input turns negative when it's exporting. Why would lifetime sensor work? I have a huge number in there, doesn't it need it for the current day?

odgregg commented 3 years ago

It tracks the changes in that value and uses that as it increases. It's what I've used and as you can see in the above screenshots it works just fine.

terminet85 commented 3 years ago

If not dev will fix it I'll do it, but now I'm busy. I'll share with you my workaround.

Edit: Fixed no-zero value around midnight. From 00:00 and 00:15 just report 0.00 value, after we use sensor.

Edi2: I've removed the code. Doesn't work. The problem is template value is updated when new value come from the pointed sensor. Anyway last_reset attribute is updated each 1 minute.

Nearby midnight may happens template sensor jump to 0, and last_reset attribute isn't reseted, and we got troubles.

I've just patched solardege plugin, in order to get last_reset value from solaredge API (so value and last_reset are updated together), i'm testing it now and I'll release it when is rock solid.

terminet85 commented 3 years ago

Sorry guys, devs don't want to merge my commit. I hope some others dev fulfill Reviewers' request. #54520

frenck commented 3 years ago

This is on my radar as well, but there is a lot of work to be done everywhere. The lifetime sensor has been adjusted for the 2021.8 release, which gives the total solar production as the base for the energy dashboard.

This integration in general still needs a lot of work.

tonysprenk commented 3 years ago

I’m still not able to even add the solaredge integration in the . I can read in the discussion above that it’s possible to add the integration but that not all sensors are showing up but for me when I try to add the solaredge integration into the energy dashboard it only says “No matching statistics found”. What am I doing wrong?

odgregg commented 3 years ago

Mines working perfectly since I created the utility meter entries.

Do you have the lifetime, import and export sensors?

tonysprenk commented 3 years ago

Mines working perfectly since I created the utility meter entries.

Do you have the lifetime, import and export sensors?

I have not created the utility meter entries as I don’t yet have a “slimmelezer”. Is this a requirement?

From those 3 I only have the lifetime sensor.

Thanks!

odgregg commented 3 years ago

I have not created the utility meter entries as I don’t yet have a “slimmelezer”. Is this a requirement?

From those 3 I only have the lifetime sensor.

Thanks!

Not sure what that is but think you might mean you don't have a smart meter connected to your inverter? I assumed it was part of the standard install of Solar Edge. If you don't have imported and exported sensors already, then you won't be able to use the utility meter method I used.

tonysprenk commented 3 years ago

Thanks for clarifying. No I don’t have a solar edge smart meter unfortunately. I have a smart meter from the utility company which needs a “slimmelezer” to be able to communicate with HA. I will wait for that to arrive. Thanks again!

odgregg commented 3 years ago

Thanks for clarifying. No I don’t have a solar edge smart meter unfortunately. I have a smart meter from the utility company which needs a “slimmelezer” to be able to communicate with HA. I will wait for that to arrive. Thanks again!

Yeah. We have a smart meter as well as the solar edge meter.

skynet01 commented 3 years ago

Sorry guys, devs don't wan't to merge my commit. I hope some others dev fulfill Reviewers' request. #54520

Anyway you can post your code so we can manually update our integration if your change is working properly? I have doubts this integration will be updated in the near future 😪

terminet85 commented 3 years ago

Yeah I think so too… this the last time I’ll share my fixes… they are so rude.

Anyway you can take the fix from my repo, enough to replace the newer file modified in your home-assistant component folder.

https://github.com/terminet85/core/tree/dev/homeassistant/components/solaredge

terminet85 commented 3 years ago

3EC97322-308F-47A2-AEAA-2BCFDC78C93A DC24E321-4AE6-4CB4-B8B5-F16B207D63C6 45B4183E-FF17-4BC8-BABA-0C06D8BB9BC0

littlbee commented 3 years ago

@terminet85, I don't see where the devs are rude. Home Assistant is a huge code base and changes have to be always properly validated. I'm working daily with developers in my job, I learned to trust their knowledge and skills. I understand you believe you have found some workaround, but as you state yourself, you are not a developer. Please keep cool! You are always welcome to share your code, as are people always free to take risks (or not) with non official repos.

Personnally I'll use @odgregg 's workaround, I trust it' s much safer and doesn't risk to break anything even with future upgrades of any base or integration component.

terminet85 commented 3 years ago

Are few new line of code. That a silly pretext on my point of view. That isn’t a workaround, this is the fix. Devs would like to update some new function within my commit… but isn’t my work, and could be done in a second step.

I’ve only just done what they have do with lifetime solar energy entity, as they stated.

The result is new feature released that couldn’t be used by users… cool.

But I wouldn’t make any polemics… that are my last words in this subject.