Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pail23 committed Dec 20, 2024
1 parent 30e1bc2 commit 91ca4e2
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 13 deletions.
8 changes: 5 additions & 3 deletions custom_components/stiebel_eltron_isg/config_flow.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""Adds config flow for Stiebel Eltron ISG."""

from __future__ import annotations

import ipaddress
import re

import voluptuous as vol
from homeassistant import config_entries
from homeassistant.config_entries import ConfigFlow, CONN_CLASS_LOCAL_POLL
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, CONF_SCAN_INTERVAL
from homeassistant.core import HomeAssistant, callback

Expand Down Expand Up @@ -52,11 +54,11 @@ def stiebeleltron_entries(hass: HomeAssistant):
}


class StiebelEltronISGFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
class StiebelEltronISGFlowHandler(ConfigFlow, domain=DOMAIN):
"""Config flow for Stiebel Eltron ISG."""

VERSION = 1
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL
CONNECTION_CLASS = CONN_CLASS_LOCAL_POLL

def __init__(self):
"""Initialize."""
Expand Down
2 changes: 1 addition & 1 deletion custom_components/stiebel_eltron_isg/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(
self._client: AsyncModbusTcpClient = AsyncModbusTcpClient(host=host, port=port)
self._lock = asyncio.Lock()
self._scan_interval = timedelta(seconds=scan_interval)
self.platforms = []
self.platforms: list = []

super().__init__(hass, _LOGGER, name=name, update_interval=self._scan_interval)

Expand Down
4 changes: 2 additions & 2 deletions custom_components/stiebel_eltron_isg/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
StiebelEltronISGIntegrationConfigEntry,
)

CONFIG_FIELDS_TO_REDACT = []
DATA_FIELDS_TO_REDACT = []
CONFIG_FIELDS_TO_REDACT: list = []
DATA_FIELDS_TO_REDACT: list = []


async def async_get_config_entry_diagnostics(
Expand Down
4 changes: 2 additions & 2 deletions custom_components/stiebel_eltron_isg/lwz_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ async def read_modbus_system_state(self) -> dict:

async def read_modbus_system_values(self) -> dict:
"""Read the system related values from the ISG."""
result = {}
result: dict = {}
inverter_data = await self.read_input_registers(slave=1, address=0, count=40)
if not inverter_data.isError():
decoder = BinaryPayloadDecoder.fromRegisters(
Expand Down Expand Up @@ -261,7 +261,7 @@ async def read_modbus_system_values(self) -> dict:

async def read_modbus_system_paramter(self) -> dict:
"""Read the system paramters from the ISG."""
result = {}
result: dict = {}
inverter_data = await self.read_holding_registers(
slave=1,
address=1000,
Expand Down
2 changes: 1 addition & 1 deletion custom_components/stiebel_eltron_isg/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def is_on(self) -> bool:
value = self.coordinator.data.get(self.entity_description.key)
if value is not None:
return self.coordinator.data.get(self.entity_description.key) != 0
return None
return False

async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn the switch on."""
Expand Down
6 changes: 3 additions & 3 deletions custom_components/stiebel_eltron_isg/wpm_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ async def read_modbus_system_state(self) -> dict: # noqa: C901

async def read_modbus_system_values(self) -> dict:
"""Read the system related values from the ISG."""
result = {}
result: dict = {}
inverter_data = await self.read_input_registers(slave=1, address=500, count=112)
if not inverter_data.isError():
decoder = BinaryPayloadDecoder.fromRegisters(
Expand Down Expand Up @@ -870,9 +870,9 @@ async def set_data(self, key, value) -> None:
elif key == COMFORT_TEMPERATURE_TARGET_HK3:
await self.write_register(address=1550, value=int(value * 10), slave=1)
elif key == ECO_TEMPERATURE_TARGET_HK3:
await self.write_register(address=1551, value=int(value * 10), slave=1)
await self.write_register(address=1551, value=int(value * 10), slave=1)
elif key == HEATING_CURVE_RISE_HK3:
await self.write_register(address=1552, value=int(value * 100), slave=1)
await self.write_register(address=1552, value=int(value * 100), slave=1)
elif key == DUALMODE_TEMPERATURE_HZG:
await self.write_register(address=1508, value=int(value * 10), slave=1)
elif key == COMFORT_WATER_TEMPERATURE_TARGET:
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,6 @@ keep-runtime-typing = true

[tool.ruff.lint.mccabe]
max-complexity = 25

[tool.mypy]
ignore_missing_imports = true
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 91ca4e2

Please sign in to comment.