Skip to content

Commit

Permalink
Merge pull request #156 from andvikt/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
andvikt authored Oct 9, 2023
2 parents 8847290 + c45653b commit 03462ed
Show file tree
Hide file tree
Showing 9 changed files with 330 additions and 280 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.1.4
current_version = 1.1.7
parse = (?P<major>\d+)(\.(?P<minor>\d+))(\.(?P<patch>\d+))(?P<release>[bf]*)(?P<build>\d*)
commit = True
tag = True
Expand Down
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
*sync-conflict*
*.db
*.log*
*.yaml
**/__pycache__
test_*
temp_*
tr.py
experiment_*
example*
.HA_VERSION
.idea
.storage
site
.DS_Store
.venv
pyproject.toml
poetry.lock
8 changes: 4 additions & 4 deletions custom_components/mega/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ def extender(x):
CUSTOMIZE_PORT,
CUSTOMIZE_DS2413,
),
vol.Optional(CONF_FILTER_VALUES): [cv.positive_float],
vol.Optional(CONF_FILTER_SCALE): cv.positive_float,
vol.Optional(CONF_FILTER_LOW): cv.positive_float,
vol.Optional(CONF_FILTER_HIGH): cv.positive_float,
vol.Optional(CONF_FILTER_VALUES): [vol.Coerce(float)],
vol.Optional(CONF_FILTER_SCALE): vol.Coerce(float),
vol.Optional(CONF_FILTER_LOW): vol.Coerce(float),
vol.Optional(CONF_FILTER_HIGH): vol.Coerce(float),
},
vol.Optional(CONF_1WBUS): [OWBUS]
}
Expand Down
22 changes: 10 additions & 12 deletions custom_components/mega/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_NAME
from homeassistant.core import State
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from homeassistant.helpers.restore_state import RestoreEntity
from . import hub as h
Expand Down Expand Up @@ -142,7 +143,7 @@ def customize(self):
return self._customize

@property
def device_info(self):
def device_info(self) -> DeviceInfo:
if isinstance(self.port, list):
pt_idx = self.id_suffix
else:
Expand All @@ -151,19 +152,16 @@ def device_info(self):
pt_idx, _ = _pt.split('e')
else:
pt_idx = _pt
return {
"identifiers": {
return DeviceInfo(
identifiers={
# Serial numbers are unique identifiers within a specific domain
(DOMAIN, f'{self._mega_id}', pt_idx),
(DOMAIN, f'{self._mega_id}', pt_idx)
},
"config_entries": [
self.config_entry,
],
"name": f'{self._mega_id} port {pt_idx}' if not isinstance(self.port, list) else f'{self._mega_id} {pt_idx}',
"manufacturer": 'ab-log.ru',
"sw_version": self.mega.fw,
"via_device": (DOMAIN, self._mega_id),
}
name=self.name,
manufacturer='ab-log.ru',
sw_version=self.mega.fw,
via_device=(DOMAIN, self._mega_id),
)

@property
def lg(self) -> logging.Logger:
Expand Down
Loading

0 comments on commit 03462ed

Please sign in to comment.