Skip to content

Commit

Permalink
Reformat with new Black style
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentwolsink committed Feb 11, 2024
1 parent 05323ec commit cd73de9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
1 change: 1 addition & 0 deletions custom_components/enphase_envoy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The Enphase Envoy integration."""

from __future__ import annotations

import asyncio
Expand Down
1 change: 1 addition & 0 deletions custom_components/enphase_envoy/config_flow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Config flow for Enphase Envoy integration."""

from __future__ import annotations

import contextlib
Expand Down
1 change: 1 addition & 0 deletions custom_components/enphase_envoy/diagnostics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Diagnostics support for Enphase Envoy."""

from __future__ import annotations

from typing import Any
Expand Down
17 changes: 10 additions & 7 deletions custom_components/enphase_envoy/envoy_reader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module to read production and consumption values from an Enphase Envoy on the local network."""

import argparse
import asyncio
import datetime
Expand Down Expand Up @@ -37,7 +38,9 @@
ENDPOINT_URL_PDM_ENERGY = "https://{}/ivp/pdm/energy"
ENDPOINT_URL_INSTALLER_AGF = "https://{}/installer/agf/index.json"
ENDPOINT_URL_INSTALLER_AGF_SET_PROFILE = "https://{}/installer/agf/set_profile.json"
ENDPOINT_URL_INSTALLER_AGF_UPLOAD_PROFILE = "https://{}/installer/agf/upload_profile_package"
ENDPOINT_URL_INSTALLER_AGF_UPLOAD_PROFILE = (
"https://{}/installer/agf/upload_profile_package"
)

ENVOY_MODEL_M = "Metered"
ENVOY_MODEL_S = "Standard"
Expand Down Expand Up @@ -88,9 +91,11 @@ def convert_dev(dev):
def iter():
for key, value in dev.items():
if key == "reportDate":
yield "report_date", time.strftime(
"%Y-%m-%d %H:%M:%S", time.localtime(value)
) if value else None
yield "report_date", (
time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(value))
if value
else None
)
elif key == "dcVoltageINmV":
yield "dc_voltage", int(value) / 1000
elif key == "dcCurrentINmA":
Expand Down Expand Up @@ -1364,9 +1369,7 @@ async def upload_grid_profile(self, file):
)
message = resp.json().get("message")
if message != "success":
raise EnvoyError(
f"Failed uploading grid profile: {message}"
)
raise EnvoyError(f"Failed uploading grid profile: {message}")

self._clear_endpoint_cache("endpoint_installer_agf")
return resp
Expand Down
7 changes: 4 additions & 3 deletions custom_components/enphase_envoy/sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Support for Enphase Envoy solar energy monitor."""

from __future__ import annotations

import datetime
Expand Down Expand Up @@ -266,9 +267,9 @@ def device_info(self) -> DeviceInfo | None:
name=self._device_name,
sw_version=sw_version,
hw_version=resolve_hardware_id(hw_version),
configuration_url=f"https://{self.device_host}/"
if self.device_host
else None,
configuration_url=(
f"https://{self.device_host}/" if self.device_host else None
),
)


Expand Down

0 comments on commit cd73de9

Please sign in to comment.