From cd73de9bc78300629c7d3b50beca50d939ee9b9d Mon Sep 17 00:00:00 2001 From: Vincent Wolsink Date: Sun, 11 Feb 2024 18:46:04 +0100 Subject: [PATCH] Reformat with new Black style --- custom_components/enphase_envoy/__init__.py | 1 + custom_components/enphase_envoy/config_flow.py | 1 + custom_components/enphase_envoy/diagnostics.py | 1 + custom_components/enphase_envoy/envoy_reader.py | 17 ++++++++++------- custom_components/enphase_envoy/sensor.py | 7 ++++--- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/custom_components/enphase_envoy/__init__.py b/custom_components/enphase_envoy/__init__.py index 31e4c05..cc33140 100644 --- a/custom_components/enphase_envoy/__init__.py +++ b/custom_components/enphase_envoy/__init__.py @@ -1,4 +1,5 @@ """The Enphase Envoy integration.""" + from __future__ import annotations import asyncio diff --git a/custom_components/enphase_envoy/config_flow.py b/custom_components/enphase_envoy/config_flow.py index d582e88..04ce0e7 100644 --- a/custom_components/enphase_envoy/config_flow.py +++ b/custom_components/enphase_envoy/config_flow.py @@ -1,4 +1,5 @@ """Config flow for Enphase Envoy integration.""" + from __future__ import annotations import contextlib diff --git a/custom_components/enphase_envoy/diagnostics.py b/custom_components/enphase_envoy/diagnostics.py index f6c9ac1..3747699 100644 --- a/custom_components/enphase_envoy/diagnostics.py +++ b/custom_components/enphase_envoy/diagnostics.py @@ -1,4 +1,5 @@ """Diagnostics support for Enphase Envoy.""" + from __future__ import annotations from typing import Any diff --git a/custom_components/enphase_envoy/envoy_reader.py b/custom_components/enphase_envoy/envoy_reader.py index 3b1fabb..e0abb83 100644 --- a/custom_components/enphase_envoy/envoy_reader.py +++ b/custom_components/enphase_envoy/envoy_reader.py @@ -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 @@ -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" @@ -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": @@ -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 diff --git a/custom_components/enphase_envoy/sensor.py b/custom_components/enphase_envoy/sensor.py index 92b01b1..f57c4fd 100644 --- a/custom_components/enphase_envoy/sensor.py +++ b/custom_components/enphase_envoy/sensor.py @@ -1,4 +1,5 @@ """Support for Enphase Envoy solar energy monitor.""" + from __future__ import annotations import datetime @@ -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 + ), )