Enphase Envoy - D7 firmware with JWT - A Different Approach

Thanks. Yes I have. It seems like it might be challenging for me to work out exactly what is what as I have a legacy system also integrated (somewhow by the installer) so I see this:

[
    {
        "eid": 704643328,
        "timestamp": 1694505436,
        "actEnergyDlvd": 7989.564,
        "actEnergyRcvd": 2.219,
        "apparentEnergy": 9051.251,
        "reactEnergyLagg": 275.625,
        "reactEnergyLead": 705.749,
        "instantaneousDemand": 6.532,
        "activePower": 6.532,
        "apparentPower": 281.179,
        "reactivePower": 272.244,
        "pwrFactor": 0.020,
        "voltage": 704.724,
        "current": 1.200,
        "freq": 50.125,
        "channels": [
            {
                "eid": 1778385169,
                "timestamp": 1694505436,
                "actEnergyDlvd": 3705.621,
                "actEnergyRcvd": 1.233,
                "apparentEnergy": 4292.490,
                "reactEnergyLagg": 41.186,
                "reactEnergyLead": 511.417,
                "instantaneousDemand": 4.617,
                "activePower": 4.617,
                "apparentPower": 140.568,
                "reactivePower": 136.269,
                "pwrFactor": 0.040,
                "voltage": 232.250,
                "current": 0.605,
                "freq": 50.125
            },
            {
                "eid": 1778385170,
                "timestamp": 1694505436,
                "actEnergyDlvd": 2933.610,
                "actEnergyRcvd": 0.009,
                "apparentEnergy": 3030.153,
                "reactEnergyLagg": 212.147,
                "reactEnergyLead": 71.271,
                "instantaneousDemand": 1.015,
                "activePower": 1.015,
                "apparentPower": 67.843,
                "reactivePower": 65.011,
                "pwrFactor": 0.000,
                "voltage": 235.256,
                "current": 0.288,
                "freq": 50.125
            },
            {
                "eid": 1778385171,
                "timestamp": 1694505436,
                "actEnergyDlvd": 1350.333,
                "actEnergyRcvd": 0.977,
                "apparentEnergy": 1728.608,
                "reactEnergyLagg": 22.293,
                "reactEnergyLead": 123.060,
                "instantaneousDemand": 0.900,
                "activePower": 0.900,
                "apparentPower": 72.768,
                "reactivePower": 70.964,
                "pwrFactor": 0.000,
                "voltage": 237.219,
                "current": 0.306,
                "freq": 50.125
            }
        ]
    },
    {
        "eid": 704643584,
        "timestamp": 1694505436,
        "actEnergyDlvd": 1033.142,
        "actEnergyRcvd": 6473.965,
        "apparentEnergy": 8830.396,
        "reactEnergyLagg": 297.656,
        "reactEnergyLead": 1519.162,
        "instantaneousDemand": 888.667,
        "activePower": 888.667,
        "apparentPower": 1221.254,
        "reactivePower": -538.591,
        "pwrFactor": 0.722,
        "voltage": 705.145,
        "current": 5.188,
        "freq": 50.125,
        "channels": [
            {
                "eid": 1778385425,
                "timestamp": 1694505436,
                "actEnergyDlvd": 106.408,
                "actEnergyRcvd": 3526.892,
                "apparentEnergy": 4161.063,
                "reactEnergyLagg": 231.862,
                "reactEnergyLead": 317.159,
                "instantaneousDemand": 161.852,
                "activePower": 161.852,
                "apparentPower": 328.418,
                "reactivePower": -265.626,
                "pwrFactor": 0.483,
                "voltage": 232.485,
                "current": 1.412,
                "freq": 50.125
            },
            {
                "eid": 1778385426,
                "timestamp": 1694505436,
                "actEnergyDlvd": 206.388,
                "actEnergyRcvd": 2322.949,
                "apparentEnergy": 2814.684,
                "reactEnergyLagg": 62.558,
                "reactEnergyLead": 383.085,
                "instantaneousDemand": 174.303,
                "activePower": 174.303,
                "apparentPower": 260.982,
                "reactivePower": -124.439,
                "pwrFactor": 0.667,
                "voltage": 235.268,
                "current": 1.109,
                "freq": 50.125
            },
            {
                "eid": 1778385427,
                "timestamp": 1694505436,
                "actEnergyDlvd": 720.347,
                "actEnergyRcvd": 624.124,
                "apparentEnergy": 1854.650,
                "reactEnergyLagg": 3.236,
                "reactEnergyLead": 818.918,
                "instantaneousDemand": 552.512,
                "activePower": 552.512,
                "apparentPower": 631.853,
                "reactivePower": -148.526,
                "pwrFactor": 0.868,
                "voltage": 237.391,
                "current": 2.667,
                "freq": 50.125
            }
        ]
    }
]

