mirror of
https://github.com/andvikt/mega_hacs.git
synced 2025-12-12 09:34:28 +05:00
Compare commits
6 Commits
v1.0.10b17
...
v1.0.10b20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28bf4393f0 | ||
|
|
5ecb246eff | ||
|
|
3ee464a896 | ||
|
|
6368fd7cfc | ||
|
|
647baa9bb1 | ||
|
|
614525b315 |
@@ -1,5 +1,5 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 1.0.10b17
|
current_version = 1.0.10b20
|
||||||
parse = (?P<major>\d+)(\.(?P<minor>\d+))(\.(?P<patch>\d+))(?P<release>[bf]*)(?P<build>\d*)
|
parse = (?P<major>\d+)(\.(?P<minor>\d+))(\.(?P<patch>\d+))(?P<release>[bf]*)(?P<build>\d*)
|
||||||
commit = True
|
commit = True
|
||||||
tag = True
|
tag = True
|
||||||
|
|||||||
@@ -130,7 +130,6 @@ class BaseMegaEntity(CoordinatorEntity, RestoreEntity):
|
|||||||
if self.hass is None or self.entity_id is None:
|
if self.hass is None or self.entity_id is None:
|
||||||
return {}
|
return {}
|
||||||
if self._customize is None:
|
if self._customize is None:
|
||||||
|
|
||||||
c_entity_id = self.hass.data.get(DOMAIN, {}).get(CONF_CUSTOM).get('entities', {}).get(self.entity_id, {})
|
c_entity_id = self.hass.data.get(DOMAIN, {}).get(CONF_CUSTOM).get('entities', {}).get(self.entity_id, {})
|
||||||
self.lg.debug(
|
self.lg.debug(
|
||||||
'customize %s with %s', self.entity_id, c_entity_id
|
'customize %s with %s', self.entity_id, c_entity_id
|
||||||
@@ -431,6 +430,8 @@ class MegaOutPort(MegaPushEntity):
|
|||||||
))
|
))
|
||||||
|
|
||||||
def _calc_brightness(self, brightness):
|
def _calc_brightness(self, brightness):
|
||||||
|
if brightness is None:
|
||||||
|
brightness = 0
|
||||||
pct = brightness / 255
|
pct = brightness / 255
|
||||||
pct = max((0, pct))
|
pct = max((0, pct))
|
||||||
pct = min((pct, 1))
|
pct = min((pct, 1))
|
||||||
@@ -440,6 +441,8 @@ class MegaOutPort(MegaPushEntity):
|
|||||||
return brightness
|
return brightness
|
||||||
|
|
||||||
def _cal_reverse_brightness(self, brightness):
|
def _cal_reverse_brightness(self, brightness):
|
||||||
|
if brightness is None:
|
||||||
|
brightness = 0
|
||||||
l, h = self.range
|
l, h = self.range
|
||||||
d = h - l
|
d = h - l
|
||||||
pct = (brightness - l) / d
|
pct = (brightness - l) / d
|
||||||
|
|||||||
@@ -15,5 +15,5 @@
|
|||||||
"@andvikt"
|
"@andvikt"
|
||||||
],
|
],
|
||||||
"issue_tracker": "https://github.com/andvikt/mega_hacs/issues",
|
"issue_tracker": "https://github.com/andvikt/mega_hacs/issues",
|
||||||
"version": "v1.0.10b17"
|
"version": "v1.0.10b20"
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,12 @@ class MegaI2C(FilterBadValues):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def customize(self):
|
def customize(self):
|
||||||
return super().customize.get(self.id_suffix, {}) or {}
|
ret = super().customize
|
||||||
|
_old = ret.get(self.id_suffix)
|
||||||
|
if _old is not None:
|
||||||
|
ret = ret.copy()
|
||||||
|
ret.update(_old)
|
||||||
|
return ret
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def extra_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
@@ -319,7 +324,10 @@ class Mega1WSensor(FilterBadValues):
|
|||||||
n = super().name
|
n = super().name
|
||||||
c = self.customize.get(CONF_NAME, {})
|
c = self.customize.get(CONF_NAME, {})
|
||||||
if isinstance(c, dict):
|
if isinstance(c, dict):
|
||||||
|
try:
|
||||||
c = c.get(self.key)
|
c = c.get(self.key)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return c or n
|
return c or n
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user