Skip to content

Commit

Permalink
Fix WW Push
Browse files Browse the repository at this point in the history
  • Loading branch information
MadOne committed Oct 8, 2024
1 parent ac8510a commit 0e03152
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 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 @@ -36,6 +36,7 @@ async def async_setup_entry(
[
WW_Normal(host, port),
WW_Absenk(host, port),
WW_Push(host, port),
HK_Party(host, port),
HK_Pause(host, port),
HK_Raum_Soll_Komfort(host, port),
Expand Down Expand Up @@ -571,3 +572,46 @@ def device_info(self) -> DeviceInfo:
return {
"identifiers": {(DOMAIN, "Heizkreis")},
}


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

_attr_name = "Push"
_attr_unique_id = DOMAIN + _attr_name
_attr_native_value = 0
_attr_should_poll = True
_attr_native_min_value = 0
_attr_native_max_value = 240
_attr_native_unit_of_measurement = UnitOfTime.MINUTES

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.WW_Push = int(value)

self._attr_native_value = whp.WW_Push
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.WW_Push

@property
def device_info(self) -> DeviceInfo:
"""Information about this entity/device."""
return {
"identifiers": {(DOMAIN, "Warmwasser")},
}
4 changes: 2 additions & 2 deletions custom_components/weishaupt_modbus/wp.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,11 @@ def WW_Konfiguration(self):
@property
def WW_Push(self):
"""WW Push."""
return self.WWP.read_holding_registers(32102, slave=1).registers[0]
return self.WWP.read_holding_registers(42102, slave=1).registers[0]

@WW_Push.setter
def WW_Push(self, value):
self.WWP.write_register(42103, value, slave=1)
self.WWP.write_register(42102, value, slave=1)

@property
def WW_Normal(self):
Expand Down

0 comments on commit 0e03152

Please sign in to comment.