Skip to content

Instantly share code, notes, and snippets.

@tathamoddie
Last active January 3, 2024 08:04
Show Gist options
  • Save tathamoddie/c7b016025cc6a01718bebd411743782c to your computer and use it in GitHub Desktop.
Save tathamoddie/c7b016025cc6a01718bebd411743782c to your computer and use it in GitHub Desktop.
rest:
- scan_interval: 15
resource: https://192.168.180.199/ivp/meters/readings
verify_ssl: false
headers:
Authorization: !secret enphase_api_token
sensor:
- unique_id: enphase_rest_production_meter
name: "Enphase Production Meter"
json_attributes_path: "$.0.channels[0]"
value_template: "{{ value_json[0].instantaneousDemand | float }}"
unit_of_measurement: W
device_class: power
json_attributes:
- "eid"
- "timestamp"
- "actEnergyDlvd"
- "actEnergyRcvd"
- "apparentEnergy"
- "reactEnergyLagg"
- "reactEnergyLead"
- "instantaneousDemand"
- "activePower"
- "apparentPower"
- "reactivePower"
- "pwrFactor"
- "voltage"
- "current"
- "freq"
- unique_id: enphase_rest_consumption_meter
name: "Enphase Consumption Meter"
json_attributes_path: "$.1.channels[0]"
value_template: "{{ value_json[1].instantaneousDemand | float }}"
unit_of_measurement: W
device_class: power
json_attributes:
- "eid"
- "timestamp"
- "actEnergyDlvd"
- "actEnergyRcvd"
- "apparentEnergy"
- "reactEnergyLagg"
- "reactEnergyLead"
- "instantaneousDemand"
- "activePower"
- "apparentPower"
- "reactivePower"
- "pwrFactor"
- "voltage"
- "current"
- "freq"
template:
sensor:
- unique_id: enphase_rest_consumption_meter_actEnergyDlvd
name: "Enphase Consumption Meter Energy Delivered"
device_class: energy
unit_of_measurement: kWh
state_class: total_increasing
state: "{{ (state_attr('sensor.enphase_consumption_meter', 'actEnergyDlvd') / 1000) | round(3) }}"
- unique_id: enphase_rest_consumption_meter_actEnergyRcvd
name: "Enphase Consumption Meter Energy Received"
device_class: energy
unit_of_measurement: kWh
state_class: total_increasing
state: "{{ (state_attr('sensor.enphase_consumption_meter', 'actEnergyRcvd') / 1000) | round(3) }}"
- unique_id: enphase_rest_production_meter_actEnergyDlvd
name: "Enphase Production Meter Energy Delivered"
device_class: energy
unit_of_measurement: kWh
state_class: total_increasing
state: "{{ (state_attr('sensor.enphase_production_meter', 'actEnergyDlvd') / 1000) | round(3) }}"
- unique_id: enphase_rest_production_meter_actEnergyRcvd
name: "Enphase Production Meter Energy Received"
device_class: energy
unit_of_measurement: kWh
state_class: total_increasing
state: "{{ (state_attr('sensor.enphase_production_meter', 'actEnergyRcvd') / 1000) | round(3) }}"
- unique_id: grid_import_template_sensor
name: "Grid Import Lifetime"
device_class: energy
unit_of_measurement: kWh
state_class: total_increasing
icon: mdi:transmission-tower-import
state: >
{{ states('sensor.enphase_consumption_meter_energy_delivered') | float | round(3) }}
- unique_id: grid_export_template_sensor
name: "Grid Export Lifetime"
device_class: energy
unit_of_measurement: kWh
state_class: total_increasing
icon: mdi:transmission-tower-import
state: >
{{ states('sensor.enphase_consumption_meter_energy_received') | float | round(3) }}
- unique_id: net_power
name: "Net Power"
device_class: power
unit_of_measurement: W
state: >
{{ states('sensor.enphase_consumption_meter') | float | round(3) }}
## Get this from https://enlighten.enphaseenergy.com/entrez-auth-token?serial_num=12345
## It lasts for 12 months
enphase_api_token: Bearer blah.blah.blah
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment