Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add grid profile sensor #96

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading