Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 4f3579e

Browse files
committed
add Heiszennlinie
add some pylint ignores
1 parent b8010a6 commit 4f3579e

File tree

4 files changed

+67
-13
lines changed

4 files changed

+67
-13
lines changed

custom_components/weishaupt_modbus/config_flow.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ async def async_step_user(self, user_input=None):
7878

7979
return self.async_create_entry(title=info["title"], data=user_input)
8080

81-
except Exception:
81+
except Exception: # noqa: BLE001
8282
errors["base"] = "unknown"
8383

8484
# If there is no user input or there were errors, show the form again, including any errors that were found with the input.

custom_components/weishaupt_modbus/number.py

+44
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ async def async_setup_entry(
4141
HK_Raum_Soll_Komfort(host, port),
4242
HK_Raum_Soll_Normal(host, port),
4343
HK_Raum_Soll_Absenk(host, port),
44+
HK_Heizkennlinie(host, port),
4445
],
4546
update_before_add=True,
4647
)
@@ -354,3 +355,46 @@ def device_info(self) -> DeviceInfo:
354355
return {
355356
"identifiers": {(DOMAIN, "Heizkreis")},
356357
}
358+
359+
360+
class HK_Heizkennlinie(NumberEntity):
361+
"""Representation of a WEM Portal number."""
362+
363+
_attr_name = "HK Heizkennlinie"
364+
_attr_unique_id = DOMAIN + _attr_name
365+
_attr_native_value = 0
366+
_attr_should_poll = True
367+
_attr_native_min_value = 0
368+
_attr_native_max_value = 1.5
369+
_attr_native_step = 0.05
370+
_attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS
371+
372+
def __init__(self, host, port) -> None:
373+
"""Init."""
374+
self._host = host
375+
self._port = port
376+
# whp = wp.heat_pump(host, port)
377+
# whp.connect()
378+
# self._attr_native_value = whp.WW_Absenk
379+
# self.async_write_ha_state()
380+
381+
async def async_set_native_value(self, value: float) -> None:
382+
"""Update the current value."""
383+
whp = wp.heat_pump(self._host, self._port)
384+
whp.connect()
385+
whp.HK_Heizkennlinie = value
386+
self._attr_native_value = whp.HK_Heizkennlinie
387+
self.async_write_ha_state()
388+
389+
async def async_update(self) -> None:
390+
"""Update Entity Only used by the generic entity update service."""
391+
whp = wp.heat_pump(self._host, self._port)
392+
whp.connect()
393+
self._attr_native_value = whp.HK_Heizkennlinie
394+
395+
@property
396+
def device_info(self) -> DeviceInfo:
397+
"""Information about this entity/device."""
398+
return {
399+
"identifiers": {(DOMAIN, "Heizkreis")},
400+
}

custom_components/weishaupt_modbus/switch.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from homeassistant.components.switch import SwitchEntity
88
from homeassistant.config_entries import ConfigEntry
9-
from homeassistant.const import CONF_HOST, CONF_PORT, STATE_ON
9+
from homeassistant.const import CONF_HOST, CONF_PORT # STATE_ON
1010
from homeassistant.core import HomeAssistant
1111

1212
# from homeassistant.helpers import device_registry as dr
@@ -59,15 +59,15 @@ def is_on(self):
5959

6060
async def async_turn_on(self):
6161
"""Turn On method."""
62-
# self._attr_state = "on" # type: ignore
62+
# self._attr_state = "on"
6363
# whp = wp.heat_pump(self._host, self._port)
6464
# whp.connect()
6565
# whp.WW_SGReady = 1
6666
# self.async_write_ha_state()
6767

6868
async def async_turn_off(self):
6969
"""Turn Off method."""
70-
# self._attr_state = "off" # type: ignore
70+
# self._attr_state = "off"
7171
# whp = wp.heat_pump(self._host, self._port)
7272
# whp.connect()
7373
# whp.WW_SGReady = 0

custom_components/weishaupt_modbus/wp.py

+19-9
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def connect(self):
2626
"""Test."""
2727
try:
2828
self.WWP = ModbusClient(host=self._ip, port=self._port)
29-
return self.WWP.connected
30-
except:
29+
return self.WWP.connected # noqa: TRY300
30+
except: # noqa: E722
3131
return None
3232

3333
##############################################################################################################################
@@ -43,15 +43,15 @@ def Sys_Aussentemperatur1(self):
4343
"""Outer Temperature1."""
4444
try:
4545
return self.WWP.read_input_registers(30001, slave=1).registers[0] / 10
46-
except:
46+
except: # noqa: E722
4747
return None
4848

4949
@property
5050
def Sys_Aussentemperatur2(self):
5151
"""Outer Temperature2."""
5252
try:
5353
return self.WWP.read_input_registers(30002, slave=1).registers[0] / 10
54-
except:
54+
except: # noqa: E722
5555
return None
5656

5757
@property
@@ -62,7 +62,7 @@ def Sys_Fehler(self):
6262
if val == 65535:
6363
return "kein Fehler"
6464
return "Fehler: " + val
65-
except:
65+
except: # noqa: E722
6666
return None
6767

6868
@property
@@ -73,7 +73,7 @@ def Sys_Warnung(self):
7373
if val == 65535:
7474
return "kein Fehler"
7575
return "Fehler: " + val
76-
except:
76+
except: # noqa: E722
7777
return None
7878

7979
@property
@@ -83,8 +83,9 @@ def Sys_Fehlerfrei(self):
8383
val = self.WWP.read_input_registers(30005, slave=1).registers[0]
8484
if val == 0:
8585
return "Fehler aktiv"
86-
return "Störungsfreier Betrieb"
87-
except:
86+
else: # noqa: RET505
87+
return "Störungsfreier Betrieb"
88+
except: # noqa: E722
8889
return None
8990

9091
@property
@@ -165,7 +166,7 @@ def Sys_Betriebsanzeige(self): # noqa: C901
165166
return "HK Sperre"
166167
case 35:
167168
return "Absenk"
168-
except:
169+
except: # noqa: E722
169170
return None
170171

171172
@property
@@ -353,6 +354,15 @@ def HK_RaumSoll_Absenk(self):
353354
def HK_RaumSoll_Absenk(self, value):
354355
self.WWP.write_register(41107, value * 10, slave=1)
355356

357+
@property
358+
def HK_Heizkennlinie(self):
359+
"""Test."""
360+
return self.WWP.read_holding_registers(41108, slave=1).registers[0] / 100
361+
362+
@HK_Heizkennlinie.setter
363+
def HK_Heizkennlinie(self, value):
364+
self.WWP.write_register(41108, int(value * 100), slave=1)
365+
356366
#####################
357367
# Warm Water #
358368
#####################

0 commit comments

Comments
 (0)