Enphase Envoy with Energy Dashboard

@mvana - I’ve written a python script that uses the /stream/meter and converts it to a mqtt feed for Home Assistant - I use all three phases and the script can isolate all values needed. Check it out here:

https://github.com/vk2him/Enphase-Envoy-mqtt-json/

1 Like

@vk2him Thanks - I reviewed (and played) with your code. Big thanks!
My issue is not in accessing the values but in making sense out of them.
As an example a Power Factor is a ratio between Real Power (p) and Apparent Power (s).
The stream contains all three properties(pf, p, s) (and for each of the phases and for “production”, “net-consumption” and “total-consumption”) but the math doesn’t agree.

This is probably a question to raise with Enphase - however they are not very responsive to this sort of enquiry - refer to this (very very) long thread https://support.enphase.com/s/question/0D53m00006ySLuRCAW/unimpressed-with-loss-of-local-api-connectivity-to-envoys

I am aware of this thread. And I assume we are using unsupported API so don’t expect more from Enphase than from the community. But will try. Thanks.

This work is incredible, thank you!. I’ve only installed HAAS for the fist time yesterday and already have my enphase coming in to the energy dashboard properly. I’m blown away by what is possible with HAAS.

Now, my time of use tariff structure also changes throughout the year - is it possible to include this in your above script somehow?

Edit: I found another post you’d linked to, where you’ve broken down in to seasonal tariffs. Will unpack that later.

Hi, Maybe try Using Home Assistant to calculate my energy bill using data from my Solar Inverter

1 Like

Thank you - I found this post of yours after replying above. I haven’t followed it through yet but it looks really good!

I’ve got 1 second mqtt data streaming in from my envoy now using your script add-on; it’s really impressive. This is the first time I’ve used mqtt so I’m learning a lot. For example, I named some sensors attributes that I decided not to use and I’ve got no idea how I can now remove those entities from my HA? Anyway…

I’m planning to incorporate the great work in post 1 and similar with the more frequent envoy data from mqtt, although I’m not sure of this is wasteful on resources. I might stick with 1 sec live electricity costs and leave the data I’m likely to refer to historically as 1 minute data.

Thanks @alexeiw123 , gld it’s useful for you. To remove an entity, navigate to Settings → Entities and search for the one you want to remove and click it - if it’s able to be deleted you’ll see delete highlighted in Red at the bottom left.

Logging/recording 1 second or 1 minute updates will use quite a lot of disk space in your database - do you “really” need to record costs per second/minute? Real-time data is really only useful in real-time. You can always display per second but only record in broader blocks of say 15 mins - this will save a lot of space and still give you meaningful reports and per second real-time views.

Rather than getting stuck with the entities that I couldn’t remove I just restored a backup from a half hour earlier and set it up as I wanted to. I wasn’t able to delete them though, all the sensors coming through from envoy via mqtt show this: Is it possible to assign them a unique ID or delete them through the broker somehow?

This entity ('sensor.mqtt_production') does not have a unique ID, therefore its settings cannot be managed from the UI.

Yes 1 second data is really only needed for seeing the real-time metrics such as instant cost and powers. I do have some automation set up with my EV that is charging from excess solar (above 10 kW export limit) so the 1 minute interval data is very useful for checking that it is behaving as intended. I don’t really need to be keeping this for more than a day or two though.

I really don’t have a clue where to start in setting this up - I’d be grateful if if you could explain that to me or point me to a resource! At the moment I’m using @del13r’s code to use the official enphase integration for the energy dashboard and tariffs. I’m not doing anything with the mqtt sensors that are updating every second yet but am considering the live cost view, 3 ph voltage plots and if I would benefit form a higher resolution energy plot.

I’m really new to HA, so I have no idea if that history view goes on forever, or if it’s got some FIFO logic. Very much in the learning phase.

@alexeiw123 - you can limit or exclude entities from being recorded in your database - this is the file that stores your data and it can grow very big with one second updates from the mqtt sensors - mine grew to over 2Gb before I took action. Following is an extract from my configuration.yaml -

Notes -
purge_keep_days limits how many days of history your database holds
auto_purge will automatically delete history older than purge_keep_days
the Exclude section won’t record any history for those entities (although they are still recorded in the Energy graph section)


recorder:
  purge_keep_days: 10
  auto_purge: true
  exclude:
    entities:
      - sensor.consumption_electricity_counter
      - sensor.consumption_electricity_gauge
      - sensor.exporting
      - sensor.exporting_mqtt
      - sensor.importing
      - sensor.importing_mqtt
      - sensor.mqtt_consumption
      - sensor.mqtt_production
      - sensor.solar_electricity_counter
      - sensor.solar_electricity_gauge
      - sensor.solarpower
      - sensor.solarpower_mqtt
      - sensor.import_delta
      - sensor.mqtt_voltage
      - sensor.mqtt_power_factor

Hope that helps?

3 Likes

Yes, this helps immensely - I’m learning a lot. It lead me to read Recorder - Home Assistant which also had a tonne of useful information. It may be worth adding this as an important consideration in your add-on documentation?

It’s very interesting that the energy dashboard can plot data that isn’t recorded in the database. It must be storing the sensor data as 1 hour averages somehow seperately. Quite handy.

Yes I’m planning to update the documentation shortly

1 Like

I spent some time sorting out my entities that need to be recorded and those that don’t.
I’m getting 1m data using the built in enphase integration and using that for the energy dashboard and historicals. I’m also using your add on to calculate 1s ‘real-time’ costs, but also to plot my 3 phase voltages. I’ve minised the entities I’m recording and keeping an eye on my database size. Thanks for your help.

is there any way to obtain hourly net balancing energy?

Has anyone figured out how to make it work with more recent software versions which I think require a JWT token that’s obtained through https://entrez.enphaseenergy.com ? (Which by the way only seem to last an hour though Enphase says they last 6 months)

That’s the only way I have of accessing the local API, AFAIK with a gateway running D7.0.85 (e269f2) (20 Oct, 2021 1:44 PM)

Example of where to get 6 month token.
Just need to replace SERIALNUMBER with your serial number https://enlighten.enphaseenergy.com/entrez-auth-token?serial_num=SERIALNUMBER

That’s awesome, I didn’t know of that. Sure enough, @del13r, 6 months token. Where would you use that in the Enlighten integration with HomeAssistant?

BTW, when I use it with curl, I still get a 401, any idea why?

curl -f -k -H 'Accept: application/json' -H 'Authorization: Bearer eyJr[...]3Xnsg' -X GET https://10.0.0.149/api/v1/production/inverters

Hi, sadly that is the limit of my knowledge with this as I am lucky enough to be on the old v5 firmware. There is a bit of a long running thread here regarding it https://support.enphase.com/s/question/0D53m00006ySLuRCAW/unimpressed-with-loss-of-local-api-connectivity-to-envoys

I’ve noticed recently that my Solar Forecast has a super high peak at the end of the day when using Solar Energy Corrected. I can fix this by using a damping factor of 0.25 in the Forecast.solar integration, but this makes the forecast shift a bit. I’m just being too nitpicky, but was wondering if other’s are seeing this.