Ok, great.
What information did you want HA to record per phase?

For each channel/phase, you would setup the rest sensor like this for example:

Production CT Phase 1:
[0].channels[0].activePower = Production in Watts = 4.617 W
[0].channels[0].current = current in Amps = 0.605 A
[0].channels[0].freq = frequency in Hertz = 50.125 Hz
[0].channels[0].voltage = voltage in Volts = 232.250 V

Production CT Phase 2:
[0].channels[1].activePower = Production in Watts = 1.015 W
[0].channels[1].current = current in Amps = 0.288 A
[0].channels[1].freq = frequency in Hertz = 50.125 Hz
[0].channels[1].voltage = voltage in Volts = 235.256 V

Production CT Phase 3:
[0].channels[2].activePower = Production in Watts = 0.900 W
[0].channels[2].current = current in Amps = 0.306 A
[0].channels[2].freq = frequency in Hertz = 50.125 Hz
[0].channels[2].voltage = voltage in Volts = 237.219 V

Net/Total Consumption CT Phase 1:
[1].channels[0].activePower = Net/Total Consumption in Watts = 161.852 W
[1].channels[0].current = current in Amps = 1.412 A
[1].channels[0].freq = frequency in Hertz = 50.125 Hz
[1].channels[0].voltage = voltage in Volts = 232.485

Net/Total Consumption CT Phase 2:
[1].channels[1].activePower = Net/Total Consumption in Watts = 174.303 W
[1].channels[1].current = current in Amps = 1.109 A
[1].channels[1].freq = frequency in Hertz = 50.125 Hz
[1].channels[1].voltage = voltage in Volts = 235.269 V

Net/Total Consumption CT Phase 3:
[1].channels[2].activePower = Net/Total Consumption in Watts = 552.512 W
[1].channels[2].current = current in Amps = 2.667 A
[1].channels[2].freq = frequency in Hertz = 50.125 Hz
[1].channels[2].voltage = voltage in Volts = 237.391

1 Like

hi @del13r

question for you if you knowā€¦ in my Energy dashboard i am only getting the options to do Monthly Import & Monthly Export from the utility_meter integration. Do you by chance know why the Daily options are not selectable?

From configuration.yaml:

utility_meter:
  daily_energy:
    source: sensor.energy_import
    name: Daily Import
    cycle: daily
  daily_energy_export:
    source: sensor.energy_export
    name: Daily Export
    cycle: daily
  monthly_energy:
    source: sensor.energy_import
    name: Monthly Import
    cycle: monthly
  monthly_energy_export:
    source: sensor.energy_export
    name: Monthly Export
    cycle: monthly

Here is the Reimann sensors:

  - platform: integration
    name: Energy Export
    source: sensor.power_export
    unit_prefix: k
    unit_time: h
    method: left

  - platform: integration
    name: Energy Import
    source: sensor.power_import
    unit_prefix: k
    unit_time: h
    method: left

And here are the rest sensors pulling data from Enphase:

