Skip to content

Commit

Permalink
Bump hahomematic to 2025.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
SukramJ committed Jan 7, 2025
1 parent 75f2ce5 commit 6b8c6f6
Show file tree
Hide file tree
Showing 12 changed files with 178 additions and 59 deletions.
4 changes: 3 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Version 1.78.0 (2025-01-05)

## What's Changed
- Bump hahomematic to 2025.1.1
- Bump hahomematic to 2025.1.2
- Consider heating value type when calculating hvac action
- Identify channel of a system variable if name ends with channel address
- Device related sysvars are now shown under the device instead of the hub

# Version 1.77.0 (2024-12-29)

Expand Down
8 changes: 1 addition & 7 deletions custom_components/homematicip_local/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
DOMAIN: Final = "homematicip_local"
HMIP_LOCAL_MIN_HA_VERSION: Final = "2024.12.0"
ENABLE_EXPERIMENTAL_FEATURES: Final = False
HMIP_LOCAL_HAHOMEMATIC_VERSION: Final = "2025.1.1"
HMIP_LOCAL_HAHOMEMATIC_VERSION: Final = "2025.1.2"

DEFAULT_ENABLE_DEVICE_FIRMWARE_CHECK: Final = True
DEFAULT_ENABLE_SYSTEM_NOTIFICATIONS: Final = True
Expand Down Expand Up @@ -92,12 +92,6 @@ class HmipLocalServices(StrEnum):
UPDATE_DEVICE_FIRMWARE_DATA = "update_device_firmware_data"


TOTAL_SYSVAR: Final[tuple[str, ...]] = (
"svEnergyCounter_",
"svHmIPRainCounter_",
"svHmIPSunshineCounter_",
)

# filter out event error parameters, that should not be displayed in logbook
FILTER_ERROR_EVENT_PARAMETERS: Final[tuple[str, ...]] = ("ERROR_CODE",)

Expand Down
58 changes: 55 additions & 3 deletions custom_components/homematicip_local/entity_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ class HmButtonEntityDescription(HmEntityDescription, ButtonEntityDescription):
key="RAIN_COUNTER",
native_unit_of_measurement=UnitOfLength.MILLIMETERS,
state_class=SensorStateClass.TOTAL_INCREASING,
translation_key="rain_counter",
translation_key="rain_counter_total",
),
("RSSI_DEVICE", "RSSI_PEER"): HmSensorEntityDescription(
key="RSSI",
Expand All @@ -373,7 +373,7 @@ class HmButtonEntityDescription(HmEntityDescription, ButtonEntityDescription):
key="SUNSHINEDURATION",
native_unit_of_measurement=UnitOfTime.MINUTES,
state_class=SensorStateClass.TOTAL_INCREASING,
translation_key="sunshineduration",
translation_key="sunshine_duration",
),
"VALUE": HmSensorEntityDescription(
key="VALUE",
Expand Down Expand Up @@ -419,9 +419,61 @@ class HmButtonEntityDescription(HmEntityDescription, ButtonEntityDescription):
key="SERVICE_MESSAGES",
state_class=SensorStateClass.MEASUREMENT,
),
"svEnergyCounter": HmSensorEntityDescription(
key="ENERGY_COUNTER",
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
translation_key="energy_counter_total",
),
"svEnergyCounterFeedIn": HmSensorEntityDescription(
key="ENERGY_COUNTER_FEED_IN",
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
translation_key="energy_counter_feed_in_total",
),
"svHmIPRainCounter": HmSensorEntityDescription(
key="RAIN_COUNTER",
native_unit_of_measurement=UnitOfLength.MILLIMETERS,
state_class=SensorStateClass.TOTAL_INCREASING,
translation_key="rain_counter_total",
),
"svHmIPRainCounterToday": HmSensorEntityDescription(
key="RAIN_COUNTER_TODAY",
native_unit_of_measurement=UnitOfLength.MILLIMETERS,
state_class=SensorStateClass.TOTAL_INCREASING,
translation_key="rain_counter_today",
),
"svHmIPRainCounterYesterday": HmSensorEntityDescription(
key="RAIN_COUNTER_YESTERDAY",
native_unit_of_measurement=UnitOfLength.MILLIMETERS,
state_class=SensorStateClass.TOTAL_INCREASING,
translation_key="rain_counter_yesterday",
),
"svHmIPSunshineCounter": HmSensorEntityDescription(
key="SUNSHINE_COUNTER",
native_unit_of_measurement=UnitOfTime.MINUTES,
device_class=SensorDeviceClass.DURATION,
state_class=SensorStateClass.TOTAL_INCREASING,
translation_key="sunshine_counter_total",
),
"svHmIPSunshineCounterToday": HmSensorEntityDescription(
key="SUNSHINE_COUNTER_TODAY",
native_unit_of_measurement=UnitOfTime.MINUTES,
device_class=SensorDeviceClass.DURATION,
state_class=SensorStateClass.TOTAL_INCREASING,
translation_key="sunshine_counter_today",
),
"svHmIPSunshineCounterYesterday": HmSensorEntityDescription(
key="SUNSHINE_COUNTER_YESTERDAY",
native_unit_of_measurement=UnitOfTime.MINUTES,
device_class=SensorDeviceClass.DURATION,
state_class=SensorStateClass.TOTAL_INCREASING,
translation_key="sunshine_counter_yesterday",
),
}


