Skip to content

Commit

Permalink
upload latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
MadOne committed Oct 5, 2024
1 parent fc13669 commit ac8510a
Show file tree
Hide file tree
Showing 3 changed files with 177 additions and 21 deletions.
143 changes: 136 additions & 7 deletions custom_components/weishaupt_modbus/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ async def async_setup_entry(
HK_Raum_Soll_Absenk(host, port),
HK_Heizkennlinie(host, port),
HK_SommerWinterUmschaltung(host, port),
HK_Heizen_Konstanttemperatur(host, port),
HK_Heizen_Konstanttemperatur_Absenk(host, port),
HK_Kuehlen_Konstanttemperatur(host, port),
],
update_before_add=True,
)
Expand Down Expand Up @@ -137,7 +140,7 @@ def device_info(self) -> DeviceInfo:
class HK_Party(NumberEntity):
"""Representation of a WEM Portal number."""

_attr_name = "HK Party"
_attr_name = "Party"
_attr_unique_id = DOMAIN + _attr_name
_attr_native_value = 0
_attr_should_poll = True
Expand Down Expand Up @@ -186,7 +189,7 @@ def device_info(self) -> DeviceInfo:
class HK_Pause(NumberEntity):
"""Representation of a WEM Portal number."""

_attr_name = "HK Pause"
_attr_name = "Pause"
_attr_unique_id = DOMAIN + _attr_name
_attr_native_value = 0
_attr_should_poll = True
Expand Down Expand Up @@ -235,7 +238,7 @@ def device_info(self) -> DeviceInfo:
class HK_Raum_Soll_Komfort(NumberEntity):
"""Representation of a WEM Portal number."""

_attr_name = "HK Raumsollwert Komfort"
_attr_name = "Raumsollwert Komfort"
_attr_unique_id = DOMAIN + _attr_name
_attr_native_value = 0
_attr_should_poll = True
Expand Down Expand Up @@ -277,7 +280,7 @@ def device_info(self) -> DeviceInfo:
class HK_Raum_Soll_Normal(NumberEntity):
"""Representation of a WEM Portal number."""

_attr_name = "HK Raumsollwert Normal"
_attr_name = "Raumsollwert Normal"
_attr_unique_id = DOMAIN + _attr_name
_attr_native_value = 0
_attr_should_poll = True
Expand Down Expand Up @@ -319,7 +322,7 @@ def device_info(self) -> DeviceInfo:
class HK_Raum_Soll_Absenk(NumberEntity):
"""Representation of a WEM Portal number."""

_attr_name = "HK Raumsollwert Absenk"
_attr_name = "Raumsollwert Absenk"
_attr_unique_id = DOMAIN + _attr_name
_attr_native_value = 0
_attr_should_poll = True
Expand Down Expand Up @@ -361,7 +364,7 @@ def device_info(self) -> DeviceInfo:
class HK_Heizkennlinie(NumberEntity):
"""Representation of a WEM Portal number."""

_attr_name = "HK Heizkennlinie"
_attr_name = "Heizkennlinie"
_attr_unique_id = DOMAIN + _attr_name
_attr_native_value = 0
_attr_should_poll = True
Expand Down Expand Up @@ -404,7 +407,7 @@ def device_info(self) -> DeviceInfo:
class HK_SommerWinterUmschaltung(NumberEntity):
"""Representation of a WEM Portal number."""

_attr_name = "HK Sommer Winter Umschaltung"
_attr_name = "Sommer Winter Umschaltung"
_attr_unique_id = DOMAIN + _attr_name
_attr_native_value = 0
_attr_should_poll = True
Expand Down Expand Up @@ -442,3 +445,129 @@ def device_info(self) -> DeviceInfo:
return {
"identifiers": {(DOMAIN, "Heizkreis")},
}


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

_attr_name = "Heizen Konstanttemperatur"
_attr_unique_id = DOMAIN + _attr_name
_attr_native_value = 0
_attr_should_poll = True
_attr_native_min_value = 20
_attr_native_max_value = 45
_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_HeizenKonstanttemperatur = int(value)
self._attr_native_value = whp.HK_HeizenKonstanttemperatur
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_HeizenKonstanttemperatur

@property
def device_info(self) -> DeviceInfo:
"""Information about this entity/device."""
return {
"identifiers": {(DOMAIN, "Heizkreis")},
}


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

_attr_name = "Heizen Konstanttemperatur Absenk"
_attr_unique_id = DOMAIN + _attr_name
_attr_native_value = 0
_attr_should_poll = True
_attr_native_min_value = 20
_attr_native_max_value = 30
_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_HeizenKonstanttemperaturAbsenk = int(value)
self._attr_native_value = whp.HK_HeizenKonstanttemperaturAbsenk
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_HeizenKonstanttemperaturAbsenk

@property
def device_info(self) -> DeviceInfo:
"""Information about this entity/device."""
return {
"identifiers": {(DOMAIN, "Heizkreis")},
}


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

_attr_name = "Kühlen Konstanttemperatur"
_attr_unique_id = DOMAIN + _attr_name
_attr_native_value = 0
_attr_should_poll = True
_attr_native_min_value = 15
_attr_native_max_value = 25
_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_KuehlenKonstanttemperatur = int(value)
self._attr_native_value = whp.HK_KuehlenKonstanttemperatur
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_KuehlenKonstanttemperatur

