Enphase Envoy with Energy Dashboard

If anyone is interested in why my costs stopped working as soon as 2021.9 upgrade completed, I made a guide on why it happened and how I fixed it.

Create one using the tool from here

Thank you for posting this! I used this to go update the sensor that I couldn’t see in the Energy config directly in the database to kWh. It showed correctly everywhere but in the database it was still NULL. As soon as I did that it showed up in Energy configuration. I had tried everything else and if I hadn’t seen your post I don’t think I would have ever gotten it fixed!

1 Like

Hi @sjhosier1,

Wow, that is amazing. Yeah I was stumped with your issue. Perhaps that is what @username11384 is suffering from too.

Hi @username11384

Please have a look at the content of the table statistics_meta in the SQLite Web add on and look for any unit_of_measurement that is either NULL or otherwise does not match what it should be.

mine does, indeed show NULL under sensor.grid_import_energy

You need a hand fixing it?
Execute this query.


update "statistics_meta" 
set unit_of_measurement = 'kWh’
where id = '25'

I just got a syntax error when executing that
image

UPDATE
Thanks, I got it working in the end by updating the SQLite DB!

1 Like

what was the issue with the syntax?
was it 25 instead of ‘25’

I just restarted HA, did the query again and then it worked

1 Like

I’ve just added another sensor to show me the total inclusive of daily service charge for the quarter based on when utility meter was last reset


  - sensor:
      - name: Quarterly Energy Total Cost
        device_class: monetary
        state_class: measurement
        unit_of_measurement: AUD
        state: >
          {{ (states('sensor.quarterly_energy_peak') | float * (0.541145 * 0.75) +
              states('sensor.quarterly_energy_shoulder') | float * (0.277145 * 0.75) +
              states('sensor.quarterly_energy_offpeak') | float * (0.177045 * 0.75) +
              states('sensor.quarterly_energy_export_buyback') | float * -0.095 +
              ((1.0439 * 0.75) * ((now() | as_timestamp | int - state_attr('sensor.quarterly_energy_offpeak','last_reset') | as_timestamp | int) / 86400 ) | int )) | round(2) }}

I then made another 2 sensors for bill forecast and average cost per day


  - sensor:
        name: Average Cost Per Day
        state_class: measurement
        unit_of_measurement: AUD
        device_class: monetary
        state: >
            {{ (states('sensor.quarterly_energy_total_cost') | float / ((now() | as_timestamp - state_attr('sensor.quarterly_energy_shoulder','last_reset') | as_timestamp) / 86400)) | round(2) }}
  - sensor:
        name: Bill Forecast
        state_class: measurement
        unit_of_measurement: AUD
        device_class: monetary
        state: >
            {{ states('sensor.average_cost_per_day') | float * ((state_attr('input_datetime.summer','timestamp') | int - state_attr('sensor.quarterly_energy_shoulder','last_reset') | as_timestamp | int) / 86400) | round(0) }}

I have raised an issue on github about the energy dashboard not showing data for 23:00 → 00:00
The last entry is for 11:00pm. The first entry in the next day is 1200am which is really the data that should be in the 23:00 > 00::slot

Are you sure? there’s 24 separate bars each day so there’s data for every hour?

Yes.Have you read my issue? I explained this in the issue.


Each hour is posted to the graph at the 12th minute past the hour on the hour. The last one is 11pm.

If you have a look at your first bar in the 24 bars its says 12am. If the first bar is 12am then that means its the previous hours data.
Have read. I had to explain my think in there, The graph looks back it cant see the future

Additionally
In my case the data is pretty much the same as my electricity usage between 23:00 → 00:00 and 00:00 → 01:00 is usually the same as we are in bed asleep but sometimes my solar HWS booster cuts in during these times and can have an impact.

Have you tried looking at the statistics database using SQLite web to get a better idea of what is going on behind the scenes?

Example.
This is my grid import energy sensor statistics


SELECT *
FROM "statistics"
Where metadata_id = 8
Order by created desc

All times are in utc by the way.

I don’t have that level of skill. I don’t know how to do that.

I think I can see what you are saying though.

Are saying that the data is stored correctly but reported incorrectly or vice versa?
I am monitoring the pH level of my pool water with the statistics card and it does the the same thing.


Your database should be no different to mine when it stores data, what does your data base store the period from 23:00 to 00:00 as? The energy level may be different but the date & times should be the same relatively I would think?

There are 24 bars, there are 24 hours shown.

The 11:00 is the hour the bar starts at and covers the period 11-12. Look at the period that ran at 21:12 in the raw data in the post above yours. The start of the period for that calculation is 20:00

The title should really say 11-12 for clarity.

Yes there are 24 bars.
The first bar says 12am the last bar is 11pm
The data is posted at 12 minutes past the hour every hour. This means it’s posting the last hours stats for that period.
I have watched the data post and that is exactly what it does. Refresh your browser about 12-13 minutes after the hour and you will see it update.
The machine cannot see into the future.

They are posted 12 minutes past the hour - for the hour prior. The statistics that run at 12.12am calculates and posts the usage for the period 11pm-12am.

The data labelled 7am posted covers the period 7-8am, not the period.