_SENSOR_DESCRIPTIONS_BY_DEVICE_AND_PARAM: Mapping[tuple[str | tuple[str, ...], str], EntityDescription] = {
(
"HmIP-WKP",
Expand Down
24 changes: 18 additions & 6 deletions custom_components/homematicip_local/generic_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,24 @@ def __init__(
self.entity_description = entity_description
else:
self._attr_entity_registry_enabled_default = data_point.enabled_default
if isinstance(data_point, GenericDataPoint):
if isinstance(data_point, GenericSysvarDataPoint):
self._attr_translation_key = data_point.name.lower()
else:
self._attr_name = data_point.name

self._attr_device_info = control_unit.device_info
self._attr_device_info = self._get_device_info()
self._unregister_callbacks: list[CALLBACK_TYPE] = []
_LOGGER.debug("init sysvar: Setting up %s", self._data_point.name)

def _get_device_info(self) -> DeviceInfo | None:
"""Return device specific attributes."""
if self._data_point.channel is None:
return self._cu.device_info

return DeviceInfo(
identifiers={(DOMAIN, self._data_point.channel.device.identifier)},
)

@property
def available(self) -> bool:
"""Return if entity is available."""
Expand All @@ -348,11 +357,13 @@ def name(self) -> str | UndefinedType | None:
and the second part is the english named parameter that must be translated.
This translated parameter will be used in the combined name.
"""

entity_name = self._data_point.name
if (translated_name := super().name) is not None:
entity_name = translated_name # type: ignore[assignment]

if entity_name:
if (translated_name := super().name) is not None and not isinstance(translated_name, UndefinedType):
entity_name = translated_name

if not self._data_point.channel and entity_name and isinstance(entity_name, str):
if isinstance(self._data_point, GenericSysvarDataPoint) and not entity_name.lower().startswith(
tuple({"v_", "sv_", "sv"})
):
Expand All @@ -364,7 +375,8 @@ def name(self) -> str | UndefinedType | None:

if entity_name == "":
return None

if isinstance(entity_name, UndefinedType):
return None
return entity_name.replace("_", " ")

async def async_added_to_hass(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/homematicip_local/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"iot_class": "local_push",
"issue_tracker": "https://github.com/sukramj/hahomematic/issues",
"loggers": ["hahomematic"],
"requirements": ["hahomematic==2025.1.1"],
"requirements": ["hahomematic==2025.1.2"],
"ssdp": [
{
"manufacturer": "EQ3",
Expand Down
22 changes: 9 additions & 13 deletions custom_components/homematicip_local/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from homeassistant.helpers.typing import StateType

from . import HomematicConfigEntry
from .const import TOTAL_SYSVAR, HmEntityState
from .const import HmEntityState
from .control_unit import ControlUnit, signal_new_data_point
from .entity_helpers import HmSensorEntityDescription
from .generic_entity import ATTR_VALUE_STATE, HaHomematicGenericEntity, HaHomematicGenericSysvarEntity
Expand Down Expand Up @@ -161,21 +161,17 @@ def __init__(
) -> None:
"""Initialize the sensor entity."""
super().__init__(control_unit=control_unit, data_point=data_point)
if data_point.data_type == SysvarType.LIST:
self._attr_options = list(data_point.values) if data_point.values else None
self._attr_device_class = SensorDeviceClass.ENUM
else:
if data_point.data_type in (
if not hasattr(self, "entity_description"):
if data_point.data_type == SysvarType.LIST:
self._attr_options = list(data_point.values) if data_point.values else None
self._attr_device_class = SensorDeviceClass.ENUM
elif data_point.data_type in (
SysvarType.FLOAT,
SysvarType.INTEGER,
):
self._attr_state_class = (
SensorStateClass.TOTAL_INCREASING
if data_point.name.startswith(TOTAL_SYSVAR)
else SensorStateClass.MEASUREMENT
)
if unit := data_point.unit:
self._attr_native_unit_of_measurement = unit
self._attr_state_class = SensorStateClass.MEASUREMENT
if unit := data_point.unit:
self._attr_native_unit_of_measurement = unit

@property
def native_value(self) -> StateType | date | datetime | Decimal:
Expand Down
4 changes: 2 additions & 2 deletions custom_components/homematicip_local/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ async def _async_service_get_variable_value(hass: HomeAssistant, service: Servic

if control := _async_get_control_unit(hass=hass, entry_id=entry_id):
try:
if (value := await control.central.get_system_variable(name=name)) is not None:
if (value := await control.central.get_system_variable(legacy_name=name)) is not None:
return {"result": value}
except BaseHomematicException as ex:
raise HomeAssistantError(ex) from ex
Expand Down Expand Up @@ -562,7 +562,7 @@ async def _async_service_set_variable_value(hass: HomeAssistant, service: Servic
value = service.data[CONF_VALUE]

if control := _async_get_control_unit(hass=hass, entry_id=entry_id):
await control.central.set_system_variable(name=name, value=value)
await control.central.set_system_variable(legacy_name=name, value=value)


async def _async_service_clear_cache(hass: HomeAssistant, service: ServiceCall) -> None:
Expand Down
29 changes: 25 additions & 4 deletions custom_components/homematicip_local/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,12 @@
"energy_counter": {
"name": "Energy Counter"
},
"energy_counter_feed_in_total": {
"name": "Energy Counter feed in Total"
},
"energy_counter_total": {
"name": "Energy Counter Total"
},
"error": {
"name": "Error"
},
Expand Down Expand Up @@ -451,8 +457,14 @@
"power": {
"name": "Power"
},
"rain_counter": {
"name": "Rain Counter"
"rain_counter_today": {
"name": "Rain Counter Today"
},
"rain_counter_total": {
"name": "Rain Counter Total"
},
"rain_counter_yesterday": {
"name": "Rain Counter Yesterday"
},
"rssi_device": {
"name": "RSSI Device"
Expand Down Expand Up @@ -520,8 +532,17 @@
"status": {
"name": ""
},
"sunshineduration": {
"name": "Sunshineduration"
"sunshine_counter_today": {
"name": "Sunshine Counter Today"
},
"sunshine_counter_total": {
"name": "Sunshine Counter Total"
},
"sunshine_counter_yesterday": {
"name": "Sunshine Counter Yesterday"
},
"sunshine_duration": {
"name": "Sunshine Duration"
},
"taupunkt": {
"name": "dew point"
Expand Down
27 changes: 24 additions & 3 deletions custom_components/homematicip_local/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@
"energy_counter": {
"name": "Energiezähler"
},
"energy_counter_feed_in_total": {
"name": "Energiezähler Einspeisung Gesamt"
},
"energy_counter_total": {
"name": "Energiezähler Gesamt"
},
"error": {
"name": "Fehler"
},
Expand Down Expand Up @@ -455,8 +461,14 @@
"power": {
"name": "Leistung"
},
"rain_counter": {
"name": "Regenzähler"
"rain_counter_today": {
"name": "Regenzähler Heute"
},
"rain_counter_total": {
"name": "Regenzähler Gesamt"
},
"rain_counter_yesterday": {
"name": "Regenzähler Gestern"
},
"rssi_device": {
"name": "RSSI Device"
Expand Down Expand Up @@ -524,7 +536,16 @@
"status": {
"name": ""
},
"sunshineduration": {
"sunshine_counter_today": {
"name": "Sonnenscheinzähler Heute"
},
"sunshine_counter_total": {
"name": "Sonnenscheinzähler Gesamt"
},
"sunshine_counter_yesterday": {
"name": "Sonnenscheinzähler Gestern"
},
"sunshine_duration": {
"name": "Sonnenscheindauer"
},
"taupunkt": {
Expand Down
29 changes: 25 additions & 4 deletions custom_components/homematicip_local/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,12 @@
"energy_counter": {
"name": "Energy Counter"
},
"energy_counter_feed_in_total": {
"name": "Energy Counter feed in Total"
},
"energy_counter_total": {
"name": "Energy Counter Total"
},
"error": {
"name": "Error"
},
Expand Down Expand Up @@ -451,8 +457,14 @@
"power": {
"name": "Power"
},
"rain_counter": {
"name": "Rain Counter"
"rain_counter_today": {
"name": "Rain Counter Today"
},
"rain_counter_total": {
"name": "Rain Counter Total"
},
"rain_counter_yesterday": {
"name": "Rain Counter Yesterday"
},
"rssi_device": {
"name": "RSSI Device"
Expand Down Expand Up @@ -520,8 +532,17 @@
"status": {
"name": ""
},
"sunshineduration": {
"name": "Sunshineduration"
"sunshine_counter_today": {
"name": "Sunshine Counter Today"
},
"sunshine_counter_total": {
"name": "Sunshine Counter Total"
},
"sunshine_counter_yesterday": {
"name": "Sunshine Counter Yesterday"
},
"sunshine_duration": {
"name": "Sunshine Duration"
},
"taupunkt": {
"name": "dew point"
Expand Down
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-r requirements_test_pre_commit.txt

async-upnp-client==0.42.0
hahomematic==2025.1.1
hahomematic==2025.1.2
homeassistant==2025.1.0
isal==1.7.1
mypy-dev==1.14.0a7
Expand Down
Loading

0 comments on commit 6b8c6f6

Please sign in to comment.