@property
def device_info(self) -> DeviceInfo:
"""Information about this entity/device."""
return {
"identifiers": {(DOMAIN, "Heizkreis")},
}
28 changes: 14 additions & 14 deletions custom_components/weishaupt_modbus/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def device_info(self) -> DeviceInfo:
class HP_Betrieb(SensorEntity):
"""Representation of a Sensor."""

_attr_name = "Wärmepumpe Betrieb"
_attr_name = "Betrieb"
_attr_unique_id = DOMAIN + _attr_name
_attr_should_poll = True

Expand Down Expand Up @@ -541,7 +541,7 @@ def device_info(self) -> DeviceInfo:
class HP_Stoermeldung(SensorEntity):
"""Representation of a Sensor."""

_attr_name = "Wärmepumpe Störmeldung"
_attr_name = "Störmeldung"
_attr_unique_id = DOMAIN + _attr_name
_attr_should_poll = True

Expand Down Expand Up @@ -571,7 +571,7 @@ def device_info(self) -> DeviceInfo:
class HP_Leistungsanforderung(SensorEntity):
"""Representation of a Sensor."""

_attr_name = "Wärmepumpe Leistungsanforderung"
_attr_name = "Leistungsanforderung"
_attr_unique_id = DOMAIN + _attr_name
_attr_native_unit_of_measurement = "%"
_attr_should_poll = True
Expand Down Expand Up @@ -602,7 +602,7 @@ def device_info(self) -> DeviceInfo:
class Hp_Vorlauftemperatur(SensorEntity):
"""Representation of a Sensor."""

_attr_name = "Wärmepumpe Vorlauftemperatur"
_attr_name = "Vorlauftemperatur"
_attr_unique_id = DOMAIN + _attr_name
_attr_should_poll = True
_attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS
Expand Down Expand Up @@ -635,7 +635,7 @@ def device_info(self) -> DeviceInfo:
class Hp_Ruecklauftemperatur(SensorEntity):
"""Representation of a Sensor."""

_attr_name = "Wärmepumpe Rücklauftemperatur"
_attr_name = "Rücklauftemperatur"
_attr_unique_id = DOMAIN + _attr_name
_attr_should_poll = True
_attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS
Expand Down Expand Up @@ -682,7 +682,7 @@ def device_info(self) -> DeviceInfo:
class Energy_today(SensorEntity):
"""Representation of a Sensor."""

_attr_name = "Energy Today"
_attr_name = "Energie heute"
_attr_unique_id = DOMAIN + _attr_name
_attr_should_poll = True
_attr_native_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
Expand All @@ -707,16 +707,16 @@ async def async_update(self) -> None:
def device_info(self) -> DeviceInfo:
"""Information about this entity/device."""
return {
"identifiers": {(DOMAIN, "Statistics")},
"name": "Wärmepumpe-Statistics",
"identifiers": {(DOMAIN, "Statistik")},
"name": "Wärmepumpe-Statistik",
"manufacturer": "Weishaupt",
}


class Energy_yesterday(SensorEntity):
"""Representation of a Sensor."""

_attr_name = "Energy yesterday"
_attr_name = "Energie gestern"
_attr_unique_id = DOMAIN + _attr_name
_attr_should_poll = True
_attr_native_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
Expand All @@ -741,14 +741,14 @@ async def async_update(self) -> None:
def device_info(self) -> DeviceInfo:
"""Information about this entity/device."""
return {
"identifiers": {(DOMAIN, "Statistics")},
"identifiers": {(DOMAIN, "Statistik")},
}


class Energy_month(SensorEntity):
"""Representation of a Sensor."""

_attr_name = "Energy month"
_attr_name = "Energie Monat"
_attr_unique_id = DOMAIN + _attr_name
_attr_should_poll = True
_attr_native_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
Expand All @@ -773,14 +773,14 @@ async def async_update(self) -> None:
def device_info(self) -> DeviceInfo:
"""Information about this entity/device."""
return {
"identifiers": {(DOMAIN, "Statistics")},
"identifiers": {(DOMAIN, "Statistik")},
}


class Energy_year(SensorEntity):
"""Representation of a Sensor."""

_attr_name = "Energy year"
_attr_name = "Energie Jahr"
_attr_unique_id = DOMAIN + _attr_name
_attr_should_poll = True
_attr_native_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
Expand All @@ -805,5 +805,5 @@ async def async_update(self) -> None:
def device_info(self) -> DeviceInfo:
"""Information about this entity/device."""
return {
"identifiers": {(DOMAIN, "Statistics")},
"identifiers": {(DOMAIN, "Statistik")},
}
27 changes: 27 additions & 0 deletions custom_components/weishaupt_modbus/wp.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,33 @@ def HK_SommerWinterUmschaltung(self):
def HK_SommerWinterUmschaltung(self, value):
self.WWP.write_register(41109, int(value * 10), slave=1)

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

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

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

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

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

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

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

0 comments on commit ac8510a

Please sign in to comment.