Skip to content
Draft
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
3 changes: 2 additions & 1 deletion custom_components/foxess_em/average/average_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from homeassistant.core import HomeAssistant
from homeassistant.helpers.event import async_track_utc_time_change
from pandas import DataFrame
from typing import Any

from custom_components.foxess_em.common.hass_load_controller import HassLoadController

Expand Down Expand Up @@ -62,7 +63,7 @@ def ready(self) -> bool:
"""Model status"""
return self._model.ready()

async def async_refresh(self, *args) -> None: # pylint: disable=unused-argument
async def async_refresh(self, *_: Any) -> None:
"""Refresh data"""
_LOGGER.debug("Refreshing averages model")

Expand Down
5 changes: 3 additions & 2 deletions custom_components/foxess_em/battery/battery_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from homeassistant.core import HomeAssistant
from homeassistant.helpers.event import async_track_state_change_event
from typing import Any

from custom_components.foxess_em.battery.battery_util import BatteryUtils
from custom_components.foxess_em.battery.schedule import Schedule
Expand Down Expand Up @@ -74,11 +75,11 @@ def ready(self) -> bool:
"""Model status"""
return self._model.ready()

async def async_refresh(self, *args) -> None:
async def async_refresh(self, *_: Any) -> None:
"""Async refresh"""
self.refresh()

def refresh(self, *args) -> None: # pylint: disable=unused-argument
def refresh(self, *_: Any) -> None:
"""Refresh battery model"""
_LOGGER.debug("Refreshing battery model")

Expand Down
17 changes: 9 additions & 8 deletions custom_components/foxess_em/charge/charge_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
async_track_state_change,
async_track_utc_time_change,
)
from typing import Any

from custom_components.foxess_em.fox.fox_service import FoxService
from custom_components.foxess_em.util.peak_period_util import PeakPeriodUtils
Expand Down Expand Up @@ -98,7 +99,7 @@ def _add_listeners(self) -> None:
)
self._unload_listeners.append(eco_end)

async def _eco_start_setup(self, *args) -> None: # pylint: disable=unused-argument
async def _eco_start_setup(self, *_: Any) -> None:
"""Set target SoC"""

_LOGGER.debug("Calculating optimal battery SoC")
Expand All @@ -123,7 +124,7 @@ async def _eco_start_setup(self, *args) -> None: # pylint: disable=unused-argum
_LOGGER.debug("Charge rate set to %dA for %s", self._target_charge_amps, window)
await self._fox.set_charge_current(self._target_charge_amps)

async def _eco_start(self, *args) -> None: # pylint: disable=unused-argument
async def _eco_start(self, *_: Any) -> None:
"""Eco start"""

_LOGGER.debug("Setting min SoC to %d%%", self._perc_target)
Expand All @@ -138,20 +139,20 @@ async def _eco_start(self, *args) -> None: # pylint: disable=unused-argument
await self._stop_force_charge()

async def _start_force_charge_off_peak(
self, *args
) -> None: # pylint: disable=unused-argument
self, *_: Any
) -> None:
"""Set Fox force charge settings to True"""
self._charge_active = True
await self._fox.start_force_charge_off_peak()

async def _stop_force_charge(
self, *args
) -> None: # pylint: disable=unused-argument
self, *_: Any
) -> None:
"""Set Fox force charge settings to False"""
self._charge_active = False
await self._fox.stop_force_charge()

async def _eco_end(self, *args) -> None: # pylint: disable=unused-argument
async def _eco_end(self, *_: Any) -> None:
"""Stop holding SoC"""

self._stop_listening()
Expand All @@ -165,7 +166,7 @@ async def _eco_end(self, *args) -> None: # pylint: disable=unused-argument

async def _battery_soc_change(
self, entity, old_state, new_state
): # pylint: disable=unused-argument
) -> None:
new_state = float(new_state.state)

if self._custom_charge_profile and new_state > 90:
Expand Down
5 changes: 3 additions & 2 deletions custom_components/foxess_em/common/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_IDENTIFIERS, ATTR_NAME
from homeassistant.helpers.device_registry import DeviceEntryType
from typing import Any

from ..common.switch_desc import SwitchDescription
from ..const import ATTR_ENTRY_TYPE, DEFAULT_NAME, DOMAIN, SWITCH
Expand All @@ -32,12 +33,12 @@ def __init__(

self._unique_id = f"{DEFAULT_NAME}_{SWITCH}_{self.switch_desc.name}"

async def async_turn_on(self, **kwargs) -> None: # pylint: disable=unused-argument
async def async_turn_on(self, **_: Any) -> None:
"""Turn on the switch."""
switch = getattr(self._controller, self.switch_desc.switch)
switch(True)

async def async_turn_off(self, **kwargs) -> None: # pylint: disable=unused-argument
async def async_turn_off(self, **_: Any) -> None:
"""Turn off the switch."""
switch = getattr(self._controller, self.switch_desc.switch)
switch(False)
Expand Down
9 changes: 5 additions & 4 deletions custom_components/foxess_em/forecast/forecast_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from homeassistant.core import HomeAssistant
from homeassistant.helpers.event import async_track_utc_time_change
from pandas import DataFrame
from typing import Any

from custom_components.foxess_em.common.hass_load_controller import HassLoadController
from custom_components.foxess_em.const import FORECAST
Expand Down Expand Up @@ -147,7 +148,7 @@ def ready(self) -> bool:
"""Model status"""
return self._api.ready()

async def async_refresh(self, *args) -> None: # pylint: disable=unused-argument
async def async_refresh(self, *_: Any) -> None:
"""Refresh forecast"""
try:
_LOGGER.debug("Refreshing forecast data")
Expand All @@ -165,8 +166,8 @@ async def async_refresh(self, *args) -> None: # pylint: disable=unused-argument
self._notify_listeners()

async def _async_get_site_info(
self, *args
) -> None: # pylint: disable=unused-argument
self, *_: Any
) -> None:
"""Refresh site info"""
try:
_LOGGER.debug("Setting Solcast site info")
Expand All @@ -188,7 +189,7 @@ def raw_data(self) -> list:
"""Return resampled data"""
return self._api.raw_data()

