Compare commits

...

8 Commits

Author SHA1 Message Date
ec358034e1 Bump version 2023-07-22 11:48:47 +02:00
6cdac99ce8 Not loading favorite if base program renamed 2023-07-22 11:48:40 +02:00
0c1670733f Update requirements 2023-07-22 11:24:27 +02:00
744094dc07 Bump version 2023-07-19 19:55:10 +02:00
bf2015fcb9 Fix empty value in settings 2023-07-19 19:52:53 +02:00
bc7e8994c9 Bump version 2023-07-11 00:21:37 +02:00
8ca40d7ad0 Add missing requirement typing-extensions 2023-07-10 23:59:55 +02:00
9a6a07fd46 Sync enum values of commands 2023-07-10 23:58:24 +02:00
4 changed files with 19 additions and 12 deletions

View File

@ -11,6 +11,7 @@ from pyhon.attributes import HonAttribute
from pyhon.command_loader import HonCommandLoader from pyhon.command_loader import HonCommandLoader
from pyhon.commands import HonCommand from pyhon.commands import HonCommand
from pyhon.parameter.base import HonParameter from pyhon.parameter.base import HonParameter
from pyhon.parameter.enum import HonParameterEnum
from pyhon.parameter.range import HonParameterRange from pyhon.parameter.range import HonParameterRange
from pyhon.typedefs import Parameter from pyhon.typedefs import Parameter
@ -252,7 +253,9 @@ class HonAppliance:
if not (command := self.commands.get(command_name)): if not (command := self.commands.get(command_name)):
return return
for key in command.setting_keys: for key in command.setting_keys:
if (new := self.attributes.get("parameters", {}).get(key)) is None: if (
new := self.attributes.get("parameters", {}).get(key)
) is None or new.value == "":
continue continue
setting = command.settings[key] setting = command.settings[key]
try: try:
@ -283,4 +286,6 @@ class HonAppliance:
parameter.max = int(base_value.value) parameter.max = int(base_value.value)
parameter.min = int(base_value.value) parameter.min = int(base_value.value)
parameter.step = 1 parameter.step = 1
elif isinstance(parameter, HonParameterEnum):
parameter.values = base_value.values
parameter.value = base_value.value parameter.value = base_value.value

View File

@ -187,18 +187,19 @@ class HonCommandLoader:
command = favourite.get("command", {}) command = favourite.get("command", {})
command_name = command.get("commandName", "") command_name = command.get("commandName", "")
program_name = self._clean_name(command.get("programName", "")) program_name = self._clean_name(command.get("programName", ""))
base: HonCommand = copy( if not (base := self.commands[command_name].categories.get(program_name)):
self.commands[command_name].categories[program_name] continue
) base_command: HonCommand = copy(base)
for data in command.values(): for data in command.values():
if isinstance(data, str): if isinstance(data, str):
continue continue
for key, value in data.items(): for key, value in data.items():
if parameter := base.parameters.get(key): if parameter := base_command.parameters.get(key):
with suppress(ValueError): with suppress(ValueError):
parameter.value = value parameter.value = value
extra_param = HonParameterFixed("favourite", {"fixedValue": "1"}, "custom") extra_param = HonParameterFixed("favourite", {"fixedValue": "1"}, "custom")
base.parameters.update(favourite=extra_param) base_command.parameters.update(favourite=extra_param)
if isinstance(program := base.parameters["program"], HonParameterProgram): program = base_command.parameters["program"]
if isinstance(program, HonParameterProgram):
program.set_value(name) program.set_value(name)
self.commands[command_name].categories[name] = base self.commands[command_name].categories[name] = base_command

View File

@ -1,2 +1,3 @@
aiohttp==3.8.4 aiohttp==3.8.5
yarl==1.8.2 yarl==1.9.2
typing-extensions==4.7.1

View File

@ -7,7 +7,7 @@ with open("README.md", "r") as f:
setup( setup(
name="pyhOn", name="pyhOn",
version="0.14.8", version="0.14.11",
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,
@ -21,7 +21,7 @@ setup(
packages=find_packages(), packages=find_packages(),
include_package_data=True, include_package_data=True,
python_requires=">=3.10", python_requires=">=3.10",
install_requires=["aiohttp"], install_requires=["aiohttp==3.8.5", "typing-extensions==4.7.1"],
classifiers=[ classifiers=[
"Development Status :: 4 - Beta", "Development Status :: 4 - Beta",
"Environment :: Console", "Environment :: Console",