rest:
  - headers:
      Authorization: !secret enphase_api
    verify_ssl: False
    scan_interval: 15
    resource: https://192.168.1.207/ivp/meters/readings
    sensor:
      - name: "Power Production"
        value_template: >
          {% set value = value_json[0].activePower | int(0) %}
          {% if value  <= 5 %}
            0
          {% elif is_state('sun.sun','below_horizon') %}
            0
          {% else %}
            {{ value }}
          {% endif %}
        device_class: power
        unit_of_measurement: W
        state_class: measurement
        icon: mdi:solar-power-variant

      - name: "Power Consumption"
        value_template: >
          {% set newValue = value_json[1].activePower | int(0) %}
          {% set lastValue = states('sensor.power_consumption') | float(0) %}
          {% if newValue == 0 %}
            {{ lastValue }}
          {% else %}
            {{ newValue }}
          {% endif %}
        state_class: measurement
        device_class: power
        unit_of_measurement: W
        icon: mdi:transmission-tower
        
      - name: "Energy Production"
        value_template: >
          {% set newValue = ((value_json[0].actEnergyDlvd - 6300) / 1000 | float(0)) | round(2) %}
          {% set lastValue = states('sensor.energy_production') | float(0) %}
          {% if newValue <= lastValue %}
            {{ lastValue }}
          {% else %}
            {{ newValue }}
          {% endif %}
        device_class: energy
        unit_of_measurement: kWh
        state_class: total_increasing
        icon: mdi:solar-power-variant

      - name: "Energy Consumption"
        value_template: >
          {% set newValue = ((value_json[1].actEnergyDlvd - 600) / 1000 | float(0)) | round(2) %}
          {% set lastValue = states('sensor.energy_consumption') | float(0) %}
          {% if newValue <= lastValue %}
            {{ lastValue }}
          {% else %}
            {{ newValue }}
          {% endif %}
        device_class: energy
        unit_of_measurement: kWh
        state_class: total_increasing
        icon: mdi:home-lightning-bolt

And here is my Energy Dashboard selector options:

Iā€™ve been struggling with this for a few days but had no luck!

Thank you!! :smiley:

developer tools will give you more insight into why you cant see something in energy dashboard

here is my source energy sensor getting data via the rest sensor

rest:
  - headers:
      Authorization: !secret enphase_api
    verify_ssl: False
    scan_interval: 15
    resource: https://192.168.1.114/ivp/meters/readings    
    sensor:

      - name: "Energy Import"
        value_template: "{{ (value_json[1].actEnergyDlvd / 1000 | float(0)) | round(2) }}"
        device_class: energy
        unit_of_measurement: kWh
        state_class: total_increasing
        icon: mdi:transmission-tower

and here is how that same sensor looks in dev tools / states

here is an example where I have split my utility meter into different tariffs but essentially still the same purpose as what you are trying to do.


please go to dev tools / states and compare what attributes you donā€™t have for the daily sensor that isnt selectable.

ok, just tracing back, it would appear that your utility meter is using the sensor.energy_import as a source, as is mine too.

where your setup becomes different is that this source: sensor.energy_import is an integration sensor.

what i dont see is where your sensor.power_import is defined.

what i dont understand is that you have setup the rest sensors but are instead choosing to use the integration sensor as as source for your utility meter?

The only possible reason why you would use integration sensors is if your ct clamp is setup as
total-consumption = Load only

Can you please tell me what your measurement type is or show me how sensor.power_import is defined?

I have the same Enphase setup/configuration as @jon102034050 where the json output does not match yours.

My other sensors are templates based on the math from the available data:

  - sensor:
        name: Power Net
        state_class: measurement
        icon: mdi:home-lightning-bolt
        unit_of_measurement: W
        device_class: power
        state: >
          {{ states('sensor.power_production') | int(0) - states('sensor.power_consumption') | int(0) }}
          
  - sensor:
        name: Power Export
        state_class: measurement
        icon: mdi:transmission-tower-export
        unit_of_measurement: W
        device_class: power
        state: >
          {{ [0, states('sensor.power_production') | int(0) - states('sensor.power_consumption') | int(0) ] | max }}
          
  - sensor:
        name: Power Import
        state_class: measurement
        icon: mdi:transmission-tower-import
        unit_of_measurement: W
        device_class: power
        state: >
          {{ [0, states('sensor.power_consumption') | int(0) - states('sensor.power_production') | int(0) ] | max }}

  - sensor:
        name: Energy Net
        state_class: total
        icon: mdi:transmission-tower
        unit_of_measurement: kWh
        device_class: energy
        state: >
          {% set newValue = (states('sensor.energy_production') | float(0) - states('sensor.energy_consumption') | float(0)) | round(2) %}
          {% set lastValue = states('sensor.energy_net') | float(0) %}
          {% if newValue == 0 %}
            {{ lastValue }}
          {% else %}
            {{ newValue }}
          {% endif %}

