Skip to content

Commit 1798cd8

Browse files
authored
Merge pull request #78 from maorcc/improve-entity-name
set non unique device name to water meter instead of just meter
2 parents 1fbb24c + 4edb8a3 commit 1798cd8

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## v3.0.7
4+
5+
- Adjust non unique device names:
6+
7+
| Approach | Meter | Account | Reason |
8+
| ---------------- | --------------------------------- | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
9+
| Unique (Default) | {address} {meter serial number} | {first name} {last name} {account number} | [can't rename meter device to a meaningful name #39](https://github.com/maorcc/citymind_water_meter/issues/39) |
10+
| Non unique | Water Meter {meter serial number} | Account {account number} | [Bad Entity Names - seems to be translated from Hebrew #71](https://github.com/maorcc/citymind_water_meter/issues/71) |
11+
312
## v3.0.6
413

514
- Improve reconnect process (cool-down between attempts)

custom_components/citymind_water_meter/common/enums.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class AlertType(Enum):
1313

1414

1515
class EntityType(StrEnum):
16-
METER = "meter"
17-
ACCOUNT = "account"
16+
METER = "Water Meter"
17+
ACCOUNT = "Account"
1818

1919

2020
class ResetPolicy(Enum):

custom_components/citymind_water_meter/data_processors/account_processor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
SETTINGS_ALERT_TYPE_ID,
2222
SETTINGS_MEDIA_TYPE_ID,
2323
)
24-
from ..common.enums import AlertChannel, AlertType, EntityType
24+
from ..common.enums import AlertChannel, AlertType, EntityKeys, EntityType
2525
from ..managers.config_manager import ConfigManager
2626
from ..models.account_data import AccountData
2727
from .base_processor import BaseProcessor
@@ -112,8 +112,8 @@ def _process_api_data(self):
112112
)
113113

114114
@staticmethod
115-
def _get_alert_settings(settings_section: dict) -> dict[EntityType, bool]:
116-
alert_settings: dict[EntityType, bool] = {}
115+
def _get_alert_settings(settings_section: dict) -> dict[EntityKeys, bool]:
116+
alert_settings: dict[EntityKeys, bool] = {}
117117
for entity_type in ALERT_MAPPING:
118118
alert_mapping = ALERT_MAPPING[entity_type]
119119

custom_components/citymind_water_meter/models/account_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import json
44

5-
from custom_components.citymind_water_meter.common.enums import EntityType
5+
from custom_components.citymind_water_meter.common.enums import EntityKeys
66

77

88
class AccountData:
@@ -16,7 +16,7 @@ class AccountData:
1616
vacations: int | None
1717
alerts: int | None
1818
messages: int | None
19-
alert_settings: dict[EntityType, bool] | None
19+
alert_settings: dict[EntityKeys, bool] | None
2020

2121
def __init__(self):
2222
self.account_number = None

0 commit comments

Comments
 (0)