Skip to content

Commit

Permalink
set non unique device name to water meter instead of just meter
Browse files Browse the repository at this point in the history
  • Loading branch information
elad-bar committed Jun 27, 2024
1 parent 1fbb24c commit 4edb8a3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## v3.0.7

- Adjust non unique device names:

| Approach | Meter | Account | Reason |
| ---------------- | --------------------------------- | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| 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) |
| 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) |

## v3.0.6

- Improve reconnect process (cool-down between attempts)
Expand Down
4 changes: 2 additions & 2 deletions custom_components/citymind_water_meter/common/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class AlertType(Enum):


class EntityType(StrEnum):
METER = "meter"
ACCOUNT = "account"
METER = "Water Meter"
ACCOUNT = "Account"


class ResetPolicy(Enum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
SETTINGS_ALERT_TYPE_ID,
SETTINGS_MEDIA_TYPE_ID,
)
from ..common.enums import AlertChannel, AlertType, EntityType
from ..common.enums import AlertChannel, AlertType, EntityKeys, EntityType
from ..managers.config_manager import ConfigManager
from ..models.account_data import AccountData
from .base_processor import BaseProcessor
Expand Down Expand Up @@ -112,8 +112,8 @@ def _process_api_data(self):
)

@staticmethod
def _get_alert_settings(settings_section: dict) -> dict[EntityType, bool]:
alert_settings: dict[EntityType, bool] = {}
def _get_alert_settings(settings_section: dict) -> dict[EntityKeys, bool]:
alert_settings: dict[EntityKeys, bool] = {}
for entity_type in ALERT_MAPPING:
alert_mapping = ALERT_MAPPING[entity_type]

Expand Down
4 changes: 2 additions & 2 deletions custom_components/citymind_water_meter/models/account_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import json

from custom_components.citymind_water_meter.common.enums import EntityType
from custom_components.citymind_water_meter.common.enums import EntityKeys


class AccountData:
Expand All @@ -16,7 +16,7 @@ class AccountData:
vacations: int | None
alerts: int | None
messages: int | None
alert_settings: dict[EntityType, bool] | None
alert_settings: dict[EntityKeys, bool] | None

def __init__(self):
self.account_number = None
Expand Down

0 comments on commit 4edb8a3

Please sign in to comment.