mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Upgrade PyISY to v2.1.0, add support for variable precision (#42043)
This commit is contained in:
parent
d96a1744f0
commit
941453dca9
@ -156,7 +156,6 @@ async def async_setup_entry(
|
||||
password=password,
|
||||
use_https=https,
|
||||
tls_ver=tls_version,
|
||||
log=_LOGGER,
|
||||
webroot=host.path,
|
||||
)
|
||||
)
|
||||
|
@ -94,13 +94,12 @@ def _fetch_isy_configuration(
|
||||
password,
|
||||
use_https,
|
||||
tls_ver,
|
||||
log=_LOGGER,
|
||||
webroot=webroot,
|
||||
)
|
||||
except ValueError as err:
|
||||
raise InvalidAuth(err.args[0]) from err
|
||||
|
||||
return Configuration(log=_LOGGER, xml=isy_conn.get_config())
|
||||
return Configuration(xml=isy_conn.get_config())
|
||||
|
||||
|
||||
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
|
@ -402,7 +402,7 @@ async def migrate_old_unique_ids(
|
||||
def convert_isy_value_to_hass(
|
||||
value: Union[int, float, None],
|
||||
uom: str,
|
||||
precision: str,
|
||||
precision: Union[int, str],
|
||||
fallback_precision: Optional[int] = None,
|
||||
) -> Union[float, int]:
|
||||
"""Fix ISY Reported Values.
|
||||
@ -418,7 +418,7 @@ def convert_isy_value_to_hass(
|
||||
return None
|
||||
if uom in [UOM_DOUBLE_TEMP, UOM_ISYV4_DEGREES]:
|
||||
return round(float(value) / 2.0, 1)
|
||||
if precision != "0":
|
||||
if precision not in ("0", 0):
|
||||
return round(float(value) / 10 ** int(precision), int(precision))
|
||||
if fallback_precision:
|
||||
return round(float(value), fallback_precision)
|
||||
|
@ -2,7 +2,7 @@
|
||||
"domain": "isy994",
|
||||
"name": "Universal Devices ISY994",
|
||||
"documentation": "https://www.home-assistant.io/integrations/isy994",
|
||||
"requirements": ["pyisy==2.0.2"],
|
||||
"requirements": ["pyisy==2.1.0"],
|
||||
"codeowners": ["@bdraco", "@shbatm"],
|
||||
"config_flow": true,
|
||||
"ssdp": [
|
||||
|
@ -106,12 +106,16 @@ class ISYSensorVariableEntity(ISYEntity):
|
||||
@property
|
||||
def state(self):
|
||||
"""Return the state of the variable."""
|
||||
return self._node.status
|
||||
return convert_isy_value_to_hass(self._node.status, "", self._node.prec)
|
||||
|
||||
@property
|
||||
def device_state_attributes(self) -> Dict:
|
||||
"""Get the state attributes for the device."""
|
||||
return {"init_value": int(self._node.init)}
|
||||
return {
|
||||
"init_value": convert_isy_value_to_hass(
|
||||
self._node.init, "", self._node.prec
|
||||
)
|
||||
}
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
|
@ -1451,7 +1451,7 @@ pyirishrail==0.0.2
|
||||
pyiss==1.0.1
|
||||
|
||||
# homeassistant.components.isy994
|
||||
pyisy==2.0.2
|
||||
pyisy==2.1.0
|
||||
|
||||
# homeassistant.components.itach
|
||||
pyitachip2ir==0.0.7
|
||||
|
@ -709,7 +709,7 @@ pyipp==0.11.0
|
||||
pyiqvia==0.2.1
|
||||
|
||||
# homeassistant.components.isy994
|
||||
pyisy==2.0.2
|
||||
pyisy==2.1.0
|
||||
|
||||
# homeassistant.components.kira
|
||||
pykira==0.1.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user