mirror of
https://github.com/Andre0512/pyhOn.git
synced 2024-11-28 00:10:50 +01:00
Merge remote-tracking branch 'origin/main'
# Conflicts: # pyhon/appliance.py
This commit is contained in:
commit
a68dcac379
@ -13,7 +13,7 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
class HonAppliance:
|
class HonAppliance:
|
||||||
def __init__(
|
def __init__(
|
||||||
self, api: Optional["HonAPI"], info: Dict[str, Any], zone: int = 0
|
self, api: Optional["HonAPI"], info: Dict[str, Any], zone: int = 0
|
||||||
) -> None:
|
) -> None:
|
||||||
if attributes := info.get("attributes"):
|
if attributes := info.get("attributes"):
|
||||||
info["attributes"] = {v["parName"]: v["parValue"] for v in attributes}
|
info["attributes"] = {v["parName"]: v["parValue"] for v in attributes}
|
||||||
@ -129,8 +129,8 @@ class HonAppliance:
|
|||||||
command = self.commands[name]
|
command = self.commands[name]
|
||||||
for key, data in command.settings.items():
|
for key, data in command.settings.items():
|
||||||
if (
|
if (
|
||||||
not isinstance(data, HonParameterFixed)
|
not isinstance(data, HonParameterFixed)
|
||||||
and parameters.get(key) is not None
|
and parameters.get(key) is not None
|
||||||
):
|
):
|
||||||
with suppress(ValueError):
|
with suppress(ValueError):
|
||||||
data.value = parameters.get(key)
|
data.value = parameters.get(key)
|
||||||
@ -175,7 +175,9 @@ class HonAppliance:
|
|||||||
def parameters(self):
|
def parameters(self):
|
||||||
result = {}
|
result = {}
|
||||||
for name, command in self._commands.items():
|
for name, command in self._commands.items():
|
||||||
for key, parameter in (command.parameters | command.ancillary_parameters).items():
|
for key, parameter in (
|
||||||
|
command.parameters | command.ancillary_parameters
|
||||||
|
).items():
|
||||||
result.setdefault(name, {})[key] = parameter.value
|
result.setdefault(name, {})[key] = parameter.value
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -61,8 +61,9 @@ class Hon:
|
|||||||
async def setup(self) -> None:
|
async def setup(self) -> None:
|
||||||
appliance: Dict
|
appliance: Dict
|
||||||
for appliance in (await self.api.load_appliances())["payload"]["appliances"]:
|
for appliance in (await self.api.load_appliances())["payload"]["appliances"]:
|
||||||
for zone in range(int(appliance.get("zone", "0"))):
|
if (zones := int(appliance.get("zone", "0"))) > 1:
|
||||||
await self._create_appliance(appliance.copy(), zone=zone + 1)
|
for zone in range(zones):
|
||||||
|
await self._create_appliance(appliance.copy(), zone=zone + 1)
|
||||||
await self._create_appliance(appliance)
|
await self._create_appliance(appliance)
|
||||||
|
|
||||||
async def close(self) -> None:
|
async def close(self) -> None:
|
||||||
|
2
setup.py
2
setup.py
@ -7,7 +7,7 @@ with open("README.md", "r") as f:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="pyhOn",
|
name="pyhOn",
|
||||||
version="0.8.0b4",
|
version="0.8.0b5",
|
||||||
author="Andre Basche",
|
author="Andre Basche",
|
||||||
description="Control hOn devices with python",
|
description="Control hOn devices with python",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
|
Loading…
Reference in New Issue
Block a user