My utility_meter sensors as seen from Dev Tools:

And lastly, my Enphase measurement type:

[
    {
        "eid": 12345,
        "state": "enabled",
        "measurementType": "production",
        "phaseMode": "split",
        "phaseCount": 2,
        "meteringStatus": "normal",
        "statusFlags": []
    },
    {
        "eid": 12345,
        "state": "enabled",
        "measurementType": "total-consumption",
        "phaseMode": "split",
        "phaseCount": 2,
        "meteringStatus": "normal",
        "statusFlags": []
    }
]

Regarding the utility_meter Daily sensor difference, the only thing I see that diverges is that I donā€™t have a tariff setā€¦ could that matter?

Maybe Iā€™m interpreting the utility_meter incorrectly, but I thought we needed to have Daily sensors for the Energy Dashbaord to operate correctly. If thatā€™s not the case, Iā€™ll get rid of the utility_meter sensors and then point the Energy Dashboard right at the Enphase output sensors.

Edit:
As a test, I set my Energy Dashboard grid sensors to the Enphase rest sensors. Ill monitor it for the next few days.

In your original post, you were trying to search for daily import sensor but you have only provided screenshot of the attributes for your export sensors.

I compared your daily export sensor screenshot with mine and they are the same, so you should be able to choose it, unless you are already using it.

Example of mine already in use
image

Example of it not being available in the list due to it already being in use.
image

Wow this is so bizarre! I can now select Daily Export but cannot select Daily Import. When i look at the Daily Export sensor I see this:


However when I look at the Daily Import sensor I get no statistics found:

Iā€™m wondering if something is messed up with just that sensor now. Also Iā€™m wondering if these sensors need to run for over a day to populate or something before selection. The utility_meter docs havenā€™t turned up anything so farā€¦

I appreciate your help digging into this!!

Ok, this is very interesting! Thereā€™s a warning in the log for that sensor:

