Are there any plans to incorporate the Enphase battery data into the sensor data.
{,“storage”:[{“type”:“acb”,“activeCount”:2,“readingTime”:1567424009,“wNow”:-474,“whNow”:1947,“state”:“charging”,“percentFull”:79}]}
Are there any plans to incorporate the Enphase battery data into the sensor data.
{,“storage”:[{“type”:“acb”,“activeCount”:2,“readingTime”:1567424009,“wNow”:-474,“whNow”:1947,“state”:“charging”,“percentFull”:79}]}
I’m interested in this as well!
I was able to get the battery information by creating a sensor through Nodered. If you use it, I can share what I did. I only have 1 battery though, but does not seem to be much difference
If anybod stumbles on this, I was able to do this with HA and REST Sensors.
I leave here the example of my configuration:
Secret envoy_json
points to http://ip_of_envoy/production.json
rest:
resource: !secret envoy_json
scan_interval: 30
sensor:
- name: Envoy Battery State
value_template: '{{ value_json.storage[0].state }}'
device_class: battery
- name: Envoy Battery Power Available
value_template: '{% if value_json.storage[0].wNow > 0 %} {{ value_json.storage[0].wNow }}
{% else %}
0
{% endif %}'
unit_of_measurement: 'W'
device_class: battery
- name: Envoy Battery Power Draw
value_template: '{{ value_json.storage[0].whNow }}'
unit_of_measurement: 'Wh'
device_class: battery
- name: Envoy Battery Level
value_template: '{{ value_json.storage[0].percentFull }}'
unit_of_measurement: '%'
device_class: battery
This implies you have 1 battery alone, and you can change it to match whatever need you have. Don’t hesitate to ping me if you want more info.
I’m adding support to the envoy_reader
API which would be exposed in Home Assistant but had a couple of questions at the end of this post:
I have a feeling this isnt right, but id love to work with you to fix it so it works with Homeassistant Energy.
This is mine when discharging.
|storage||
|0||
|type|acb|
|activeCount|2|
|readingTime|1633855938|
|wNow|537|
|whNow|620|
|state|discharging|
|percentFull|25|
When is charging, the state is set to charging, but the wNow value is negative.
Hello dear friend!
I’ve sold my house since my post, my HA is in a cardboard waiting for the new house to appear
I’ll have some difficulty for now to help you out.
Regards
Chris
FWIW I’ve only just started playing with Home Assistant and am playing with getting this working. I also am using Amber Energy (in Australia) who have a dynamic wholesale price and decent Home Assistant integration giving a feed of the price.
In my case I’m so far just using the automatic HA Envoy integration which seems to include an inverter sensor sensor.envoy_<ENVOY_SERIAL>_inverter_<INVERTER_SERIAL>
that goes to the battery. This sensor gives a negative value when the battery is charging, and a positive value when it is discharging.
I’m still fiddling with this but using the following posts I’m pretty sure I can setup sensors and integrations of that one sensor to give me everything needed for the battery;
When I get this working nicely I’ll post an update.
So I almost have this working.
I’ve added the following to my config.yaml;
template:
- sensor:
name: Battery Export Power
state_class: measurement
icon: mdi:battery-charging
unit_of_measurement: W
device_class: power
state: >
{{ [0, states('sensor.envoy_<ENVOY_SERIAL>_inverter_<INVERTER_SERIAL>') | int ] | max }}
- sensor:
name: Battery Import Power
state_class: measurement
icon: mdi:battery-charging
unit_of_measurement: W
device_class: power
state: >
{{ [0, 0 - states('sensor.envoy_<ENVOY_SERIAL>_inverter_<INVERTER_SERIAL>') | int ] | max }}
sensor:
- platform: integration
name: Battery Export Energy
source: sensor.battery_export_power
unit_prefix: k
unit_time: h
method: left
- platform: integration
name: Battery Import Energy
source: sensor.battery_import_power
unit_prefix: k
unit_time: h
method: left
This gives me Battery Import and Export power sensors that I can enter in the config for the “Energy Dashboard” (configured under Settings Dashboards). Note I use the default Envoy “Lifetime Energy (Production|Consumption)” sensors for the Electricity Grid settings so I don’t need to configure any custom sensors for that.
I say this is almost working because the data seems a bit choppy. The graphs of the Power sensors over time look mostly correct with a few questionable downward spikes when I know the battery was discharging, but they are a little disturbingly flat which suggests maybe gaps in the sampling. The Energy sensor integrations however look very steppy when they should look like pretty clean ramps for the constant change/discharge powers.
I suspect the envoy sampling is a bit unreliable, and the integration looks wrong… perhaps it’s the method: left
that is the problem.
It would be really nice if the envoy exported lifetime battery charged and discharged energy counters, the same as it does for the energy produced/imported. I suspect it probably has that somewhere but its not in the standard envoy integration yet. I’ll have a dig around and see what I can find.
Hey dbaarda (Donovan Baarda): Have you had any more success with this integration. I’m new to HA and am looking for ideas and guidance. What have you learned and what is working for you?
Hi! just got my Enphase IQ3T battery system installed. Now I’m trying to figure out which of the entities to use in the energy dashboard… From the Gateway entity I have the following entities:
Which one to use for “Energy going into the battery” and “Energy coming out of the battery”? The numbers when I check in the enlighten app does not makes sense with the figures in HA…
Did you ever figure this out? I am unable to select specific battery entities on the energy page and I think having two envoys due to the size of my system with battery is creating some bad math when I select the one that has the panels tied to the battery only.
Unfortunately not… I have kind of left it where it is at…
I’ve finally tackled this again and have had some limited success…
The battery I have is an ancient 1.2kWh Enphase with pretty limited controls. I also have an ancient 2kW solar system with a dead inverter. These were existing when the house was acquired, and a new 10kW solar getting installed in 2w. I’m planning to keep the tiny battery and squeeze what I can out of it.
I’m currently with Amber that does live wholesale pricing, so the $/kWh vary wildly anywhere from 10c/kWh to $17/kWh for rare transient price spikes during almost-outages, but typically varies between 10-35c/kWh during the day. Due to the high penetration of rooftop solar and very little industrial activity here, supply varies with the sun and demand peaks when people are at home. This means the typical price pattern during the day is;
Our typical power usage is driven by kids/cooking/showers etc which means it peaks 5pm-10pm and cannot be easily shifted. So our peak power usage is at peak price times.
So the simplest way to squeeze some value out of the battery right now without any working solar is to charge it off the grid when the price is low, and discharge it when the price is high. With a price difference of 35-10=25c/kWh and 1.2kWh storage that means I could save 25*1.2=30c/day with it. I’m not going to get rich off this, but the system is already there and fiddling with it is a learning experience.
Unfortunately this battery has very limited controls. The enlighten app doesn’t seem to give me any of the controls all the online docs suggest I should/could use, and the only way I’ve found to fiddle with it is using it’s web interface at http://envoy.local
and using the “installer login” (I forget where/how I found the username/passwd for this, but it’s online somewhere). The HomeAssistant Enphase integration does give me a bunch of useful sensors, but doesn’t seem to provide any way to control its behaviour.
Among the limited controls available in the web interface is I can set the battery with a “time of use” tariff with peak times when to discharge the battery, and enable “charge battery from the grid at night” with times to charge the battery. Unfortunately you can only set the charge times between 00:00 and 06:00, which is not when the price is lowest.
Fortunately, one of the other settings you can change is under “Overview; Date and Time” you can set the timezone. Fiddling with this, by changing the timezone from “Australia/Sydney” to “etc/GMT-0” I can trick the system into thinking the time is 00:00 when the real localtime is 10:00, so when I set the charge time to 01:00-06:00 it actually charges between 11:00-16:00. I also set my peak time to 07:00-12:00 so that it discharges between 17:00-22:00.
I was a little worried that messing with the timezone like this might confuse other things like the sensor reporting, but it appears not. Even the web interface continues to report times using the correct localtime, and only the battery charge/discharge times seem to be affected. I suspect this is because under the hood it does time right and uses timet/utc for everything, only converting to/from timezones when it needs to show/parse human-readable times. The web interface probably uses the browser’s timezone for that (so that different browsers in different timezones see everything in their local timezone), and only the stored schedules use the configured timezone.
The sensor reporting for the battery is also very minimal, with only a single inverter power meter (in W) for the battery that reports negative when it’s charging, and positive when discharging, and a “last_reported” timestamp. There are other sensors for the general system including current power production/consumption/net_consumption and lifetime/day/week energy production/consumption/net_production/net_consumption. The general power/energy sensors seem to update/report every minute, but the battery only updates it’s “last_reported” timestamp every 15m unless I happen to be logged in to the envoy.local web interface, when it suddenly updates every minute.
To get more useful info I’ve created a bunch of helpers that give me $/h for any power meters by multiplying the power by the current power price from the Amber integration. I then have helpers that integrate these to give me total accumulated $ for that interface. For the integration of the battery, with it’s crappy 15m update rate I’ve configured it to use trapezoidal integration with a “Poll Battery” automation to trigger updating every minute. This is not ideal as it effectively assumes each 15m interval was using the power reported at the beginning of that period, but fortunately the battery seems to normally be just outputting or charging a its fixed full power, or idling at a parasitic -4W, so it’s not too bad an assumption. I’m going to add more helpers/consoles etc to give me more useful current/recent power/energy views based on these.
What I don’t have is any way to make the battery respond dynamically to price spikes/dips. I suspect it might be possible to implement something that connects to the batteries web interface and dynamically messes with the timezone to trick it into thinking it’s now time to charge/discharge. However, I’m not sure it’s worth it.