Skip to content

Commit

Permalink
Add "Sommer Winter Umschaltung"
Browse files Browse the repository at this point in the history
  • Loading branch information
MadOne committed Aug 8, 2024
1 parent 4f3579e commit 4e5dcd7
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
44 changes: 44 additions & 0 deletions custom_components/weishaupt_modbus/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ async def async_setup_entry(
HK_Raum_Soll_Normal(host, port),
HK_Raum_Soll_Absenk(host, port),
HK_Heizkennlinie(host, port),
HK_SommerWinterUmschaltung(host, port),
],
update_before_add=True,
)
Expand Down Expand Up @@ -398,3 +399,46 @@ def device_info(self) -> DeviceInfo:
return {
"identifiers": {(DOMAIN, "Heizkreis")},
}


class HK_SommerWinterUmschaltung(NumberEntity):
"""Representation of a WEM Portal number."""

_attr_name = "HK Sommer Winter Umschaltung"
_attr_unique_id = DOMAIN + _attr_name
_attr_native_value = 0
_attr_should_poll = True
_attr_native_min_value = 3
_attr_native_max_value = 30
_attr_native_step = 0.5
_attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS

def __init__(self, host, port) -> None:
"""Init."""
self._host = host
self._port = port
# whp = wp.heat_pump(host, port)
# whp.connect()
# self._attr_native_value = whp.WW_Absenk
# self.async_write_ha_state()

async def async_set_native_value(self, value: float) -> None:
"""Update the current value."""
whp = wp.heat_pump(self._host, self._port)
whp.connect()
whp.HK_SommerWinterUmschaltung = value
self._attr_native_value = whp.HK_SommerWinterUmschaltung
self.async_write_ha_state()

async def async_update(self) -> None:
"""Update Entity Only used by the generic entity update service."""
whp = wp.heat_pump(self._host, self._port)
whp.connect()
self._attr_native_value = whp.HK_SommerWinterUmschaltung

@property
def device_info(self) -> DeviceInfo:
"""Information about this entity/device."""
return {
"identifiers": {(DOMAIN, "Heizkreis")},
}
9 changes: 9 additions & 0 deletions custom_components/weishaupt_modbus/wp.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,15 @@ def HK_Heizkennlinie(self):
def HK_Heizkennlinie(self, value):
self.WWP.write_register(41108, int(value * 100), slave=1)

@property
def HK_SommerWinterUmschaltung(self):
"""Test."""
return self.WWP.read_holding_registers(41109, slave=1).registers[0] / 10

@HK_SommerWinterUmschaltung.setter
def HK_SommerWinterUmschaltung(self, value):
self.WWP.write_register(41109, int(value * 10), slave=1)

#####################
# Warm Water #
#####################
Expand Down

0 comments on commit 4e5dcd7

Please sign in to comment.