Skip to content

Commit

Permalink
Merge pull request #96 from vincentwolsink/grid_profile_sensor
Browse files Browse the repository at this point in the history
Add grid profile sensor
  • Loading branch information
vincentwolsink authored Nov 2, 2023
2 parents 322b8dd + 0c86473 commit e5261b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions custom_components/enphase_envoy/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
UnitOfElectricCurrent,
UnitOfTemperature,
POWER_VOLT_AMPERE_REACTIVE,
EntityCategory,
)

DOMAIN = "enphase_envoy"
Expand Down Expand Up @@ -212,6 +213,12 @@ def get_model_name(model, hardware_id):
state_class=SensorStateClass.MEASUREMENT,
device_class=SensorDeviceClass.APPARENT_POWER,
),
SensorEntityDescription(
key="grid_profile",
name="Grid Profile",
icon="mdi:transmission-tower",
entity_category=EntityCategory.DIAGNOSTIC,
),
)
ADDITIONAL_METRICS.extend(
[
Expand Down
3 changes: 3 additions & 0 deletions custom_components/enphase_envoy/envoy_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
ENDPOINT_URL_STREAM = "https://{}/stream/meter"
ENDPOINT_URL_PRODUCTION_REPORT = "https://{}/ivp/meters/reports/production"
ENDPOINT_URL_PDM_ENERGY = "https://{}/ivp/pdm/energy"
ENDPOINT_URL_INSTALLER_AGF = "https://{}/installer/agf/index.json"

ENVOY_MODEL_M = "Metered"
ENVOY_MODEL_S = "Standard"
Expand Down Expand Up @@ -375,6 +376,7 @@ class EnvoyStandard(EnvoyData):
envoy_software_build_epoch_value = "endpoint_home_json_results.software_build_epoch"
envoy_update_status_value = "endpoint_home_json_results.update_status"
serial_number_value = "endpoint_info_results.envoy_info.device.sn"
grid_profile_value = "endpoint_installer_agf.selected_profile"

@envoy_property()
def envoy_info(self):
Expand Down Expand Up @@ -674,6 +676,7 @@ def url(endpoint, *a, **kw):
url("inventory_results", ENDPOINT_URL_INVENTORY, cache=300)
url("production_report", ENDPOINT_URL_PRODUCTION_REPORT, cache=0)
iurl("pdm_energy", ENDPOINT_URL_PDM_ENERGY)
iurl("installer_agf", ENDPOINT_URL_INSTALLER_AGF)

# If IPv6 address then enclose host in brackets
try:
Expand Down

0 comments on commit e5261b6

Please sign in to comment.