Dsmr eon hungary (#138162)

Add EON hungary
This commit is contained in:
balazs92117
2025-02-11 17:25:57 +01:00
committed by GitHub
parent ab1e1c06b6
commit a85bb98743
7 changed files with 303 additions and 10 deletions

View File

@@ -115,7 +115,7 @@ SENSORS: tuple[DSMRSensorEntityDescription, ...] = (
key="electricity_active_tariff",
translation_key="electricity_active_tariff",
obis_reference="ELECTRICITY_ACTIVE_TARIFF",
dsmr_versions={"2.2", "4", "5", "5B", "5L"},
dsmr_versions={"2.2", "4", "5", "5B", "5L", "5EONHU"},
device_class=SensorDeviceClass.ENUM,
options=["low", "normal"],
),
@@ -123,7 +123,7 @@ SENSORS: tuple[DSMRSensorEntityDescription, ...] = (
key="electricity_used_tariff_1",
translation_key="electricity_used_tariff_1",
obis_reference="ELECTRICITY_USED_TARIFF_1",
dsmr_versions={"2.2", "4", "5", "5B", "5L"},
dsmr_versions={"2.2", "4", "5", "5B", "5L", "5EONHU"},
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
@@ -131,7 +131,25 @@ SENSORS: tuple[DSMRSensorEntityDescription, ...] = (
key="electricity_used_tariff_2",
translation_key="electricity_used_tariff_2",
obis_reference="ELECTRICITY_USED_TARIFF_2",
dsmr_versions={"2.2", "4", "5", "5B", "5L"},
dsmr_versions={"2.2", "4", "5", "5B", "5L", "5EONHU"},
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
DSMRSensorEntityDescription(
key="electricity_used_tariff_3",
translation_key="electricity_used_tariff_3",
obis_reference="ELECTRICITY_USED_TARIFF_3",
dsmr_versions={"5EONHU"},
force_update=True,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
DSMRSensorEntityDescription(
key="electricity_used_tariff_4",
translation_key="electricity_used_tariff_4",
obis_reference="ELECTRICITY_USED_TARIFF_4",
dsmr_versions={"5EONHU"},
force_update=True,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
@@ -139,7 +157,7 @@ SENSORS: tuple[DSMRSensorEntityDescription, ...] = (
key="electricity_delivered_tariff_1",
translation_key="electricity_delivered_tariff_1",
obis_reference="ELECTRICITY_DELIVERED_TARIFF_1",
dsmr_versions={"2.2", "4", "5", "5B", "5L"},
dsmr_versions={"2.2", "4", "5", "5B", "5L", "5EONHU"},
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
@@ -147,7 +165,25 @@ SENSORS: tuple[DSMRSensorEntityDescription, ...] = (
key="electricity_delivered_tariff_2",
translation_key="electricity_delivered_tariff_2",
obis_reference="ELECTRICITY_DELIVERED_TARIFF_2",
dsmr_versions={"2.2", "4", "5", "5B", "5L"},
dsmr_versions={"2.2", "4", "5", "5B", "5L", "5EONHU"},
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
DSMRSensorEntityDescription(
key="electricity_delivered_tariff_3",
translation_key="electricity_delivered_tariff_3",
obis_reference="ELECTRICITY_DELIVERED_TARIFF_3",
dsmr_versions={"5EONHU"},
force_update=True,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
DSMRSensorEntityDescription(
key="electricity_delivered_tariff_4",
translation_key="electricity_delivered_tariff_4",
obis_reference="ELECTRICITY_DELIVERED_TARIFF_4",
dsmr_versions={"5EONHU"},
force_update=True,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
@@ -341,7 +377,7 @@ SENSORS: tuple[DSMRSensorEntityDescription, ...] = (
key="electricity_imported_total",
translation_key="electricity_imported_total",
obis_reference="ELECTRICITY_IMPORTED_TOTAL",
dsmr_versions={"5L", "5S", "Q3D"},
dsmr_versions={"5L", "5S", "Q3D", "5EONHU"},
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
@@ -349,7 +385,7 @@ SENSORS: tuple[DSMRSensorEntityDescription, ...] = (
key="electricity_exported_total",
translation_key="electricity_exported_total",
obis_reference="ELECTRICITY_EXPORTED_TOTAL",
dsmr_versions={"5L", "5S", "Q3D"},
dsmr_versions={"5L", "5S", "Q3D", "5EONHU"},
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
@@ -387,6 +423,113 @@ SENSORS: tuple[DSMRSensorEntityDescription, ...] = (
device_class=SensorDeviceClass.GAS,
state_class=SensorStateClass.TOTAL_INCREASING,
),
DSMRSensorEntityDescription(
key="actual_threshold_electricity",
translation_key="actual_threshold_electricity",
obis_reference="ACTUAL_TRESHOLD_ELECTRICITY", # Misspelled in external tool
dsmr_versions={"5EONHU"},
device_class=SensorDeviceClass.POWER,
entity_registry_enabled_default=False,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
DSMRSensorEntityDescription(
key="eon_hu_electricity_combined",
translation_key="electricity_combined",
obis_reference="EON_HU_ELECTRICITY_COMBINED",
dsmr_versions={"5EONHU"},
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL,
),
DSMRSensorEntityDescription(
key="eon_hu_instantaneous_power_factor_total",
translation_key="instantaneous_power_factor_total",
obis_reference="EON_HU_INSTANTANEOUS_POWER_FACTOR_TOTAL",
dsmr_versions={"5EONHU"},
entity_registry_enabled_default=False,
device_class=SensorDeviceClass.POWER_FACTOR,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
DSMRSensorEntityDescription(
key="eon_hu_instantaneous_power_factor_l1",
translation_key="instantaneous_power_factor_l1",
obis_reference="EON_HU_INSTANTANEOUS_POWER_FACTOR_L1",
dsmr_versions={"5EONHU"},
entity_registry_enabled_default=False,
device_class=SensorDeviceClass.POWER_FACTOR,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
DSMRSensorEntityDescription(
key="eon_hu_instantaneous_power_factor_l2",
translation_key="instantaneous_power_factor_l2",
obis_reference="EON_HU_INSTANTANEOUS_POWER_FACTOR_L2",
dsmr_versions={"5EONHU"},
entity_registry_enabled_default=False,
device_class=SensorDeviceClass.POWER_FACTOR,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
DSMRSensorEntityDescription(
key="eon_hu_instantaneous_power_factor_l3",
translation_key="instantaneous_power_factor_l3",
obis_reference="EON_HU_INSTANTANEOUS_POWER_FACTOR_L3",
dsmr_versions={"5EONHU"},
entity_registry_enabled_default=False,
device_class=SensorDeviceClass.POWER_FACTOR,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
DSMRSensorEntityDescription(
key="eon_hu_frequency",
translation_key="frequency",
obis_reference="EON_HU_FREQUENCY",
dsmr_versions={"5EONHU"},
entity_registry_enabled_default=False,
device_class=SensorDeviceClass.FREQUENCY,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
DSMRSensorEntityDescription(
key="fuse_threshold_l1",
translation_key="fuse_threshold_l1",
obis_reference="FUSE_THRESHOLD_L1",
dsmr_versions={"5EONHU"},
device_class=SensorDeviceClass.CURRENT,
entity_registry_enabled_default=False,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
DSMRSensorEntityDescription(
key="fuse_threshold_l2",
translation_key="fuse_threshold_l2",
obis_reference="FUSE_THRESHOLD_L2",
dsmr_versions={"5EONHU"},
device_class=SensorDeviceClass.CURRENT,
entity_registry_enabled_default=False,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
DSMRSensorEntityDescription(
key="fuse_threshold_l3",
translation_key="fuse_threshold_l3",
obis_reference="FUSE_THRESHOLD_L3",
dsmr_versions={"5EONHU"},
device_class=SensorDeviceClass.CURRENT,
entity_registry_enabled_default=False,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
DSMRSensorEntityDescription(
key="text_message",
translation_key="text_message",
obis_reference="TEXT_MESSAGE",
dsmr_versions={"5EONHU"},
entity_registry_enabled_default=False,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
)
SENSORS_MBUS_DEVICE_TYPE: dict[int, tuple[DSMRSensorEntityDescription, ...]] = {
@@ -844,8 +987,9 @@ class DSMREntity(SensorEntity):
def translate_tariff(value: str, dsmr_version: str) -> str | None:
"""Convert 2/1 to normal/low depending on DSMR version."""
# DSMR V5B: Note: In Belgium values are swapped:
# DSMR V5EONHU: Note: In EON HUngary values are swapped:
# Rate code 2 is used for low rate and rate code 1 is used for normal rate.
if dsmr_version == "5B":
if dsmr_version in ("5B", "5EONHU"):
if value == "0001":
value = "0002"
elif value == "0002":