Logger: homeassistant.components.sensor.recorder
Source: components/sensor/recorder.py:405
Integration: Sensor (documentation, issues)
First occurred: September 27, 2023 at 1:30:10 PM (1 occurrences)
Last logged: September 27, 2023 at 1:30:10 PM
`
The unit of sensor.daily_import (kWh) cannot be converted to the unit of previously compiled statistics (None). Generation of long term statistics will be suppressed unless the unit changes back to None or a compatible unit. Go to Link to Developer tools: statistics ā€“ My Home Assistant to fix this

Went into the Statistics tab and fixed the issue and now I was able to select Daily Import!

Woohoo!

Thanks again!

1 Like

@del13r Just has a new system installed with firmware D8.2.62 (038ae8) Software Build Date 01 Sep, 2023 9:55 PM
The ā€œmissingā€ errors under Empower and Database Size are due to a bug Enphase has yet to address but the battery info can still be pulled.

I have 5P batteries installed and value_json[2] is populated.
For those who may have different configurations, the eid mappings are shown in /ivp/meters

[
    {
        "eid": 704643328,
        "state": "enabled",
        "measurementType": "production",
        "phaseMode": "split",
        "phaseCount": 2,
        "meteringStatus": "normal",
        "statusFlags": []
    },
    {
        "eid": 704643584,
        "state": "enabled",
        "measurementType": "net-consumption",
        "phaseMode": "split",
        "phaseCount": 2,
        "meteringStatus": "normal",
        "statusFlags": []
    },
    {
        "eid": 704643840,
        "state": "enabled",
        "measurementType": "storage",
        "phaseMode": "split",
        "phaseCount": 2,
        "meteringStatus": "normal",
        "statusFlags": []
    }
]

Here is /ivp/meters/readings with battery info populated in eid 704643840

[
    {
        "eid": 704643328,
        "timestamp": 1700857449,
        "actEnergyDlvd": 82736.068,
        "actEnergyRcvd": 2.614,
        "apparentEnergy": 97470.318,
        "reactEnergyLagg": 4210.015,
        "reactEnergyLead": 15671.590,
        "instantaneousDemand": 2164.922,
        "activePower": 2164.922,
        "apparentPower": 2229.759,
        "reactivePower": -284.589,
        "pwrFactor": 0.975,
        "voltage": 239.963,
        "current": 18.682,
        "freq": 60.000,
        "channels": [
            {
                "eid": 1778385169,
                "timestamp": 1700857449,
                "actEnergyDlvd": 41272.982,
                "actEnergyRcvd": 1.313,
                "apparentEnergy": 46525.753,
                "reactEnergyLagg": 2106.283,
                "reactEnergyLead": 7826.206,
                "instantaneousDemand": 1080.397,
                "activePower": 1080.397,
                "apparentPower": 1112.873,
                "reactivePower": -142.410,
                "pwrFactor": 0.975,
                "voltage": 119.826,
                "current": 9.336,
                "freq": 60.000
            },
            {
                "eid": 1778385170,
                "timestamp": 1700857449,
                "actEnergyDlvd": 41463.085,
                "actEnergyRcvd": 1.300,
                "apparentEnergy": 50944.564,
                "reactEnergyLagg": 2103.732,
                "reactEnergyLead": 7845.384,
                "instantaneousDemand": 1084.525,
                "activePower": 1084.525,
                "apparentPower": 1116.886,
                "reactivePower": -142.180,
                "pwrFactor": 0.976,
                "voltage": 120.137,
                "current": 9.346,
                "freq": 60.000
            },
            {
                "eid": 1778385171,
                "timestamp": 1700857449,
                "actEnergyDlvd": 0.000,
                "actEnergyRcvd": 0.000,
                "apparentEnergy": 0.000,
                "reactEnergyLagg": 0.000,
                "reactEnergyLead": 0.000,
                "instantaneousDemand": 0.000,
                "activePower": 0.000,
                "apparentPower": 0.000,
                "reactivePower": 0.000,
                "pwrFactor": 0.000,
                "voltage": 0.000,
                "current": 0.000,
                "freq": 60.000
            }
        ]
    },
    {
        "eid": 704643584,
        "timestamp": 1700857449,
        "actEnergyDlvd": 559233.892,
        "actEnergyRcvd": 2176.785,
        "apparentEnergy": 794781.171,
        "reactEnergyLagg": 1485.158,
        "reactEnergyLead": 417759.175,
        "instantaneousDemand": -0.000,
        "activePower": -0.000,
        "apparentPower": 36.944,
        "reactivePower": -0.000,
        "pwrFactor": 0.000,
        "voltage": 239.855,
        "current": 0.309,
        "freq": 60.000,
        "channels": [
            {
                "eid": 1778385425,
                "timestamp": 1700857449,
                "actEnergyDlvd": 367925.502,
                "actEnergyRcvd": 12.311,
                "apparentEnergy": 458851.816,
                "reactEnergyLagg": 979.297,
                "reactEnergyLead": 197700.103,
                "instantaneousDemand": -0.000,
                "activePower": -0.000,
                "apparentPower": 20.260,
                "reactivePower": -0.000,
                "pwrFactor": 0.000,
                "voltage": 119.753,
                "current": 0.169,
                "freq": 60.000
            },
            {
                "eid": 1778385426,
                "timestamp": 1700857449,
                "actEnergyDlvd": 191308.390,
                "actEnergyRcvd": 2164.474,
                "apparentEnergy": 335929.355,
                "reactEnergyLagg": 505.861,
                "reactEnergyLead": 220059.072,
                "instantaneousDemand": -0.000,
                "activePower": -0.000,
                "apparentPower": 16.683,
                "reactivePower": 0.000,
                "pwrFactor": 0.000,
                "voltage": 120.102,
                "current": 0.139,
                "freq": 60.000
            },
            {
                "eid": 1778385427,
                "timestamp": 1700857449,
                "actEnergyDlvd": 25812.023,
                "actEnergyRcvd": 50059.863,
                "apparentEnergy": 263354.661,
                "reactEnergyLagg": 189461.385,
                "reactEnergyLead": 2800.824,
                "instantaneousDemand": -83.678,
                "activePower": -83.678,
                "apparentPower": 162.507,
                "reactivePower": 49.642,
                "pwrFactor": -0.455,
                "voltage": 120.141,
                "current": 1.359,
                "freq": 60.000
            }
        ]
    },
    {
        "eid": 704643840,
        "timestamp": 1700857449,
        "actEnergyDlvd": 51534.401,
        "actEnergyRcvd": 99971.059,
        "apparentEnergy": 525855.490,
        "reactEnergyLagg": 378311.188,
        "reactEnergyLead": 5592.162,
        "instantaneousDemand": -405.640,
        "activePower": -405.640,
        "apparentPower": 232.107,
        "reactivePower": 116.772,
        "pwrFactor": -0.170,
        "voltage": 239.894,
        "current": 1.528,
        "freq": 60.000,
        "channels": [
            {
                "eid": 1778385681,
                "timestamp": 1700857449,
                "actEnergyDlvd": 25722.378,
                "actEnergyRcvd": 49911.197,
                "apparentEnergy": 262500.828,
                "reactEnergyLagg": 188849.803,
                "reactEnergyLead": 2791.338,
                "instantaneousDemand": -321.962,
                "activePower": -321.962,
                "apparentPower": 69.600,
                "reactivePower": 67.130,
                "pwrFactor": 0.000,
                "voltage": 119.753,
                "current": 0.169,
                "freq": 60.000
            },
            {
                "eid": 1778385682,
                "timestamp": 1700857449,
                "actEnergyDlvd": 25812.023,
                "actEnergyRcvd": 50059.863,
                "apparentEnergy": 263354.661,
                "reactEnergyLagg": 189461.385,
                "reactEnergyLead": 2800.824,
                "instantaneousDemand": -83.678,
                "activePower": -83.678,
                "apparentPower": 162.507,
                "reactivePower": 49.642,
                "pwrFactor": -0.455,
                "voltage": 120.141,
                "current": 1.359,
                "freq": 60.000
            },
            {
                "eid": 1778385683,
                "timestamp": 1700857449,
                "actEnergyDlvd": 0.000,
                "actEnergyRcvd": 0.000,
                "apparentEnergy": 0.000,
                "reactEnergyLagg": 0.000,
                "reactEnergyLead": 0.000,
                "instantaneousDemand": 0.000,
                "activePower": 0.000,
                "apparentPower": 0.000,
                "reactivePower": 0.000,
                "pwrFactor": 0.000,
                "voltage": 0.000,
                "current": 0.000,
                "freq": 0.000
            }
        ]
    }
]

If anyone would like to see any endpoint output from D8.2.62 (038ae8) let me know and Iā€™ll post.

1 Like

Great work del13r!
In your list of envoy D7-integrations I think I found one that you missed:

Unfortunately this one did not work for me for some reason.
I got the integration from briancmpbll working now.

I just got my solar installation installed last week so Iā€™m new to all this (and new to homeassistant too). There is an overwheliming amount of reading to do for me and it is hard to decide which (HACS-)integration is best at this moment.
One of the most important features Iā€™m looking for is being able to shit down solar production if energy prices are negative. Can anybody advise on that?

Hi @guido1,

Thanks for letting me know about that HACS integration.

I assume that integration didnt work for you because you may not have an ā€œinstallerā€ token.
To do what you are wanting to do like shut down solar production, either yourself via the GUI, OR the integration via home assistant, absolutely need an installer token to be able to access that setting.

How I have been able to get a temporary 12 hour installer token:
Go to https://entrez.enphaseenergy.com/login
and enter in your email and password.

Then you should get 2 options.

image

ā€œFor commissioned gatewayā€ in my experience, provides me a 12 hour installer token which is associated with both my email address and my system serial number.

image

ā€œFor uncommissioned gatewaysā€ in my experience, provides me a 12 hour installer token which is only associated with my email address and the serial number is ā€œun-commissionedā€.

image

Hint: I use https://jwt.io/ to decode the token and see this information.

Note: The Home Assistant integrations most likely uses a different method which is automated. For example, when I use https://enlighten.enphaseenergy.com/entrez-auth-token?serial_num=MYSERIALNUMBER , I instead get a 12 month owner token.
More than likely, this is why the integration is unable to turn on and off production for you.

image

As an example, here are the manual steps to get to that power production setting once you have an installer token:

Go to
https://envoy.local/home

which always starts off cold with

Then there are 2 Authentication options,

  • Login with Enphase
  • Token Authentication

ā€œLogin with Enphaseā€ in my experience, provides me the same 12 hour installer token.

If you wish to verify and decode yours, you can press f12 on chrome for example, tick preserve log, press ā€œlogin with enphaseā€, and then find check_jwt in the list on the left and then you can see the token for yourself and then decode that token to see what type is in use for this session after the word Bearer

Decoded
image

The other option is to paste in a 12 month owner token and press submit, however given you want to disable power production, you will not be able to do that with a 12 month owner token.

scroll down to the very bottom and choose ā€œInstaller Loginā€
image
If your token from Enphase is an installer token, you will see this button towards the bottom of the page.


If you canā€™t get to that switch with your token, then neither can an integration do that on your behalf.

As for the obligatory question of ā€œHow can I get a 12 month installer token?ā€, my guess is that this is a conversation you need to have with Enphase sales/support.

1 Like

Thank you very much for your clear answer!
Now I finally understand why shine may say that it is possible, while it practically is not.
My installer is willing to provide me with an installer token, but I understand from your answer that it will not help me since it will be associated with his email and paswoord, not mine.
Itā€™s a pity. It means I have to shut it down with another relais, that I can control from HA. (Any suggestions are welcome)
Or maybe the enphase relais has a wired input for controlling it?

1 Like

In that case, you can try paste the token into the gui and turn it on and off yourself.

It canā€™t hurt to call the manufacturer and ask for this feature. Perhaps they have a better solution that Iā€™m not aware of.

@del13r Hi. Iā€™m using this amazing post to add cost tracking to HA. While I used to have an Envoy (and used your previous solution to integrate that with the Energy dashboard) I donā€™t since I moved. I do plan to install solar fairly soon though. In the meantime, Iā€™m using the energy readings from the Myenergi Zappi EV charger, which provides all I need for now. I wonder if you could clear up something for me though. You have the following template sensor:

# Australian Ausgrid NSW Peak-shoulder-offpeak sensor defined
  # https://www.ausgrid.com.au/Your-energy-use/Meters/Time-of-use-pricing
  # Peak: 2pm - 8pm on working weekdays 1 November - 31 March;
  # Peak: 5pm - 9pm on working weekdays 1 June - 31 August
  # Off-peak: 10pm - 7am
  # Shoulder: all other times
  - sensor:
      name: TOU Period
      icon: mdi:clock-time-three-outline
      state: >
        {% set tou_period = 'shoulder' %}
        {% set n_month = now().month %}
        {% set n_hour = now().hour %}
        {% set is_summer = (n_month <= 3 or n_month >= 11) %}
        {% set is_winter = (6 <= n_month <= 8 ) %}
        {% if n_hour >= 22 or n_hour < 7 %}
          {% set tou_period = 'offpeak' %}
        {% elif ((is_summer and (14 <= n_hour <= 19))
           or (is_winter and (17 <= n_hour <= 20)))
           and (is_state("binary_sensor.workday_sensor", "on")) %}
          {% set tou_period = 'peak' %}
        {% endif %}
        {{tou_period}}

Can you help me understand exactly when this sensor will be updated? That is, what trigger will make it update? Just showing my lack of HA knowledge here I think. If I plug it into Developer Tools, it says it listens for a change in state of the workday sensor, which wouldnā€™t be sufficient to keep the sensor up to date. Thank you!

The if statement is in the body of a sensor. Sensors are constantly evaluated by home assistant for any changes.
In my experience, if anything changes to the state of any of the elements in the if statement, its updated immediately.

The reason why I prefer the if statement is that if there was an outage for example, and home assistant was down or being restarted at the same time as the 7am changeover from offpeak to shoulder, the if statement would evaluate this as soon as home assistant is back up where as an automation meant to run at 7am would have not run.
The chance of the wrong tariff being recorded is higher if relying on an automation to run at a certain time.

In the case of this if statement, it is mainly monitoring the hour of the day, month of the year, and the workday sensor. Any time one of those elements changes, the if statement immediately catches it.

Proof of how accurate the if statement is:

Thanks for taking the time to explain that. I have the following sensor:

        {% set n_month = now().month %}
        {% set n_hour = now().hour %}
        {% if now().weekday() in (5,6) and n_hour > 11 and n_hour < 14 %}
          {% set tou_period = 'Free' %}
        {% else %}
          {% set tou_period = 'Shoulder' %}
          {% set is_summer = (n_month <= 3 or n_month >= 11) %}
          {% set is_winter = (6 <= n_month <= 8 ) %}
          {% if n_hour >= 22 or n_hour < 7 %}
            {% set tou_period = 'Offpeak' %}
          {% elif ((is_summer and (14 <= n_hour <= 19))
            or (is_winter and (14 <= n_hour <= 19)))
            and (is_state("binary_sensor.workday_sensor", "on")) %}
            {% set tou_period = 'Peak' %}
          {% endif %}
        {% endif %}
        {{tou_period}}

I get two free hours of electricity on Saturdays amd Sundays courtesy of Red Energyā€™s EV Plan, hence the extra logic. I donā€™t have seasonal prices, but left your logic in there in case I ever do (but I changed the TOU period to be the same for summer and winter).

When I plug this into Developer Tools, it says the sensor updates every minute. Thatā€™s OK I guess, but I thought to do this (inside my templates.yaml file):

- trigger:
    - platform: time_pattern
      minutes: 0
    # update every hour on the hour
    - platform: homeassistant
      event: start
  sensor:
    # Australian Ausgrid NSW Peak-shoulder-offpeak sensor defined
    # https://www.ausgrid.com.au/Your-energy-use/Meters/Time-of-use-pricing
    # Peak: 2pm - 8pm on working weekdays 1 November - 31 March;
    # Peak: 5pm - 9pm on working weekdays 1 June - 31 August
    # Off-peak: 10pm - 7am
    # Shoulder: all other times
    - name: TOU Period
      icon: mdi:clock-time-three-outline
      state: >
        {% set n_month = now().month %}
        {% set n_hour = now().hour %}
        {% if now().weekday() in (5,6) and n_hour > 11 and n_hour < 14 %}
          {% set tou_period = 'Free' %}
        {% else %}
          {% set tou_period = 'Shoulder' %}
          {% set is_summer = (n_month <= 3 or n_month >= 11) %}
          {% set is_winter = (6 <= n_month <= 8 ) %}
          {% if n_hour >= 22 or n_hour < 7 %}
            {% set tou_period = 'Offpeak' %}
          {% elif ((is_summer and (14 <= n_hour <= 19))
            or (is_winter and (14 <= n_hour <= 19)))
            and (is_state("binary_sensor.workday_sensor", "on")) %}
            {% set tou_period = 'Peak' %}
          {% endif %}
        {% endif %}
        {{tou_period}}

    - name: "Electricity Tariff"
      state: >-
        {% if is_state('sensor.tou_period', 'Free') %}
          0
        {% else %}
          {% if is_state('sensor.tou_period', 'Peak') %}
            .484
          {% elif is_state('sensor.tou_period', 'Shoulder') %}
            .33
          {% else %}
            .22
          {% endif %}
        {% endif %}
      unique_id: electricity_tariff
      unit_of_measurement: AUD/kWh

I think this means the TOU and tariff sensors only update on the hour, and on HA startup. Reckon this is right? I didnā€™t bother setting up input_numbers for the tariff, and just coded the tariffs directly in the sensor. Do I need to do anything else in there, or is just coding the numbers directly like that sufficient (maybe with regard to it being a float or something)?

Iā€™m not sure if you still use 3 automations to change the tariff, but Iā€™m using a single one to update my two Utility Meters, like this:

alias: Tariff Utility Meters Update
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.tou_period
condition: []
action:
  - service: select.select_option
    data:
      option: "{{ states ('sensor.tou_period') }}"
    target:
      entity_id:
        - select.daily_import
  - service: select.select_option
    data:
      option: "{{ states ('sensor.tou_period') }}"
    target:
      entity_id:
        - select.monthly_import
mode: single

Just a bit simpler! Thanks again for your invaluable helpā€¦

so tried implementing this codeā€¦
I have the selector at the bottom and I can also display apexcharts as you did in a previous post, but Iā€™m getting an error with this postā€¦