async def _reset_api_count(self, *args) -> None: # pylint: disable=unused-argument
async def _reset_api_count(self, *_: Any) -> None:
"""Reset API count to 0"""
self._api_count = 0

Expand Down
9 changes: 5 additions & 4 deletions custom_components/foxess_em/fox/fox_cloud_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging

from homeassistant.core import HomeAssistant
from typing import Any

from ..util.exceptions import NoDataError
from .fox_cloud_api import FoxCloudApiClient
Expand Down Expand Up @@ -77,7 +78,7 @@ async def _start_force_charge(self, query: dict) -> None:
except NoDataError as ex:
_LOGGER.error(ex)

async def stop_force_charge(self, *args) -> None: # pylint: disable=unused-argument
async def stop_force_charge(self, *_: Any) -> None:
"""Start force charge"""
_LOGGER.debug("Requesting stop force charge from Fox Cloud")

Expand All @@ -92,8 +93,8 @@ async def stop_force_charge(self, *args) -> None: # pylint: disable=unused-argu
_LOGGER.error(ex)

async def set_min_soc(
self, soc: int, *args
) -> None: # pylint: disable=unused-argument
self, soc: int, *_: Any
) -> None:
"""Start force charge"""
_LOGGER.debug("Sending min SoC to Fox Cloud")

Expand All @@ -106,7 +107,7 @@ async def set_min_soc(
except NoDataError as ex:
_LOGGER.error(ex)

async def set_charge_current(self, charge_current: float, *args) -> None:
async def set_charge_current(self, charge_current: float, *_: Any) -> None:
"""Set charge current"""
_LOGGER.debug(
"Skipping call to set charge current as not supported using the Cloud"
Expand Down
9 changes: 5 additions & 4 deletions custom_components/foxess_em/fox/fox_modbus_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging

from homeassistant.core import HomeAssistant
from typing import Any

from .fox_modbus import FoxModbus
from .fox_service import FoxService
Expand Down Expand Up @@ -68,19 +69,19 @@ async def _start_force_charge(self, start, stop) -> None:
_P1_ENABLE, [1, start_encoded, stop_encoded, 0, 0, 0], self._slave
)

async def stop_force_charge(self, *args) -> None: # pylint: disable=unused-argument
async def stop_force_charge(self, *_: Any) -> None:
"""Start force charge"""
_LOGGER.debug("Requesting stop force charge from Fox Modbus")
await self._modbus.write_registers(_P1_ENABLE, [0, 0, 0, 0, 0, 0], self._slave)

async def set_min_soc(
self, soc: int, *args
) -> None: # pylint: disable=unused-argument
self, soc: int, *_: Any
) -> None:
"""Start force charge"""
_LOGGER.debug("Request set min SoC to Fox Modbus")
await self._modbus.write_registers(_MIN_SOC, [soc], self._slave)

async def set_charge_current(self, charge_current: float, *args) -> None:
async def set_charge_current(self, charge_current: float, *_: Any) -> None:
"""Set charge current"""
_LOGGER.debug(
f"Requesting set charge current of {charge_current}A to Fox Modbus"
Expand Down
13 changes: 7 additions & 6 deletions custom_components/foxess_em/fox/fox_service.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
"""Fox controller"""

import logging
from typing import Any

_LOGGER = logging.getLogger(__name__)


class FoxService:
"""Fox service"""

async def start_force_charge_now(self, *args) -> None:
async def start_force_charge_now(self, *_: Any) -> None:
"""Start force charge now"""
pass

async def start_force_charge_off_peak(self, *args) -> None:
async def start_force_charge_off_peak(self, *_: Any) -> None:
"""Start force charge off peak"""
pass

async def stop_force_charge(self, *args) -> None: # pylint: disable=unused-argument
async def stop_force_charge(self, *_: Any) -> None:
"""Start force charge"""
pass

async def set_min_soc(
self, soc: int, *args
) -> None: # pylint: disable=unused-argument
self, soc: int, *_: Any
) -> None:
"""Set Min SoC"""
pass

async def set_charge_current(self, charge_current: float, *args) -> None:
async def set_charge_current(self, charge_current: float, *_: Any) -> None:
"""Set charge current"""
pass

Expand Down