Skip to content

Commit

Permalink
refactor: rename should_skip_params_edits to skip_params_edits and up…
Browse files Browse the repository at this point in the history
…date references in Econet components
  • Loading branch information
jontofront committed Jan 13, 2025
1 parent e704b1f commit b6420d5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,13 @@ Updated the names of the lighter, boilerPower, and feeder sensors in custom_comp

## [1.1.0] - 2025-01-07
### Added
- Introduced `should_skip_params_edits` function in `custom_components/econet300/common.py` to determine if parameter edits should be skipped based on `controllerID` (controller_id == "ecoMAX360i").
- Introduced `skip_params_edits` function in `custom_components/econet300/common.py` to determine if parameter edits should be skipped based on `controllerID` (controller_id == "ecoMAX360i").
- Added `async_gather_entities` function in `custom_components/econet300/sensor.py` to collect sensor entities.
- Added annotations and type hints across various functions.
- Support for ecoMAX360i controller.

### Changed
- Updated `EconetDataCoordinator` class in `custom_components/econet300/common.py` to use type hints and new `should_skip_params_edits` function.
- Updated `EconetDataCoordinator` class in `custom_components/econet300/common.py` to use type hints and new `skip_params_edits` function.
- Modified entity setup in `custom_components/econet300/number.py` to skip for `controllerID: ecoMAX360i`.
- Refactored sensor entity gathering logic in `async_setup_entry`.
- Improved error handling in `Econet300Api` by adding specific exception logging.
Expand Down
4 changes: 2 additions & 2 deletions custom_components/econet300/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
_LOGGER = logging.getLogger(__name__)


def should_skip_params_edits(sys_params: dict[str, Any]) -> bool:
def skip_params_edits(sys_params: dict[str, Any]) -> bool:
"""Determine whether paramsEdits should be skipped based on controllerID."""
controller_id = sys_params.get("controllerID")
if controller_id == "ecoMAX360i":
Expand Down Expand Up @@ -71,7 +71,7 @@ async def _async_update_data(self) -> dict[str, Any]:
sys_params = await self._api.fetch_sys_params()

# Determine whether to fetch paramsEdits from ../econet/rmCurrentDataParamsEdits
if should_skip_params_edits(sys_params):
if skip_params_edits(sys_params):
params_edits = {}
else:
params_edits = await self._api.fetch_param_edit_data()
Expand Down
4 changes: 2 additions & 2 deletions custom_components/econet300/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .api import Limits
from .common import Econet300Api, EconetDataCoordinator, should_skip_params_edits
from .common import Econet300Api, EconetDataCoordinator, skip_params_edits
from .common_functions import camel_to_snake
from .const import (
DOMAIN,
Expand Down Expand Up @@ -175,7 +175,7 @@ async def async_setup_entry(

for key in NUMBER_MAP:
sys_params = coordinator.data.get("sysParams", {})
if should_skip_params_edits(sys_params):
if skip_params_edits(sys_params):
_LOGGER.info("Skipping number entity setup for controllerID: ecoMAX360i")
continue

Expand Down

0 comments on commit b6420d5

Please sign in to comment.